MCPcopy Create free account
hub / github.com/huggingface/transformers / test_run_squad

Method test_run_squad

examples/test_examples.py:103–127  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

101 self.assertLess(result["perplexity"], 35)
102
103 def test_run_squad(self):
104 stream_handler = logging.StreamHandler(sys.stdout)
105 logger.addHandler(stream_handler)
106
107 testargs = """
108 run_squad.py
109 --model_type=distilbert
110 --model_name_or_path=sshleifer/tiny-distilbert-base-cased-distilled-squad
111 --data_dir=./tests/fixtures/tests_samples/SQUAD
112 --output_dir=./tests/fixtures/tests_samples/temp_dir
113 --max_steps=10
114 --warmup_steps=2
115 --do_train
116 --do_eval
117 --version_2_with_negative
118 --learning_rate=2e-4
119 --per_gpu_train_batch_size=2
120 --per_gpu_eval_batch_size=1
121 --overwrite_output_dir
122 --seed=42
123 """.split()
124 with patch.object(sys, "argv", testargs):
125 result = run_squad.main()
126 self.assertGreaterEqual(result["f1"], 25)
127 self.assertGreaterEqual(result["exact"], 21)
128
129 def test_generation(self):
130 stream_handler = logging.StreamHandler(sys.stdout)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected