modelscope / modelscope/DiffSynth-Studio
ModuleNotFoundError when importing diffsynth.pipelines.qwen_image - Circular Import Issue
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 13.1k
- Forks
- 1.3k
- Avg merge
- 13h 12m
- Merged PRs (30d)
- 45
Description
I'm trying to train a Qwen-Image LoRA using the provided training scripts, but encountering a module import error
when running the training command.
Environment:
- OS: Windows 11
- Python: 3.11
- DiffSynth-Studio: Latest from main branch
- Installation method: pip install -e .
Steps to Reproduce:
- Clone the repository: git clone https://github.com/modelscope/DiffSynth-Studio.git
- Install the package: cd DiffSynth-Studio && pip install -e .
- Run the training script: accelerate launch examples/qwen_image/model_training/train.py
Error Traceback:
Traceback (most recent call last):
File "E:\dif\DiffSynth-Studio\examples\qwen_image\model_training\train.py", line 2, in
from diffsynth.pipelines.qwen_image import QwenImagePipeline, ModelConfig
File "E:\dif\DiffSynth-Studio\diffsynth_init_.py", line 2, in
from .models import *
File "E:\dif\DiffSynth-Studio\diffsynth\models_init_.py", line 1, in
from .model_manager import *
File "E:\dif\DiffSynth-Studio\diffsynth\models\model_manager.py", line 4, in
from .downloader import download_models, download_customized_models, Preset_model_id, Preset_model_website
File "E:\dif\DiffSynth-Studio\diffsynth\models\downloader.py", line 6, in
from ..configs.model_config import preset_models_on_huggingface, preset_models_on_modelscope, Preset_model_id
File "E:\dif\DiffSynth-Studio\diffsynth\configs\model_config.py", line 76, in
from ..models.qwen_image_text_encoder import QwenImageTextEncoder
[Error continues with circular import chain]
Analysis:
This appears to be a circular import issue where:
- diffsynth.init.py imports from models
- models.model_manager imports from downloader
- downloader imports from configs.model_config
- model_config tries to import back to models.qwen_image_text_encoder
This creates a circular dependency that prevents the module from loading properly.
Questions:
- Is the current training setup supposed to work out of the box?
- Are there any missing dependencies or installation steps?
- Could this be related to the recent Qwen-Image FP8 updates mentioned in recent commits?
- Should the imports in model_config.py be moved or made conditional to avoid circular dependencies?
Attempted Solutions:
- Reinstalled with pip install -e .
- Tried different Python versions
- Ensured all dependencies are installed
- Verified the repository is up to date
Any guidance on resolving this import issue would be greatly appreciated. Thank you!
Additional Context:
I'm specifically trying to train a custom LoRA on a personal dataset following the examples provided in
examples/qwen_image/model_training/. The goal is to fine-tune Qwen-Image for specific image generation tasks.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running accelerate launch examples/qwen_image/model_training/train.py and follow the import chain through diffsynth/__init__.py, diffsynth/models/model_manager.py, diffsynth/models/downloader.py, and diffsynth/configs/model_config.py. Check how model_config.py imports QwenImageTextEncoder and identify the dependency cycle. Done means the Qwen-Image training entry point imports without the reported circular-import error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100