Spaces:
Build error
Build error
Download models/models.py from srijaydeshpande/DiffusionGenerator: direct link, hf CLI and curl.
- Browser
- Download file 587 Bytes
-
https://huggingface.co/spaces/srijaydeshpande/DiffusionGenerator/resolve/main/models/models.py
- Command line
-
hf download hf://spaces/srijaydeshpande/DiffusionGenerator/models/models.py
-
curl -L -o models.py https://huggingface.co/spaces/srijaydeshpande/DiffusionGenerator/resolve/main/models/models.py
587 Bytes
| import torch | |
| def create_model(opt): | |
| if opt.model == 'pix2pixHD': | |
| from .pix2pixHD_model import Pix2PixHDModel, InferenceModel | |
| if opt.isTrain: | |
| model = Pix2PixHDModel() | |
| else: | |
| model = InferenceModel() | |
| else: | |
| from .ui_model import UIModel | |
| model = UIModel() | |
| model.initialize(opt) | |
| if opt.verbose: | |
| print("model [%s] was created" % (model.name())) | |
| if opt.isTrain and len(opt.gpu_ids) and not opt.fp16: | |
| model = torch.nn.DataParallel(model, device_ids=opt.gpu_ids) | |
| return model | |