sail-sg / MDT

Masked Diffusion Transformer is the SOTA for image synthesis. (ICCV 2023)
Apache License 2.0
500 stars 35 forks source link

where to get mdt_xl2_v1_ckpt.pt? #1

Closed johndpope closed 1 year ago

johndpope commented 1 year ago

it's not clear where to get this from readme

╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮ │ /home/oem/Documents/gitWorkspace/MDT/infer_mdt.py:29 in │ │ │ │ 26 latent_size = image_size // 8 │ │ 27 model = MDT_XL_2(input_size=latent_size, decode_layer=2).to(device) │ │ 28 │ │ ❱ 29 state_dict = torch.load(model_path, map_location=lambda storage, loc: storage) │ │ 30 model.load_state_dict(state_dict) │ │ 31 model.eval() │ │ 32 diffusion = create_diffusion(str(num_sampling_steps)) │ │ │ │ /home/oem/miniconda3/envs/ldm2/lib/python3.9/site-packages/torch/serialization.py:771 in load │ │ │ │ 768 │ if 'encoding' not in pickle_load_args.keys(): │ │ 769 │ │ pickle_load_args['encoding'] = 'utf-8' │ │ 770 │ │ │ ❱ 771 │ with _open_file_like(f, 'rb') as opened_file: │ │ 772 │ │ if _is_zipfile(opened_file): │ │ 773 │ │ │ # The zipfile reader is going to advance the current file position. │ │ 774 │ │ │ # If we want to actually tail call to torch.jit.load, we need to │ │ │ │ /home/oem/miniconda3/envs/ldm2/lib/python3.9/site-packages/torch/serialization.py:270 in │ │ _open_file_like │ │ │ │ 267 │ │ 268 def _open_file_like(name_or_buffer, mode): │ │ 269 │ if _is_path(name_or_buffer): │ │ ❱ 270 │ │ return _open_file(name_or_buffer, mode) │ │ 271 │ else: │ │ 272 │ │ if 'w' in mode: │ │ 273 │ │ │ return _open_buffer_writer(name_or_buffer) │ │ │ │ /home/oem/miniconda3/envs/ldm2/lib/python3.9/site-packages/torch/serialization.py:251 in │ │ init │ │ │ │ 248 │ │ 249 class _open_file(_opener): │ │ 250 │ def init(self, name, mode): │ │ ❱ 251 │ │ super(_open_file, self).init(open(name, mode)) │ │ 252 │ │ │ 253 │ def exit(self, *args): │ │ 254 │ │ self.file_like.close() │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ FileNotFoundError: [Errno 2] No such file or directory: 'mdt_xl2_v1_ckpt.pt'

gasvn commented 1 year ago

Thanks for your interest. The ckpt size exceed the largest size allowed by the github release. So we are working on to make it host on the huggingface. We will release it very soon.

gasvn commented 1 year ago

Thanks for waiting. The pretrained model is now on hugglingface Pretrained model download, you can also download it with:

from huggingface_hub import snapshot_download
models_path = snapshot_download("shgao/MDT-XL2")
ckpt_model_path = os.path.join(models_path, "mdt_xl2_v1_ckpt.pt")

A hugglingface demo is on DEMO.