Download code/train_encoder_seed.py from jamie33/926: direct link, hf CLI and curl.
- Browser
- Download file 982 Bytes
-
https://huggingface.co/datasets/jamie33/926/resolve/main/code/train_encoder_seed.py
- Command line
-
hf download hf://datasets/jamie33/926/code/train_encoder_seed.py
-
curl -L -o train_encoder_seed.py https://huggingface.co/datasets/jamie33/926/resolve/main/code/train_encoder_seed.py
982 Bytes
| """Run scripts/train_encoder_validation_safe.py with its hard-coded root redirected to the local copy.""" | |
| import os | |
| import sys | |
| import types | |
| from pathlib import Path | |
| if "wandb" not in sys.modules: | |
| try: | |
| import wandb # noqa: F401 | |
| except ImportError: | |
| stub = types.ModuleType("wandb") | |
| stub.init = lambda *a, **k: None | |
| stub.log = lambda *a, **k: None | |
| stub.finish = lambda *a, **k: None | |
| stub.watch = lambda *a, **k: None | |
| stub.config = types.SimpleNamespace() | |
| sys.modules["wandb"] = stub | |
| REFS = Path(os.environ.get("BB3D_REFS", "/home/hubin/workspace/July/brain3d_refs")) | |
| src = (REFS / "scripts" / "train_encoder_validation_safe.py").read_text() | |
| src = src.replace('Path("/public/interns/hubin/jmtseng/brain3d_refs")', f'Path("{REFS}")') | |
| sys.argv = [str(REFS / "scripts" / "train_encoder_validation_safe.py"), *sys.argv[1:]] | |
| exec(compile(src, sys.argv[0], "exec"), {"__name__": "__main__", "__file__": sys.argv[0]}) | |