Skip to content

Is the bug of Skip download feature? #1179

@Kaihua1203

Description

@Kaihua1203

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'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions