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

"RuntimeError: Method 'forward' is not defined." #70

Closed
NuclearSurvivor opened this issue Mar 13, 2021 · 10 comments
Closed

"RuntimeError: Method 'forward' is not defined." #70

NuclearSurvivor opened this issue Mar 13, 2021 · 10 comments

Comments

@NuclearSurvivor
Copy link

I've tried to run the imagine command, but this is what I get every time I run the command.

(venv) C:\WINDOWS\system32>imagine "alone in the dark"
Traceback (most recent call last):
File "c:\program files\python38\lib\runpy.py", line 192, in _run_module_as_main
return run_code(code, main_globals, None,
File "c:\program files\python38\lib\runpy.py", line 85, in run_code
exec(code, run_globals)
File "C:\Program Files\Python38\Scripts\imagine.exe_main
.py", line 4, in
File "c:\program files\python38\lib\site-packages\deep_daze_init
.py", line 1, in
from deep_daze.deep_daze import DeepDaze, Imagine
File "c:\program files\python38\lib\site-packages\deep_daze\deep_daze.py", line 39, in
perceptor, normalize_image = load()
File "c:\program files\python38\lib\site-packages\deep_daze\clip.py", line 192, in load
model.apply(patch_device)
File "c:\program files\python38\lib\site-packages\torch\nn\modules\module.py", line 473, in apply
module.apply(fn)
File "c:\program files\python38\lib\site-packages\torch\nn\modules\module.py", line 473, in apply
module.apply(fn)
File "c:\program files\python38\lib\site-packages\torch\nn\modules\module.py", line 473, in apply
module.apply(fn)
[Previous line repeated 3 more times]
File "c:\program files\python38\lib\site-packages\torch\nn\modules\module.py", line 474, in apply
fn(self)
File "c:\program files\python38\lib\site-packages\deep_daze\clip.py", line 183, in patch_device
graphs = [module.graph] if hasattr(module, "graph") else []
File "c:\program files\python38\lib\site-packages\torch\jit_script.py", line 449, in graph
return self._c._get_method("forward").graph
RuntimeError: Method 'forward' is not defined.

I'm new to all of this so it's kind of confusing. Is there any fix for this RuntimeError: Method 'forward' is not defined. ?

@laundmo
Copy link

laundmo commented Mar 13, 2021

i have the same issue, tried on both python 3.8 and 3.9

@jacobmacweb
Copy link

jacobmacweb commented Mar 13, 2021

Was also able to replicate in 3.8.0.

I've seen this which could be of use: https://gitmemory.com/issue/openai/CLIP/49/791421923. Considering deep daze uses JIT directly (https://github.com/lucidrains/deep-daze/blob/main/deep_daze/clip.py#L173) it's not going to be a quick solution.

@NuclearSurvivor
Copy link
Author

NuclearSurvivor commented Mar 13, 2021

Was also able to replicate in 3.8.0.

I've seen this which could be of use: https://gitmemory.com/issue/openai/CLIP/49/791421923. Considering deep daze uses JIT directly (https://github.com/lucidrains/deep-daze/blob/main/deep_daze/clip.py#L173) it's not going to be a quick solution.

I've tried this before but, I tried it again, and nothing worked. This sucks lol.
Edit: I also tried to install and upgrade jit but that didn't work either. Unless I am doing the flag wrong
I tried to run the command: imagine "alone in the dark" --jit=False
Is that correct? Im not good with this stuff im just learning.

@lucidrains
Copy link
Owner

should be fixed in 0.7.1

@NuclearSurvivor
Copy link
Author

should be fixed in 0.7.1

Now im getting this error

Traceback (most recent call last):
File "c:\program files\python38\lib\runpy.py", line 192, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\program files\python38\lib\runpy.py", line 85, in run_code
exec(code, run_globals)
File "C:\Program Files\Python38\Scripts\imagine.exe_main
.py", line 7, in
File "C:\Users\nucle\AppData\Roaming\Python\Python38\site-packages\deep_daze\cli.py", line 111, in main
fire.Fire(train)
File "c:\program files\python38\lib\site-packages\fire\core.py", line 141, in Fire
component_trace = _Fire(component, args, parsed_flag_args, context, name)
File "c:\program files\python38\lib\site-packages\fire\core.py", line 466, in _Fire
component, remaining_args = _CallAndUpdateTrace(
File "c:\program files\python38\lib\site-packages\fire\core.py", line 681, in _CallAndUpdateTrace
component = fn(*varargs, **kwargs)
File "C:\Users\nucle\AppData\Roaming\Python\Python38\site-packages\deep_daze\cli.py", line 73, in train
imagine = Imagine(
File "C:\Users\nucle\AppData\Roaming\Python\Python38\site-packages\deep_daze\deep_daze.py", line 285, in init
self.clip_img_transform = create_clip_img_transform(perceptor.input_resolution.item())
File "c:\program files\python38\lib\site-packages\torch\nn\modules\module.py", line 947, in getattr
raise AttributeError("'{}' object has no attribute '{}'".format(
AttributeError: 'CLIP' object has no attribute 'input_resolution'

@lucidrains
Copy link
Owner

oops, fixed in 0.7.2!

@NuclearSurvivor
Copy link
Author

NuclearSurvivor commented Mar 13, 2021

oops, fixed in 0.7.2!

LMAO it worked thanks for the hard work and fast fix time!

Are there any commands to change where the output files go, could you just do cd "location of where i want"? Or any other like settings that I can change to better suit my computer? If they set lower some settings and I could change those to make it render faster or is it just the imagine command
and is there a way to cancel the render?

Edit: just comprehended the flags on the homepage

@lucidrains
Copy link
Owner

lucidrains commented Mar 13, 2021

@NuclearSurvivor you can call imagine from anywhere and it'll save to the folder where you are currently in

now go surf the imaginations of the machine and make some NFTs or whatever :)

@NuclearSurvivor
Copy link
Author

NuclearSurvivor commented Mar 13, 2021

@NuclearSurvivor you can call imagine from anywhere and it'll save to the folder where you are currently in

now go surf the imaginations of the machine and make some NFTs or whatever :)

bet!
I have a 2080 super and i want to change the thing to this and are these flags? How would I apply these changes?

imagine = Imagine( text=text, num_layers=24, batch_size=16, gradient_accumulate_every=2 )

and is there a way to cancel the render, or do I just have to exit out of the command line?

@lucidrains
Copy link
Owner

@NuclearSurvivor you can control that with the epochs and iterations keyword arguments on the Imagine class

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