diff --git a/.gitattributes b/.gitattributes index 15ba2c6..9665a17 100644 --- a/.gitattributes +++ b/.gitattributes @@ -45,3 +45,7 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text *.wasm filter=lfs diff=lfs merge=lfs -text *.zst filter=lfs diff=lfs merge=lfs -text *tfevents* filter=lfs diff=lfs merge=lfs -text + +split_files/text_encoders/qwen_3_4b.safetensors filter=lfs diff=lfs merge=lfs -text +split_files/vae/ae.safetensors filter=lfs diff=lfs merge=lfs -text +split_files/diffusion_models/z_image_turbo_bf16.safetensors filter=lfs diff=lfs merge=lfs -text \ No newline at end of file diff --git a/README.md b/README.md index 725fc0d..47944d8 100644 --- a/README.md +++ b/README.md @@ -1,48 +1,7 @@ --- -license: Apache License 2.0 -tags: [] - -#model-type: -##如 gpt、phi、llama、chatglm、baichuan 等 -#- gpt - -#domain: -##如 nlp、cv、audio、multi-modal -#- nlp - -#language: -##语言代码列表 https://help.aliyun.com/document_detail/215387.html?spm=a2c4g.11186623.0.0.9f8d7467kni6Aa -#- cn - -#metrics: -##如 CIDEr、Blue、ROUGE 等 -#- CIDEr - -#tags: -##各种自定义,包括 pretrained、fine-tuned、instruction-tuned、RL-tuned 等训练方法和其他 -#- pretrained - -#tools: -##如 vllm、fastchat、llamacpp、AdaSeq 等 -#- vllm +tags: +- diffusion-single-file +- comfyui --- -### 当前模型的贡献者未提供更加详细的模型介绍。模型文件和权重,可浏览“模型文件”页面获取。 -#### 您可以通过如下git clone命令,或者ModelScope SDK来下载模型 -SDK下载 -```bash -#安装ModelScope -pip install modelscope -``` -```python -#SDK模型下载 -from modelscope import snapshot_download -model_dir = snapshot_download('Comfy-Org/z_image_turbo') -``` -Git下载 -``` -#Git模型下载 -git clone https://www.modelscope.cn/Comfy-Org/z_image_turbo.git -``` - -

如果您是本模型的贡献者,我们邀请您根据模型贡献文档,及时完善模型卡片内容。

\ No newline at end of file +Workflows: https://comfyanonymous.github.io/ComfyUI_examples/z_image/ \ No newline at end of file diff --git a/configuration.json b/configuration.json new file mode 100644 index 0000000..33678ad --- /dev/null +++ b/configuration.json @@ -0,0 +1 @@ +{"framework": "pytorch", "task": "text-to-image-synthesis", "allow_remote": true} \ No newline at end of file diff --git a/split_files/diffusion_models/z_image_turbo_bf16.safetensors b/split_files/diffusion_models/z_image_turbo_bf16.safetensors new file mode 100644 index 0000000..7b3ffca --- /dev/null +++ b/split_files/diffusion_models/z_image_turbo_bf16.safetensors @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2407613050b809ffdff18a4ac99af83ea6b95443ecebdf80e064a79c825574a6 +size 12309866400 diff --git a/split_files/text_encoders/qwen_3_4b.safetensors b/split_files/text_encoders/qwen_3_4b.safetensors new file mode 100644 index 0000000..8eb608c --- /dev/null +++ b/split_files/text_encoders/qwen_3_4b.safetensors @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6c671498573ac2f7a5501502ccce8d2b08ea6ca2f661c458e708f36b36edfc5a +size 8044982048 diff --git a/split_files/vae/ae.safetensors b/split_files/vae/ae.safetensors new file mode 100644 index 0000000..71f11a9 --- /dev/null +++ b/split_files/vae/ae.safetensors @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:afc8e28272cd15db3919bacdb6918ce9c1ed22e96cb12c4d5ed0fba823529e38 +size 335304388 diff --git a/z_image_convert_original_to_comfy.py b/z_image_convert_original_to_comfy.py new file mode 100644 index 0000000..9315b26 --- /dev/null +++ b/z_image_convert_original_to_comfy.py @@ -0,0 +1,52 @@ +import safetensors.torch +import torch +import sys + +# Usage: python z_image_convert_original_to_comfy.py output.safetensors diffusion_model*.safetensors + +cast_to = None +if "fp8_e4m3fn" in sys.argv[1]: + cast_to = torch.float8_e4m3fn +elif "fp16" in sys.argv[1]: + cast_to = torch.float16 +elif "bf16" in sys.argv[1]: + cast_to = torch.bfloat16 + +replace_keys = {"all_final_layer.2-1.": "final_layer.", + "all_x_embedder.2-1.": "x_embedder.", + ".attention.to_out.0.bias": ".attention.out.bias", + ".attention.norm_k.weight": ".attention.k_norm.weight", + ".attention.norm_q.weight": ".attention.q_norm.weight", + ".attention.to_out.0.weight": ".attention.out.weight" + } + +out_sd = {} +for f in sys.argv[2:]: + sd = safetensors.torch.load_file(f) + cc = None + for k in sd: + w = sd[k] + + if cast_to is not None: + w = w.to(cast_to) + k_out = k + if k_out.endswith(".attention.to_out.0.bias"): + continue + if k_out.endswith(".attention.to_k.weight"): + cc = [w] + continue + if k_out.endswith(".attention.to_q.weight"): + cc = [w] + cc + continue + if k_out.endswith(".attention.to_v.weight"): + cc = cc + [w] + w = torch.cat(cc, dim=0) + k_out = k_out.replace(".attention.to_v.weight", ".attention.qkv.weight") + + for r, rr in replace_keys.items(): + k_out = k_out.replace(r, rr) + out_sd[k_out] = w + + + +safetensors.torch.save_file(out_sd, sys.argv[1])