Partial download surfaces as "Cannot detect the model type" rather than a download error

Aperta Adatta ai principianti
#1,668 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
1/5
Tempo stimato
1-3 ore
Idoneità per principianti
78/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python

Direzione di ricerca

Inizia in diffsynth/core/loader/config.py, in download_if_necessary, quindi esamina diffsynth/models/model_loader.py:101, dove viene sollevato l’errore fuorviante. Riproduci o analizza il caricamento di un insieme incompleto di shard e confrontalo con un download completato. Il lavoro è completato quando i download interrotti producono un suggerimento utile relativo al download senza modificare il caricamento riuscito.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

A partially-failed download surfaces as Cannot detect the model type, which points at the model registry rather than at the download.

Setup: v2.1.6 at 4dbf980, Linux, 1×H100, pip install -e ., modelscope 1.39.1, downloading from ModelScope.

Running examples/qwen_image/model_inference/Qwen-Image-Distill-Full.py, some shards failed to fetch. The log says so:

2026-09-02 02:02:47,612 | WARNING | modelscope_hub.download | 4 file(s) failed to download
Loading models from: [
    ".../diffusion_pytorch_model-00003-of-00009.safetensors",
    ".../diffusion_pytorch_model-00004-of-00009.safetensors",
    ".../diffusion_pytorch_model-00001-of-00009.safetensors",
    ".../diffusion_pytorch_model-00007-of-00009.safetensors",
    ".../diffusion_pytorch_model-00009-of-00009.safetensors"
]

Loading continued with those 5 of 9 shards and failed with:

ValueError: Cannot detect the model type. File: [...5 shards...].
Model hash: fcc81cc37454f5cd5d5dc572f15bb3a9

Re-running the same script once the download completed worked and produced an image. Same commit, same script; the only difference was that all 9 shards were present.

As far as I can tell, download_if_necessary resolves the path with glob.glob(...) over whatever is on disk, and since hash_model_file covers the keys and shapes of the files it is given, an incomplete shard set hashes to a value that is genuinely not in model_configs.py. The error at model_loader.py:101 is then the "unknown model" one.

I realise a network failure isn't reproducible on demand, and that re-running is already the intended recovery (download() passes ignore_file_pattern=downloaded_files), which is exactly what worked for me. So the ask is small: would you accept a hint in the message, something like

raise ValueError(f"Cannot detect the model type. File: {path}. Model hash: {model_hash}. "
                 f"If the download was interrupted, some files may be missing; re-running will fetch them.")

or would you prefer a completeness check earlier, at the download step? I didn't want to guess, since this path is shared by every model family.

The current message appears in a few open issues (#1144, #1252, #1462). I haven't checked whether any of them share this cause.

Lingua principale
Python
Stelle
13.1k
Fork
1.3k
Merge medio
13h 12m
PR unite (30g)
45

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di modelscope/DiffSynth-Studio

Tutte le issue di modelscope/DiffSynth-Studio

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.