Text Classification
Laya
Safetensors
English
ledgar
lexglue
legal
contracts
calibrated
selective-prediction
Eval Results (legacy)
Instructions to use VibeHash/laya-ledgar with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Laya
How to use VibeHash/laya-ledgar with Laya:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
Download code/tests/test_common.py from VibeHash/laya-ledgar: direct link, hf CLI and curl.
- Browser
- Download file 1.87 kB
-
https://huggingface.co/VibeHash/laya-ledgar/resolve/main/code/tests/test_common.py
- Command line
-
hf download hf://VibeHash/laya-ledgar/code/tests/test_common.py
-
curl -L -o test_common.py https://huggingface.co/VibeHash/laya-ledgar/resolve/main/code/tests/test_common.py
1.87 kB
| """The shared file helpers: where things go, and that files round-trip unchanged.""" | |
| from __future__ import annotations | |
| import os | |
| import tempfile | |
| import unittest | |
| from pathlib import Path | |
| from unittest import mock | |
| from layatasks import common | |
| class HomeTests(unittest.TestCase): | |
| def test_each_task_gets_its_own_folder_under_the_home(self): | |
| with mock.patch.dict(os.environ, {"LAYA_TASKS_HOME": "/tmp/somewhere"}): | |
| self.assertEqual(common.data_dir("clinc150"), Path("/tmp/somewhere/clinc150/data/v1")) | |
| self.assertEqual(common.run_dir("ledgar", "seed0"), Path("/tmp/somewhere/ledgar/runs/seed0")) | |
| class FileTests(unittest.TestCase): | |
| def test_jsonl_round_trip_keeps_non_ascii_text(self): | |
| rows = [{"state": "café déjà vu", "n": 1}, {"state": "plain", "n": 2}] | |
| with tempfile.TemporaryDirectory() as tmp: | |
| path = Path(tmp) / "x.jsonl" | |
| common.write_jsonl(path, rows) | |
| self.assertEqual(common.read_jsonl(path), rows) | |
| self.assertFalse(path.with_suffix(".jsonl.tmp").exists()) | |
| def test_json_round_trip(self): | |
| with tempfile.TemporaryDirectory() as tmp: | |
| path = Path(tmp) / "x.json" | |
| common.write_json(path, {"a": [1, 2]}) | |
| self.assertEqual(common.read_json(path), {"a": [1, 2]}) | |
| def test_sha256_of_known_bytes(self): | |
| with tempfile.TemporaryDirectory() as tmp: | |
| path = Path(tmp) / "abc" | |
| path.write_bytes(b"abc") | |
| self.assertEqual(common.sha256_file(path), | |
| "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad") | |
| class NormaliseTests(unittest.TestCase): | |
| def test_case_and_spacing_are_ignored(self): | |
| self.assertEqual(common.normalise(" Where IS\tmy card? "), "where is my card?") | |
| if __name__ == "__main__": | |
| unittest.main() | |