dribnet / pixray

neural image generation
Other
402 stars 53 forks source link

Colabs throw error 'MyRandomPerspective' object has no attribute 'resample' #48

Closed richpav closed 2 years ago

richpav commented 2 years ago

I tried Start_Here.ipynb and Swap_Model.ipynb

Same error:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-3-d6266773d3a4> in <module>()
     12 settings = pixray.apply_settings()
     13 pixray.do_init(settings)
---> 14 pixray.do_run(settings)

11 frames
/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py in __getattr__(self, name)
   1129                 return modules[name]
   1130         raise AttributeError("'{}' object has no attribute '{}'".format(
-> 1131             type(self).__name__, name))
   1132 
   1133     def __setattr__(self, name: str, value: Union[Tensor, 'Module']) -> None:

AttributeError: 'MyRandomPerspective' object has no attribute 'resample'
dribnet commented 2 years ago

This is due to a dependency change. Try the new Swap_Model notebook which now lives here.

richpav commented 2 years ago

Here's the error I get with Pixray Swap Model from where you said.


Using seed: 11543842745187050271
Working with z of shape (1, 256, 16, 16) = 65536 dimensions.
Downloading: "https://download.pytorch.org/models/vgg16-397923af.pth" to models/checkpoints/vgg16-397923af.pth
100%
528M/528M [00:03<00:00, 177MB/s]

Downloading vgg_lpips model from https://heibox.uni-heidelberg.de/f/607503859c864bc1b30b/?dl=1 to taming/modules/autoencoder/lpips/vgg.pth
8.19kB [00:00, 2.76MB/s]                   
loaded pretrained LPIPS loss from taming/modules/autoencoder/lpips/vgg.pth
VQLPIPSWithDiscriminator running with hinge loss.
Restored from models/vqgan_imagenet_f16_16384.ckpt
100%|███████████████████████████████████████| 402M/402M [00:06<00:00, 66.8MiB/s]
100%|████████████████████████████████████████| 338M/338M [00:01<00:00, 177MiB/s]
100%|████████████████████████████████████████| 335M/335M [00:02<00:00, 175MiB/s]
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-4-d6266773d3a4> in <module>()
     11 
     12 settings = pixray.apply_settings()
---> 13 pixray.do_init(settings)
     14 pixray.do_run(settings)

5 frames
/usr/local/lib/python3.7/dist-packages/PIL/TiffImagePlugin.py in ImageFileDirectory_v2()
    685                 (TiffTags.FLOAT, "f", "float"),
    686                 (TiffTags.DOUBLE, "d", "double"),
--> 687                 (TiffTags.IFD, "L", "long"),
    688             ],
    689         )

AttributeError: module 'PIL.TiffTags' has no attribute 'IFD'```
dribnet commented 2 years ago

i thin that might just be restarting the runtime after running setup

richpav commented 2 years ago

I just went down the page clicking every run button without changing any settings. Throws an error. I'm using the $10/month Google account.

dribnet commented 2 years ago

Right. But did you restart the notebook when it said to restart the notebook? That can't be done by the button and has to be done via the menu. You don't have to run setup twice - but you do have to restart the runtime after running setup so that the installations take effect in the runtime.

richpav commented 2 years ago

No, because I'm a goddamn idiot.

Thank you. And sorry.

dribnet commented 2 years ago

Not your fault at all - this is a very common problem! the colab does not provide a good way to signal that the runtime needs to be restarted which is unfortunate.

richpav commented 2 years ago

You could put a message in H1 after the cell that throws an error to remind people to restart the notebook. I usually don't pay attention to what messages come out of the setup.