Download FIX_TRY_EXCEPT.py from dirven/numerai_all_48_models: direct link, hf CLI and curl.
- Browser
- Download file 1.5 kB
-
https://huggingface.co/datasets/dirven/numerai_all_48_models/resolve/main/FIX_TRY_EXCEPT.py
- Command line
-
hf download hf://datasets/dirven/numerai_all_48_models/FIX_TRY_EXCEPT.py
-
curl -L -o FIX_TRY_EXCEPT.py https://huggingface.co/datasets/dirven/numerai_all_48_models/resolve/main/FIX_TRY_EXCEPT.py
1.5 kB
| """ | |
| Fix the syntax error in download patches | |
| """ | |
| import os | |
| from pathlib import Path | |
| scripts_dir = Path("c:/numerai48models/scripts") | |
| all_scripts = list(scripts_dir.rglob("*.py")) | |
| fixed = 0 | |
| for script in all_scripts: | |
| try: | |
| with open(script, 'r', encoding='utf-8', errors='ignore') as f: | |
| content = f.read() | |
| # Fix the broken download syntax | |
| if 'napi.download_dataset( if not SKIP_API' in content: | |
| # Fix napi | |
| content = content.replace( | |
| 'napi.download_dataset( if not SKIP_API else print(" [SKIP_API] Skip download") or (', | |
| 'if not SKIP_API: napi.download_dataset(' | |
| ) | |
| # Fix sapi | |
| content = content.replace( | |
| 'sapi.download_dataset( if not SKIP_API else print(" [SKIP_API] Skip download") or (', | |
| 'if not SKIP_API: sapi.download_dataset(' | |
| ) | |
| # Fix capi | |
| content = content.replace( | |
| 'capi.download_dataset( if not SKIP_API else print(" [SKIP_API] Skip download") or (', | |
| 'if not SKIP_API: capi.download_dataset(' | |
| ) | |
| with open(script, 'w', encoding='utf-8', errors='ignore') as f: | |
| f.write(content) | |
| print(f"[OK] {script.relative_to(scripts_dir)}") | |
| fixed += 1 | |
| except Exception as e: | |
| print(f"[ERR] {script.name}: {e}") | |
| print(f"\nFixed {fixed} scripts!") | |