Download lcb_runner/utils/path_utils.py from tokenintelligence/LiveCodeBench-SnapShot-0406: direct link, hf CLI and curl.
- Browser
- Download file 1.21 kB
-
https://huggingface.co/datasets/tokenintelligence/LiveCodeBench-SnapShot-0406/resolve/2bee680a8f3ed3896c79ab384da4acb4eebee7eb/lcb_runner/utils/path_utils.py
- Command line
-
hf download hf://datasets/tokenintelligence/LiveCodeBench-SnapShot-0406@2bee680a8f3ed3896c79ab384da4acb4eebee7eb/lcb_runner/utils/path_utils.py
-
curl -L -o path_utils.py https://huggingface.co/datasets/tokenintelligence/LiveCodeBench-SnapShot-0406/resolve/2bee680a8f3ed3896c79ab384da4acb4eebee7eb/lcb_runner/utils/path_utils.py
1.21 kB
| import pathlib | |
| from lcb_runner.lm_styles import LanguageModel, LMStyle | |
| from lcb_runner.utils.scenarios import Scenario | |
| def ensure_dir(path: str, is_file=True): | |
| if is_file: | |
| pathlib.Path(path).parent.mkdir(parents=True, exist_ok=True) | |
| else: | |
| pathlib.Path(path).mkdir(parents=True, exist_ok=True) | |
| return | |
| def get_cache_path(model_repr:str, args) -> str: | |
| scenario: Scenario = args.scenario | |
| n = args.n | |
| temperature = args.temperature | |
| path = f"cache/{model_repr}/{scenario}_{n}_{temperature}.json" | |
| ensure_dir(path) | |
| return path | |
| def get_output_path(model_repr:str, args) -> str: | |
| scenario: Scenario = args.scenario | |
| n = args.n | |
| temperature = args.temperature | |
| cot_suffix = "_cot" if args.cot_code_execution else "" | |
| path = f"output/{model_repr}/{scenario}_{n}_{temperature}{cot_suffix}.json" | |
| ensure_dir(path) | |
| return path | |
| def get_eval_all_output_path(model_repr:str, args) -> str: | |
| scenario: Scenario = args.scenario | |
| n = args.n | |
| temperature = args.temperature | |
| cot_suffix = "_cot" if args.cot_code_execution else "" | |
| path = f"output/{model_repr}/{scenario}_{n}_{temperature}{cot_suffix}_eval_all.json" | |
| return path | |