Download models/CodeFormer/basicsr/utils/training_guards.py from suplo6669/Enhancer: direct link, hf CLI and curl.
- Browser
- Download file 681 Bytes
-
https://huggingface.co/spaces/suplo6669/Enhancer/resolve/main/models/CodeFormer/basicsr/utils/training_guards.py
- Command line
-
hf download hf://spaces/suplo6669/Enhancer/models/CodeFormer/basicsr/utils/training_guards.py
-
curl -L -o training_guards.py https://huggingface.co/spaces/suplo6669/Enhancer/resolve/main/models/CodeFormer/basicsr/utils/training_guards.py
681 Bytes
| """Required pretrained networks must never be replaced by random teachers.""" | |
| from pathlib import Path | |
| def teacher_options(options): | |
| config = dict(options['network_vqgan']) | |
| raw = config.get('model_path') | |
| if not raw: | |
| raise ValueError('network_vqgan.model_path is required for latent ground truth') | |
| path = Path(raw) | |
| if not path.is_absolute(): | |
| root = Path(options.get('path', {}).get('root') or Path(__file__).resolve().parents[2]) | |
| path = root / path | |
| path = path.resolve() | |
| if not path.is_file(): | |
| raise FileNotFoundError(f'Pretrained VQGAN teacher not found: {path}') | |
| config['model_path'] = str(path) | |
| return config | |