Downloads a pre-trained DiT model from the web.
(model_name)
| 11 | |
| 12 | |
| 13 | def download_model(model_name): |
| 14 | """ |
| 15 | Downloads a pre-trained DiT model from the web. |
| 16 | """ |
| 17 | local_path = f"pretrained_models/{model_name}" |
| 18 | if not os.path.isfile(local_path): |
| 19 | os.makedirs("pretrained_models", exist_ok=True) |
| 20 | web_path = f"https://dl.fbaipublicfiles.com/DiT/models/{model_name}" |
| 21 | download_url(web_path, "pretrained_models") |
| 22 | model = torch.load(local_path, map_location=lambda storage, loc: storage) |
| 23 | return model |
| 24 | |
| 25 | |
| 26 | def main(args): |