Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inpaint notebook error #22

Open
taciturnaxolotl opened this issue Feb 11, 2022 · 4 comments
Open

inpaint notebook error #22

taciturnaxolotl opened this issue Feb 11, 2022 · 4 comments

Comments

@taciturnaxolotl
Copy link

The inpaint notebook will throw an error when you try to run the setup where you import the grass image. I believe this is caused by the file not being included with the notebook.

@YouRik
Copy link

YouRik commented Feb 12, 2022

The grass image is included, however I personally get the following error in the code labeled
# Create upsampler model.

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
/Users/jurik/Documents/ML/glide-text2im/notebooks/inpaint.ipynb Cell 5' in <module>
      [9](vscode-notebook-cell:/Users/jurik/Documents/ML/glide-text2im/notebooks/inpaint.ipynb#ch0000004?line=8)[     model_up.convert_to_fp16()
     ]()[10](vscode-notebook-cell:/Users/jurik/Documents/ML/glide-text2im/notebooks/inpaint.ipynb#ch0000004?line=9)[ model_up.to(device)
---> ]()[11](vscode-notebook-cell:/Users/jurik/Documents/ML/glide-text2im/notebooks/inpaint.ipynb#ch0000004?line=10)[ model_up.load_state_dict(load_checkpoint('upsample-inpaint', device))
     ]()[12](vscode-notebook-cell:/Users/jurik/Documents/ML/glide-text2im/notebooks/inpaint.ipynb#ch0000004?line=11)[ print('total upsampler parameters', sum(x.numel() for x in model_up.parameters()))

File ~/.local/share/virtualenvs/glide-text2im-NBWH3vqt/lib/python3.9/site-packages/glide_text2im/download.py:71, in load_checkpoint(checkpoint_name, device, progress, cache_dir, chunk_size)
     ]()[65](file:///~/.local/share/virtualenvs/glide-text2im-NBWH3vqt/lib/python3.9/site-packages/glide_text2im/download.py?line=64)[     raise ValueError(
     ]()[66](file:///~/.local/share/virtualenvs/glide-text2im-NBWH3vqt/lib/python3.9/site-packages/glide_text2im/download.py?line=65)[         f"Unknown checkpoint name {checkpoint_name}. Known names are: {MODEL_PATHS.keys()}."
     ]()[67](file:///~/.local/share/virtualenvs/glide-text2im-NBWH3vqt/lib/python3.9/site-packages/glide_text2im/download.py?line=66)[     )
     ]()[68](file:///~/.local/share/virtualenvs/glide-text2im-NBWH3vqt/lib/python3.9/site-packages/glide_text2im/download.py?line=67)[ path = fetch_file_cached(
     ]()[69](file:///~/.local/share/virtualenvs/glide-text2im-NBWH3vqt/lib/python3.9/site-packages/glide_text2im/download.py?line=68)[     MODEL_PATHS[checkpoint_name], progress=progress, cache_dir=cache_dir, chunk_size=chunk_size
     ]()[70](file:///~/.local/share/virtualenvs/glide-text2im-NBWH3vqt/lib/python3.9/site-packages/glide_text2im/download.py?line=69)[ )
---> ]()[71](file:///~/.local/share/virtualenvs/glide-text2im-NBWH3vqt/lib/python3.9/site-packages/glide_text2im/download.py?line=70)[ return th.load(path, map_location=device)

File ~/.local/share/virtualenvs/glide-text2im-NBWH3vqt/lib/python3.9/site-packages/torch/serialization.py:600, in load(f, map_location, pickle_module, **pickle_load_args)
    ]()[595](file:///~/.local/share/virtualenvs/glide-text2im-NBWH3vqt/lib/python3.9/site-packages/torch/serialization.py?line=594)[ if _is_zipfile(opened_file):
    ]()[596](file:///~/.local/share/virtualenvs/glide-text2im-NBWH3vqt/lib/python3.9/site-packages/torch/serialization.py?line=595)[     # The zipfile reader is going to advance the current file position.
    ]()[597](file:///~/.local/share/virtualenvs/glide-text2im-NBWH3vqt/lib/python3.9/site-packages/torch/serialization.py?line=596)[     # If we want to actually tail call to torch.jit.load, we need to
    ]()[598](file:///~/.local/share/virtualenvs/glide-text2im-NBWH3vqt/lib/python3.9/site-packages/torch/serialization.py?line=597)[     # reset back to the original position.
    ]()[599](file:///~/.local/share/virtualenvs/glide-text2im-NBWH3vqt/lib/python3.9/site-packages/torch/serialization.py?line=598)[     orig_position = opened_file.tell()
--> ]()[600](file:///~/.local/share/virtualenvs/glide-text2im-NBWH3vqt/lib/python3.9/site-packages/torch/serialization.py?line=599)[     with _open_zipfile_reader(opened_file) as opened_zipfile:
    ]()[601](file:///~/.local/share/virtualenvs/glide-text2im-NBWH3vqt/lib/python3.9/site-packages/torch/serialization.py?line=600)[         if _is_torchscript_zip(opened_zipfile):
    ]()[602](file:///~/.local/share/virtualenvs/glide-text2im-NBWH3vqt/lib/python3.9/site-packages/torch/serialization.py?line=601)[             warnings.warn("'torch.load' received a zip file that looks like a TorchScript archive"
    ]()[603](file:///~/.local/share/virtualenvs/glide-text2im-NBWH3vqt/lib/python3.9/site-packages/torch/serialization.py?line=602)[                           " dispatching to 'torch.jit.load' (call 'torch.jit.load' directly to"
    ]()[604](file:///~/.local/share/virtualenvs/glide-text2im-NBWH3vqt/lib/python3.9/site-packages/torch/serialization.py?line=603)[                           " silence this warning)", UserWarning)

File ~/.local/share/virtualenvs/glide-text2im-NBWH3vqt/lib/python3.9/site-packages/torch/serialization.py:242, in _open_zipfile_reader.__init__(self, name_or_buffer)
    ]()[241](file:///~/.local/share/virtualenvs/glide-text2im-NBWH3vqt/lib/python3.9/site-packages/torch/serialization.py?line=240)[ def __init__(self, name_or_buffer) -> None:
--> ]()[242](file:///~/.local/share/virtualenvs/glide-text2im-NBWH3vqt/lib/python3.9/site-packages/torch/serialization.py?line=241)[     super(_open_zipfile_reader, self).__init__(torch._C.PyTorchFileReader(name_or_buffer))

RuntimeError: PytorchStreamReader failed reading zip archive: failed finding central directory]()

@woctezuma
Copy link

True. The image is here:

https://github.com/openai/glide-text2im/blob/main/notebooks/grass.png

@taciturnaxolotl
Copy link
Author

Here's my error

---------------------------------------------------------------------------

FileNotFoundError                         Traceback (most recent call last)

[<ipython-input-7-24105ecbc38c>](https://localhost:8080/#) in <module>()
      9 
     10 # Source image we are inpainting
---> 11 source_image_256 = read_image('grass.png', size=256)
     12 source_image_64 = read_image('grass.png', size=64)
     13 

1 frames

[/usr/local/lib/python3.7/dist-packages/PIL/Image.py](https://localhost:8080/#) in open(fp, mode)
   2841 
   2842     if filename:
-> 2843         fp = builtins.open(filename, "rb")
   2844         exclusive_fp = True
   2845 

FileNotFoundError: [Errno 2] No such file or directory: 'grass.png'

@sshh12
Copy link

sshh12 commented Apr 25, 2022

You can add the cell:

!wget https://raw.githubusercontent.com/openai/glide-text2im/main/notebooks/grass.png

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants