Download code/tests/test_long_protocol.py from PratikBuilds/modelclinic-experiment-001: direct link, hf CLI and curl.
- Browser
- Download file 985 Bytes
-
https://huggingface.co/datasets/PratikBuilds/modelclinic-experiment-001/resolve/main/code/tests/test_long_protocol.py
- Command line
-
hf download hf://datasets/PratikBuilds/modelclinic-experiment-001/code/tests/test_long_protocol.py
-
curl -L -o test_long_protocol.py https://huggingface.co/datasets/PratikBuilds/modelclinic-experiment-001/resolve/main/code/tests/test_long_protocol.py
985 Bytes
| import unittest,sys,torch | |
| from pathlib import Path | |
| sys.path.insert(0,str(Path(__file__).resolve().parents[1]/'src')) | |
| from long_protocol import * | |
| class ProtocolTests(unittest.TestCase): | |
| def test_prompt(self):self.assertEqual(build_prompt('Q'),r'Q'+'\n'+r'Please reason step by step, and put your final answer within \boxed{}.') | |
| def test_penalty_excludes_prompt_and_counts_presence_once(self): | |
| scores=torch.zeros((1,8));ids=torch.tensor([[3,4,2,2,5]]);o=GeneratedPresencePenalty(2,1.5)(ids,scores);self.assertEqual(o[0,2],-1.5);self.assertEqual(o[0,5],-1.5);self.assertEqual(o[0,3],0);self.assertEqual(o[0,4],0) | |
| def test_extract_strict_reasoning_and_boxes(self): | |
| self.assertEqual(strict_extract(r'\boxed{1} </think> Answer \boxed{\frac{1}{2}}'),r'\frac{1}{2}');self.assertIsNone(strict_extract(r'\boxed{2} then \boxed{'));self.assertEqual(strict_extract('x \\boxed 5$'), '5');self.assertIsNone(strict_extract('The answer is 3')) | |
| if __name__=='__main__':unittest.main() | |