modelscope / modelscope/DiffSynth-Studio

AestheticMetric模型加载问题

Open
#1,454 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
13.1k
Forks
1.3k
Avg merge
13h 12m
Merged PRs (30d)
45

Description

File "/opt/tiger/Cvmm-DiffSynthSFT/custom_tools/metric/ds_aesthetic.py", line 40, in __init__
    self.ds_metric = AestheticMetric.from_pretrained(
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/tiger/Cvmm-DiffSynthSFT/diffsynth/metrics/aesthetic.py", line 25, in from_pretrained
    model_pool = cls.download_and_load_models([model_config], torch_dtype=torch_dtype, device=device, vram_limit=vram_limit)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/tiger/Cvmm-DiffSynthSFT/diffsynth/metrics/base.py", line 21, in download_and_load_models
    model_pool.auto_load_model(
  File "/opt/tiger/Cvmm-DiffSynthSFT/diffsynth/models/model_loader.py", line 72, in auto_load_model
    model = self.load_model_file(config, path, vram_config, vram_limit=vram_limit, state_dict=state_dict)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/tiger/Cvmm-DiffSynthSFT/diffsynth/models/model_loader.py", line 41, in load_model_file
    model = load_model(
            ^^^^^^^^^^^
  File "/opt/tiger/Cvmm-DiffSynthSFT/diffsynth/core/loader/model.py", line 58, in load_model
    model.load_state_dict(state_dict, assign=True)
  File "/home/tiger/.local/lib/python3.11/site-packages/torch/nn/modules/module.py", line 2635, in load_state_dict
    raise RuntimeError(
RuntimeError: Error(s) in loading state_dict for AestheticModel:
        Missing key(s) in state_dict: "vision_model.vision_model.embeddings.class_embedding", "vision_model.vision_model.embeddings.patch_embedding.weight", "vision_model.vision_model.embeddings.position_embedding.weight", "vision_model.vision_model.pre_layrnorm.weight", "vision_model.vision_model.pre_layrnorm.bias", "vision_model.vision_model.encoder.layers.0.self_attn.k_proj.weight", "vision_model.vision_model.encoder.layers.0.self_attn.k_proj.bias", "vision_model.vision_model.encoder.layers.0

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with custom_tools/metric/ds_aesthetic.py and diffsynth/metrics/aesthetic.py, then trace model loading through diffsynth/metrics/base.py, diffsynth/models/model_loader.py, and diffsynth/core/loader/model.py. Compare the AestheticModel configuration with the checkpoint state dict implicated by the traceback. Done means the aesthetic model loads without the reported missing-key errors.

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
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.