Spaces:
Runtime error
Runtime error
Download scripts/train.py from PKUWilliamYang/StyleGANEX: direct link, hf CLI and curl.
- Browser
- Download file 635 Bytes
-
https://huggingface.co/spaces/PKUWilliamYang/StyleGANEX/resolve/main/scripts/train.py
- Command line
-
hf download hf://spaces/PKUWilliamYang/StyleGANEX/scripts/train.py
-
curl -L -o train.py https://huggingface.co/spaces/PKUWilliamYang/StyleGANEX/resolve/main/scripts/train.py
635 Bytes
| """ | |
| This file runs the main training/val loop | |
| """ | |
| import os | |
| import json | |
| import sys | |
| import pprint | |
| sys.path.append(".") | |
| sys.path.append("..") | |
| from options.train_options import TrainOptions | |
| from training.coach import Coach | |
| def main(): | |
| opts = TrainOptions().parse() | |
| if os.path.exists(opts.exp_dir): | |
| raise Exception('Oops... {} already exists'.format(opts.exp_dir)) | |
| os.makedirs(opts.exp_dir) | |
| opts_dict = vars(opts) | |
| pprint.pprint(opts_dict) | |
| with open(os.path.join(opts.exp_dir, 'opt.json'), 'w') as f: | |
| json.dump(opts_dict, f, indent=4, sort_keys=True) | |
| coach = Coach(opts) | |
| coach.train() | |
| if __name__ == '__main__': | |
| main() | |