modelscope / modelscope/DiffSynth-Studio
Is the bug of Skip download feature?
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 13.1k
- Forks
- 1.3k
- Avg merge
- 13h 12m
- Merged PRs (30d)
- 45
Description
Hi, thanks for your great contributions to the community! I’ve been using DiffSynth for a long time.
After upgrading to v2.0.0, I ran into an issue during inference and I suspect there may be a bug in config.py?
I have downloaded the model weights locally and tried to load the model like this:
pipe = FluxImagePipeline.from_pretrained(
torch_dtype=torch.bfloat16,
device="cuda",
model_configs=[
ModelConfig(model_id="black-forest-labs/FLUX.1-Kontext-dev", origin_file_pattern="flux1-kontext-dev.safetensors", local_model_path=args.model_path, skip_download=True),
ModelConfig(model_id="black-forest-labs/FLUX.1-Kontext-dev", origin_file_pattern="text_encoder/model.safetensors", local_model_path=args.model_path, skip_download=True),
ModelConfig(model_id="black-forest-labs/FLUX.1-Kontext-dev", origin_file_pattern="text_encoder_2/model*.safetensors", local_model_path=args.model_path, skip_download=True),
ModelConfig(model_id="black-forest-labs/FLUX.1-Kontext-dev", origin_file_pattern="ae.safetensors", local_model_path=args.model_path, skip_download=True),
],
)
However, I got an error because self.path doesn’t seem to be passed correctly (it looks like the local path is not being applied as expected when skip_download=True). Could you please take a look, or let me know if I’m missing something? If this is indeed a bug, I’d be happy to submit a PR to fix it :).
The traceback was showed below:
Loading models from: null
Traceback (most recent call last):
File "xxx/FLUX.1-Kontext-dev-inference.py", line 66, in <module>
pipe = FluxImagePipeline.from_pretrained(
File "xxx/diffsynth/pipelines/flux_image.py", line 130, in from_pretrained
model_pool = pipe.download_and_load_models(model_configs, vram_limit)
File "xxx/diffsynth/diffusion/base_pipeline.py", line 289, in download_and_load_models
model_pool.auto_load_model(
File "xxx/diffsynth/models/model_loader.py", line 66, in auto_load_model
model_hash = hash_model_file(path)
File "xxx/diffsynth/core/loader/file.py", line 118, in hash_model_file
keys_dict = load_keys_dict(path)
File "xxx/diffsynth/core/loader/file.py", line 71, in load_keys_dict
if file_path.endswith(".safetensors"):
AttributeError: 'NoneType' object has no attribute 'endswith'
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 in diffsynth/core/loader/config.py and trace how ModelConfig.local_model_path and skip_download are handled into diffsynth/diffusion/base_pipeline.py and diffsynth/models/model_loader.py. Reproduce the provided FluxImagePipeline configuration and inspect the path passed to diffsynth/core/loader/file.py; done means local model files are used with skip_download=True without a None path reaching hash_model_file.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100