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

Method 'forward' is not defined #67

Closed
Binbose opened this issue Mar 6, 2021 · 10 comments
Closed

Method 'forward' is not defined #67

Binbose opened this issue Mar 6, 2021 · 10 comments

Comments

@Binbose
Copy link

Binbose commented Mar 6, 2021

I installed the module via

$ pip install deep-daze

and just tried the provided example with

$ imagine "a house in the forest"

but after it loaded something for a few minutes (the first time I run the command) it throws this error

Traceback (most recent call last):
  File "/home/luca/anaconda3/bin/imagine", line 5, in <module>
    from deep_daze.cli import main
  File "/home/luca/anaconda3/lib/python3.7/site-packages/deep_daze/__init__.py", line 1, in <module>
    from deep_daze.deep_daze import DeepDaze, Imagine
  File "/home/luca/anaconda3/lib/python3.7/site-packages/deep_daze/deep_daze.py", line 39, in <module>
    perceptor, normalize_image = load()
  File "/home/luca/anaconda3/lib/python3.7/site-packages/deep_daze/clip.py", line 192, in load
    model.apply(patch_device)
  File "/home/luca/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 473, in apply
    module.apply(fn)
  File "/home/luca/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 473, in apply
    module.apply(fn)
  File "/home/luca/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 473, in apply
    module.apply(fn)
  [Previous line repeated 3 more times]
  File "/home/luca/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 474, in apply
    fn(self)
  File "/home/luca/anaconda3/lib/python3.7/site-packages/deep_daze/clip.py", line 183, in patch_device
    graphs = [module.graph] if hasattr(module, "graph") else []
  File "/home/luca/anaconda3/lib/python3.7/site-packages/torch/jit/_script.py", line 449, in graph
    return self._c._get_method("forward").graph
RuntimeError: Method 'forward' is not defined.

My system is:

Ubuntu 18.04.4 LTS
GeForce RTX 2070
pytorch 1.7.1
python version 3.7.1

@Binbose Binbose changed the title Method 'forward' si not defined Method 'forward' is not defined Mar 6, 2021
@Ryboii
Copy link

Ryboii commented Mar 7, 2021

Did you try the command from the Anaconda Prompt?

@Binbose
Copy link
Author

Binbose commented Mar 7, 2021

I tried it from the Ubuntu terminal

@Jeffrey0Liao
Copy link

Same problem.

Environment:
Windows 10
GeForce GTX1060 6G
pytorch 1.8.0+cu111
python 3.7.0

@EPA1257
Copy link

EPA1257 commented Mar 11, 2021

I'm also having this issue. Windows 10, RTX 2060, using Torch 1.8.0 with CUDA 11.1 support, and Python 3.9.2.

@lucidrains
Copy link
Owner

it turns out the released OpenAI code has some issues with the JIT version openai/CLIP#49 I've submitted a new issue asking for them to make CLIP pip-installable, and I'll fix it so it uses the non-JIT version instead once they do openai/CLIP#60

@aicrumb
Copy link

aicrumb commented Mar 11, 2021

I found the same problem in google colab, but it's fixed by just restarting and running all, I don't know if that helps at all

@bytehut bytehut mentioned this issue Mar 12, 2021
@constantupgrade
Copy link

So does this mean it won't work until the package is pip installable? is there any way around it until that happens?

@lucidrains
Copy link
Owner

@constantupgrade I decided to just copy over all of their code to fix this issue 9435bcb I'll clean things up once they pick up the ball on their end

@lucidrains
Copy link
Owner

@constantupgrade let me know if 0.7.1 works for you!

@constantupgrade
Copy link

Yep, using the updated files worked for me. Thanks for being so responsive and quick to solving these issues!

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

7 participants