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

Jupyter Notebook with Preprocess error #53

Open
coldcanuk opened this issue Mar 16, 2022 · 7 comments
Open

Jupyter Notebook with Preprocess error #53

coldcanuk opened this issue Mar 16, 2022 · 7 comments

Comments

@coldcanuk
Copy link

Hello,
A long while back I cloned the Dall-E repo and watched the penguin appear -> yay! :)
So now I did it again, I have a new GPU so why not. Figured I'd run the default CPU first and then flip to CUDA.
This time I got unanticipated errors. (I originally had a path problem caused by two versions of python installed, uninstalled the old one, pip install numpy and torch and good to go) I've attached multiple screenshots to help provide greater context. I feel like this is still somehow related to my original path issue.. or possibly i'm missing a site-package that I can't think of....

Thank you for your time and assistance.

# Do not call functions when jit is used
That's thrown multiple times at the last run and finishes with the below as a finale
`
C:\Python310\lib\site-packages\torch\nn\modules\upsampling.py in forward(self, input)
152 def forward(self, input: Tensor) -> Tensor:
153 return F.interpolate(input, self.size, self.scale_factor, self.mode, self.align_corners,
--> 154 recompute_scale_factor=self.recompute_scale_factor)
155
156 def extra_repr(self) -> str:

C:\Python310\lib\site-packages\torch\nn\modules\module.py in getattr(self, name)
1183 if name in modules:
1184 return modules[name]
-> 1185 raise AttributeError("'{}' object has no attribute '{}'".format(
1186 type(self).name, name))
1187

AttributeError: 'Upsample' object has no attribute 'recompute_scale_factor'
`

Screenshot 2022-03-16 080610
Screenshot 2022-03-16 080652
Screenshot 2022-03-16 080716
Screenshot 2022-03-16 080743
Screenshot 2022-03-16 080807
Screenshot 2022-03-16 081012

@viai957
Copy link

viai957 commented Apr 2, 2022

'Upsample' object has no attribute 'recompute_scale_factor'
it's possible newer versions of PyTorch have additional argument requirements on certain modules like the Upsample one you show is causing issues. The current master is passing CI on Pytorch <= 1.10.0, so I would constrain your environment to official releases of the torch for the safest results, i.e. selecting one of the options from https://pytorch.org/get-started/locally/

@tobiaswuerth
Copy link

Hi, I experience the same issue:

pip install DALL-E
Requirement already satisfied: DALL-E in c:\program files\python39\lib\site-packages (0.1)
Requirement already satisfied: Pillow in c:\program files\python39\lib\site-packages (from DALL-E) (9.1.0)
Collecting torchvision
Using cached torchvision-0.12.0-cp39-cp39-win_amd64.whl (1.0 MB)
Requirement already satisfied: pytest in c:\program files\python39\lib\site-packages (from DALL-E) (7.1.1)
Requirement already satisfied: torch in c:\program files\python39\lib\site-packages (from DALL-E) (1.9.1)
Requirement already satisfied: numpy in c:\program files\python39\lib\site-packages (from DALL-E) (1.20.3)
Requirement already satisfied: mypy in c:\program files\python39\lib\site-packages (from DALL-E) (0.942)
Requirement already satisfied: blobfile in c:\program files\python39\lib\site-packages (from DALL-E) (1.2.8)
Requirement already satisfied: requests in c:\program files\python39\lib\site-packages (from DALL-E) (2.27.1)
Requirement already satisfied: xmltodict~=0.12.0 in c:\program files\python39\lib\site-packages (from blobfile->DALL-E) (0.12.0)
Requirement already satisfied: pycryptodomex~=3.8 in c:\program files\python39\lib\site-packages (from blobfile->DALL-E) (3.14.1)
Requirement already satisfied: urllib3~=1.25 in c:\program files\python39\lib\site-packages (from blobfile->DALL-E) (1.26.9)
Requirement already satisfied: filelock~=3.0 in c:\program files\python39\lib\site-packages (from blobfile->DALL-E) (3.6.0)
Requirement already satisfied: mypy-extensions>=0.4.3 in c:\program files\python39\lib\site-packages (from mypy->DALL-E) (0.4.3)
Requirement already satisfied: typing-extensions>=3.10 in c:\program files\python39\lib\site-packages (from mypy->DALL-E) (4.1.1)
Requirement already satisfied: tomli>=1.1.0 in c:\program files\python39\lib\site-packages (from mypy->DALL-E) (2.0.1)
Requirement already satisfied: packaging in c:\users\tobia\appdata\roaming\python\python39\site-packages (from pytest->DALL-E) (21.3)
Requirement already satisfied: py>=1.8.2 in c:\program files\python39\lib\site-packages (from pytest->DALL-E) (1.11.0)
Requirement already satisfied: colorama in c:\users\tobia\appdata\roaming\python\python39\site-packages (from pytest->DALL-E) (0.4.4)
Requirement already satisfied: atomicwrites>=1.0 in c:\program files\python39\lib\site-packages (from pytest->DALL-E) (1.4.0)
Requirement already satisfied: pluggy<2.0,>=0.12 in c:\program files\python39\lib\site-packages (from pytest->DALL-E) (1.0.0)
Requirement already satisfied: attrs>=19.2.0 in c:\program files\python39\lib\site-packages (from pytest->DALL-E) (21.4.0)
Requirement already satisfied: iniconfig in c:\program files\python39\lib\site-packages (from pytest->DALL-E) (1.1.1)
Requirement already satisfied: charset-normalizer~=2.0.0 in c:\program files\python39\lib\site-packages (from requests->DALL-E) (2.0.12)
Requirement already satisfied: idna<4,>=2.5 in c:\program files\python39\lib\site-packages (from requests->DALL-E) (3.3)
Requirement already satisfied: certifi>=2017.4.17 in c:\program files\python39\lib\site-packages (from requests->DALL-E) (2021.10.8)
Collecting torch
Using cached torch-1.11.0-cp39-cp39-win_amd64.whl (157.9 MB)
Requirement already satisfied: pyparsing!=3.0.5,>=2.0.2 in c:\users\tobia\appdata\roaming\python\python39\site-packages (from packaging->pytest->DALL-E) (3.0.7)
Installing collected packages: torch, torchvision
Attempting uninstall: torch
Found existing installation: torch 1.9.1
Uninstalling torch-1.9.1:
Successfully uninstalled torch-1.9.1
Successfully installed torch-1.11.0 torchvision-0.12.0

