lucidrains / deep-daze

Simple command line tool for text to image generation using OpenAI's CLIP and Siren (Implicit neural representation network). Technique was originally created by https://twitter.com/advadnoun
MIT License
4.37k stars 327 forks source link

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

Closed NuclearSurvivor closed 3 years ago

NuclearSurvivor commented 3 years ago

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 commented 3 years ago

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

raclettes commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

should be fixed in 0.7.1

NuclearSurvivor commented 3 years ago

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 commented 3 years ago

oops, fixed in 0.7.2!

NuclearSurvivor commented 3 years ago

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 commented 3 years ago

@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 commented 3 years ago

@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 commented 3 years ago

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