modelscope / modelscope/DiffSynth-Studio

qwen-image如何读取本地目录下的模型

Open
#805 4 comments 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

这种方式是先下载模型,对于已经下载好的模型路径无法使用这种写法
pipe = QwenImagePipeline.from_pretrained(
torch_dtype=torch.bfloat16,
device="cuda",
model_configs=[
ModelConfig(model_id="Qwen/Qwen-Image", origin_file_pattern="transformer/diffusion_pytorch_model*.safetensors"),
ModelConfig(model_id="Qwen/Qwen-Image", origin_file_pattern="text_encoder/model*.safetensors"),
ModelConfig(model_id="Qwen/Qwen-Image", origin_file_pattern="vae/diffusion_pytorch_model.safetensors"),
],
tokenizer_config=ModelConfig(model_id="Qwen/Qwen-Image", origin_file_pattern="tokenizer/"),
)

提供了ModelConfig(path="models/xxx.safetensors"),然而path一次只能加载一个文件,无法加载一个完整路径
还提供了local_model_path,这种用了报错
请问正确的完整的加载本地模型的代码是怎样的写法

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 QwenImagePipeline.from_pretrained and the ModelConfig and local_model_path handling shown in the issue. Reproduce the failure using a complete local model directory, then trace how its transformer, text encoder, VAE, and tokenizer files are resolved. Done means documenting or correcting a working local-loading path and verifying it against the reported setup.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.