sd-forge-deforum icon indicating copy to clipboard operation
sd-forge-deforum copied to clipboard

[Bug]: ❌ Wan generation error: cannot import name 'models' from partially initialized module 'deforum_helpers.wan'

Open tr4shyyy opened this issue 9 months ago • 14 comments

What happened and why was it ungood?

i can generate the bunny video with the normal generate button, but when I try to use the "wan" button, this is the result:

❌ Wan generation error: cannot import name 'models' from partially initialized module 'deforum_helpers.wan' (most likely due to a circular import) (S:\stable-diffusion-webui-forge\extensions\sd-forge-deforum\scripts\deforum_helpers\wan_init_.py) Traceback (most recent call last): File "S:\stable-diffusion-webui-forge\extensions\sd-forge-deforum\scripts\deforum_helpers\ui_elements.py", line 420, in wan_generate_video from .wan.wan_simple_integration import WanSimpleIntegration File "S:\stable-diffusion-webui-forge\extensions\sd-forge-deforum\scripts\deforum_helpers\wan_init_.py", line 35, in from . import models ImportError: cannot import name 'models' from partially initialized module 'deforum_helpers.wan' (most likely due to a circular import) (S:\stable-diffusion-webui-forge\extensions\sd-forge-deforum\scripts\deforum_helpers\wan_init_.py) ✅ Wan generation completed: ❌ Wan generation error: cannot import name 'models' from partially initialized module 'deforum_helpe...

I should mention that i also get this error trying to validate that Flash Attention is avail. which it is.

tr4shyyy avatar Jun 01 '25 08:06 tr4shyyy

I am also getting this error. Fresh install with newest default settings file. Any ideas on a fix yet?

merberg-ai avatar Jun 15 '25 14:06 merberg-ai

Is this project abandoned? Someone tell me the purpose of wan in deforum? is there any articulation, or what we would get in wan its self, becuase they're two different environments, i can get wan up in less then 10 minutes, deforum about 10 minutes with a custom manifest, but to answer your issue:

There's no model loader download, you'll need to do it manually, and be advised if you have a underpowered pc aboid the 14b models for now, they're powerful but taxing.

MyCroniesSoft avatar Jul 03 '25 14:07 MyCroniesSoft

Is this project abandoned? Someone tell me the purpose of wan in deforum? is there any articulation, or what we would get in wan its self, becuase they're two different environments, i can get wan up in less then 10 minutes, deforum about 10 minutes with a custom manifest, but to answer your issue:

There's no model loader download, you'll need to do it manually, and be advised if you have a underpowered pc aboid the 14b models for now, they're powerful but taxing.

Unfortunately it does seem to be abandoned. The extension has be broken for me since the update adding the wan video elements. I followed the install instructions here on a fresh copy of forge. I get the import error above also, now matter what. Hopefully the dev can shed some light soon.

merberg-ai avatar Jul 04 '25 11:07 merberg-ai

hmm, the problem with forge, and automatic 1111 is its trying to be everything, this is the biggest issue with github repos that get abandoned for any reason, its hard to unengineer the project tripping it down, where there are files dependent on python 3.8 and up, and then the pythorch cuda environment being 11.8 and up, all these requirements are easy to break, and another reason why some abandon the projects.

So im trying to reingineer deforum and wan as a completely seperate pipeline, that isnt in forge but uses all forges optimisations, this is critical becuase if you wish to run it in command line, or gradio its just a press of the button, not an entire ui interface.

So its alot of work, but it would keep the entire projects in ai space seperate, as theres massive issues merging everything as one, you can access the parts and make changes, and keep updates from the developer, and if its abondoned its isolated not embedded in a one system project like automatic 1111

MyCroniesSoft avatar Jul 19 '25 19:07 MyCroniesSoft

so no fix yet.... bummer

LIQUIDMIND111 avatar Sep 25 '25 11:09 LIQUIDMIND111

Manually Edit the Code (Advanced):

Navigate to the file mentioned in the traceback: E:\webui_forge_cu121_torch231\webui\extensions\sd-forge-deforum\scripts\deforum_helpers\wan_init_.py

Open it with a code editor.

Look at line 35, which contains from . import models. This is the direct cause of the error.

You might be able to temporarily fix this by moving the import statement to within a function that actually uses it, instead of having it at the top of the file. However, without knowing the full structure of the code, this can be tricky and could break other parts of the extension. This is not recommended unless you are comfortable with Python and know how to reverse the changes.

Use a Different DEFORUM Fork: Some users have found success by using a different version or "fork" of the DEFORUM extension that is specifically maintained for Forge. You can look on the Forge GitHub or community forums to see if other users have a version that works for them.

LIQUIDMIND111 avatar Sep 25 '25 11:09 LIQUIDMIND111

Sorry, wasn't working on the project for some time and only just now realized that it collected stars. Was vibecoded into a corner somewhat, but the AI is much smarter now, so there are totally new and better corners to vibecode into. I intend to provide fixes and neat everything back up during the next few days...

Tok avatar Oct 15 '25 18:10 Tok

so is this project dead? it's been broken for me since wan stuff was added. looks like you committed a fix, the hotfix branch is broken also. any ideas on getting this working?

merberg-ai avatar Oct 17 '25 00:10 merberg-ai

Project is currently revived, but not properly working yet. dev and hotfix branches are both still work in progress with a lot of technical changes that don't properly run yet. I'll update this issue as soon as I consider it to run more stable than main, hopefully in a few days.

Tok avatar Oct 17 '25 15:10 Tok

✅ Fixed in PR #18

This Wan import error only existed in the broken refactored code structure on the hotfix/github-issues-12-15 branch.

Root cause: The refactored code tried to use an external_repos path structure that doesn't exist in the main branch.

Resolution: PR #18 abandoned the broken refactoring (438 files changed) and applied only the essential bug fixes to main's working file structure.

Current status: Wan functionality works correctly in main branch using the original file structure at scripts/deforum_helpers/wan/.

Related:

  • The failed refactor has been tagged as failed-refactor-attempt for reference
  • Clean fixes merged in PR #18

Merged in: https://github.com/Tok/sd-forge-deforum/pull/18

Tok avatar Oct 17 '25 19:10 Tok

Closing as fixed - issue only existed in abandoned refactored code.

Tok avatar Oct 17 '25 19:10 Tok

Still working on it (and upgrading to Wan 2.2)...

Tok avatar Oct 18 '25 01:10 Tok

Still working on it (and upgrading to Wan 2.2)...

HELLO, have a great halloween, here is a mix of TOK-DEFORUM vs WAN 2.2 on comfy

https://youtu.be/77JQCgF4HqE

@Tok ENJOY!!!

LIQUIDMIND111 avatar Oct 31 '25 00:10 LIQUIDMIND111

Thanks @LIQUIDMIND111 real spooky

btw... dev branch is hundreds of commits ahead and will introduce many new features, but it's still quite mistuned and not yet stable enough. I'm expecting to need another week or two to finish it up

Tok avatar Nov 01 '25 14:11 Tok