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 #43

Closed
Jeffrey0Liao opened this issue Mar 10, 2021 · 4 comments
Closed

Method 'forward' is not defined #43

Jeffrey0Liao opened this issue Mar 10, 2021 · 4 comments

Comments

@Jeffrey0Liao
Copy link

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):

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-2-32b6fbd8f807> in <module>()
----> 1 from deep_daze import Imagine
     2 
     3 imagine = Imagine(
     4     text = 'cosmic love and attention',
     5     num_layers = 24,

E:\Anaconda\lib\site-packages\deep_daze\__init__.py in <module>()
----> 1 from deep_daze.deep_daze import DeepDaze, Imagine

E:\Anaconda\lib\site-packages\deep_daze\deep_daze.py in <module>()
    37 signal.signal(signal.SIGINT, signal_handling)
    38 
---> 39 perceptor, normalize_image = load()
    40 
    41 # Helpers

E:\Anaconda\lib\site-packages\deep_daze\clip.py in load()
   190                     node.copyAttributes(device_node)
   191 
--> 192     model.apply(patch_device)
   193     patch_device(model.encode_image)
   194     patch_device(model.encode_text)

E:\Anaconda\lib\site-packages\torch\nn\modules\module.py in apply(self, fn)
   471         """
   472         for module in self.children():
--> 473             module.apply(fn)
   474         fn(self)
   475         return self

E:\Anaconda\lib\site-packages\torch\nn\modules\module.py in apply(self, fn)
   471         """
   472         for module in self.children():
--> 473             module.apply(fn)
   474         fn(self)
   475         return self

E:\Anaconda\lib\site-packages\torch\nn\modules\module.py in apply(self, fn)
   471         """
   472         for module in self.children():
--> 473             module.apply(fn)
   474         fn(self)
   475         return self

E:\Anaconda\lib\site-packages\torch\nn\modules\module.py in apply(self, fn)
   471         """
   472         for module in self.children():
--> 473             module.apply(fn)
   474         fn(self)
   475         return self

E:\Anaconda\lib\site-packages\torch\nn\modules\module.py in apply(self, fn)
   471         """
   472         for module in self.children():
--> 473             module.apply(fn)
   474         fn(self)
   475         return self

E:\Anaconda\lib\site-packages\torch\nn\modules\module.py in apply(self, fn)
   471         """
   472         for module in self.children():
--> 473             module.apply(fn)
   474         fn(self)
   475         return self

E:\Anaconda\lib\site-packages\torch\nn\modules\module.py in apply(self, fn)
   472         for module in self.children():
   473             module.apply(fn)
--> 474         fn(self)
   475         return self
   476 

E:\Anaconda\lib\site-packages\deep_daze\clip.py in patch_device(module)
   181 
   182     def patch_device(module):
--> 183         graphs = [module.graph] if hasattr(module, "graph") else []
   184         if hasattr(module, "forward1"):
   185             graphs.append(module.forward1.graph)

E:\Anaconda\lib\site-packages\torch\jit\_script.py in graph(self)
   447             ``forward`` method. See :ref:`interpreting-graphs` for details.
   448             """
--> 449             return self._c._get_method("forward").graph
   450 
   451         @property

RuntimeError: Method 'forward' is not defined.

My system is:
Windows 10
GeForce GTX1060 6G
pytorch 1.8.0+cu111
python 3.7.0

@mendel3
Copy link

mendel3 commented Mar 12, 2021

+1, am also getting this same error RuntimeError: Method 'forward' is not defined. with the latest version of big-sleep, torch 1.8.0+cu111, Python 3.8.6, Windows 10 v2004, CUDA 11.1, and a 1080ti

@afiaka87
Copy link

afiaka87 commented Mar 12, 2021

Ugh yikes, this one is hairy.

#44

I'm ironing out a bunch of new bugs on this pull request. It works but is too janky to get merged. I need to keep looking into it, but i'm somewhat distracted with other things lately.

anyway, if you're desperate you should be able to
pip install "git+https://github.com/afiaka87/big-sleep@fix_forward"

Still needs work, but you can get it working by pulling the vocab file into the directory you're using the CLI tool from.

If you wanna just download it real quick -
wget https://github.com/openai/CLIP/raw/main/clip/bpe_simple_vocab_16e6.txt.gz

@lucidrains
Copy link
Owner

@Jeffrey0Liao Hi, I decided to just copy over OAI's code to fix this issue, since they are usually not as responsive 460bcbe

@lucidrains
Copy link
Owner

please give 0.7.1 a try!

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