Text Classification
Laya
Safetensors
English
banking77
intent-classification
calibrated
selective-prediction
Eval Results (legacy)
Instructions to use VibeHash/laya-banking77 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Laya
How to use VibeHash/laya-banking77 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_data.py from VibeHash/laya-banking77: direct link, hf CLI and curl.
- Browser
- Download file 2.16 kB
-
https://huggingface.co/VibeHash/laya-banking77/resolve/main/code/tests/test_data.py
- Command line
-
hf download hf://VibeHash/laya-banking77/code/tests/test_data.py
-
curl -L -o test_data.py https://huggingface.co/VibeHash/laya-banking77/resolve/main/code/tests/test_data.py
2.16 kB
| """How Banking77 rows become Laya rows. No download: the inputs here are made up.""" | |
| from __future__ import annotations | |
| import tempfile | |
| import unittest | |
| from pathlib import Path | |
| from banking77 import data | |
| NAMES = ["activate_my_card", "Refund_not_showing_up", "card_arrival"] | |
| class OptionTextTests(unittest.TestCase): | |
| def test_label_names_read_as_words(self): | |
| self.assertEqual(data.option_text("card_arrival"), "card arrival") | |
| self.assertEqual(data.option_text("Refund_not_showing_up"), "refund not showing up") | |
| def test_labels_that_read_the_same_are_refused(self): | |
| with self.assertRaises(ValueError): | |
| data.question(["card_arrival", "Card_arrival"]) | |
| class RowTests(unittest.TestCase): | |
| def test_one_question_with_every_option_in_label_order(self): | |
| rows = data.rows([{"text": "Where is my card?", "label": 2}], NAMES) | |
| q = rows[0]["questions"][data.QUESTION_ID] | |
| self.assertEqual(q["type"], "choice") | |
| self.assertEqual(q["criteria"], ["activate my card", "refund not showing up", "card arrival"]) | |
| self.assertEqual(rows[0]["state"], "Where is my card?") | |
| self.assertEqual(rows[0]["expected"][data.QUESTION_ID], "card arrival") | |
| def test_jsonl_round_trip(self): | |
| rows = data.rows([{"text": "Refund?", "label": 1}, {"text": "Activate it", "label": 0}], NAMES) | |
| with tempfile.TemporaryDirectory() as tmp: | |
| path = Path(tmp) / "x.jsonl" | |
| data.write_jsonl(path, rows) | |
| self.assertEqual(data.read_jsonl(path), rows) | |
| class OverlapTests(unittest.TestCase): | |
| def test_counts_copies_ignoring_case_and_spacing(self): | |
| self.assertEqual(data.overlap(["Where is my card?", "hi"], ["where is my card?", "bye"]), 1) | |
| class LockTests(unittest.TestCase): | |
| def test_a_changed_test_file_is_refused(self): | |
| with tempfile.TemporaryDirectory() as tmp: | |
| path = Path(tmp) / "test.jsonl" | |
| path.write_text("not the locked test\n", encoding="utf-8") | |
| with self.assertRaises(RuntimeError): | |
| data.check_test_lock(path) | |
| if __name__ == "__main__": | |
| unittest.main() | |