kuprel / min-dalle

min(DALL·E) is a fast, minimal port of DALL·E Mini to PyTorch
MIT License
3.48k stars 256 forks source link

Collab error output, related to pretrained/vqgan/flax_model.msgpack #3

Closed Gabrielmtn closed 2 years ago

Gabrielmtn commented 2 years ago

Just quickly sharing an error output from the collab, impressive project!


FileNotFoundError Traceback (most recent call last) in () 1 from min_dalle.generate_image import generate_image_from_text 2 ----> 3 image = generate_image_from_text("alien life", seed=7) 4 display(image)

2 frames /content/min-dalle/min_dalle/generate_image.py in generate_image_from_text(text, is_mega, is_torch, seed, image_token_count) 72 73 if image_token_count == config['image_length']: ---> 74 image = detokenize_torch(image_tokens) 75 return Image.fromarray(image) 76 else:

/content/min-dalle/min_dalle/min_dalle_torch.py in detokenize_torch(image_tokens) 105 print("detokenizing image") 106 model_path = './pretrained/vqgan' --> 107 params = load_vqgan_torch_params(model_path) 108 detokenizer = VQGanDetokenizer() 109 detokenizer.load_state_dict(params)

/content/min-dalle/min_dalle/load_params.py in load_vqgan_torch_params(path) 8 9 def load_vqgan_torch_params(path: str) -> Dict[str, torch.Tensor]: ---> 10 with open(os.path.join(path, 'flax_model.msgpack'), "rb") as f: 11 params: Dict[str, numpy.ndarray] = serialization.msgpack_restore(f.read()) 12

FileNotFoundError: [Errno 2] No such file or directory: './pretrained/vqgan/flax_model.msgpack'

.pretrained/vqgan/flax_model.msgpack does appear in the filetree

"watch -n 1 nvidia-smi" show I'm on a p100, if that helps.

Gabrielmtn commented 2 years ago

So, I'm trying to replace line 4 with wget https://huggingface.co/dalle-mini/vqgan_imagenet_f16_16384/resolve/main/flax_model.msgpack -P ./pretrained/vqgan/ but running into the same issue in Colab.

Gabrielmtn commented 2 years ago

Updating the huggingface file might do the trick as noted in https://github.com/kuprel/min-dalle/issues/1

spupe commented 2 years ago

Updating the file unfortunately did not work for me.

scottire commented 2 years ago

In Colab, everything is saved under /content/ so the path should be /content/pretrained/vqgan/flax_model.msgpack.

kuprel commented 2 years ago

Thanks for pointing this out. The problem was that the vqgan repository was being cloned to the wrong directory. The updated colab should work now