Versions:

pip --version
pip 22.0.4 from C:\Program Files\Python39\lib\site-packages\pip (python 3.9)
py --version
Python 3.9.12

As yo can see in the last part of the first output, I tried installing torch <=1.10.0 (1.9.1) manually first before installing DALL-E, but this got automatically uninstalled and replaced with the latest version of torch (1.11.0). So, how should I go about this?

Thanks!

@mooooooood
Copy link

mooooooood commented Apr 6, 2022 via email

@tobiaswuerth
Copy link

tobiaswuerth commented Apr 6, 2022

Hi @mooooooood
Thanks a lot! This did indeed solve the issue for me.
I did the following:

pip install DALL-E
pip uninstall torch
pip install torch==1.10.0+cpu torchvision==0.11.0+cpu torchaudio==0.10.0 -f https://download.pytorch.org/whl/torch_stable.html

The last command I got from the site https://pytorch.org/get-started/previous-versions/ .
Before I used a command like 'pip install torch==1.9.3' trying different versions - but this is not sufficient as it stands. Use the command above or adjust it to your needs (i.e. if you use cuda etc.)

@mooooooood
Copy link

mooooooood commented Apr 10, 2022 via email

@KIMLIcrea
Copy link

I have the same issue.
I followed the recommendations, install / uninstall torch.
Could this be a graphics card problem my graphics card is "Intel UHD Graphics 630 1536 MB"

@digitalShaman
Copy link

The error
'Upsample' object has no attribute 'recompute_scale_factor'

is related to a change in the torch Upscale class from 1.10 to 1.11.

It appears that 'old' Upscale objects are saved within the model after this line of code:
model = load_model("https://cdn.openai.com/dall-e/decoder.pkl", 'cuda')
i used the following code immediatly after the load_model call to patch this:

# Patch for torch 1.11 and higher: replace the old Upsample object by the new version
# that exposes recompute_scale_factor
_ = model.blocks.group_1.upsample
model.blocks.group_1.upsample = torch.nn.Upsample(scale_factor = _.scale_factor, mode= _.mode)
_ = model.blocks.group_2.upsample
model.blocks.group_2.upsample = torch.nn.Upsample(scale_factor = _.scale_factor, mode= _.mode)
_ = model.blocks.group_3.upsample
model.blocks.group_3.upsample = torch.nn.Upsample(scale_factor = _.scale_factor, mode= _.mode)

and it's running fine with torch 1.12.1!

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

6 participants