Instructions to use smartdigitalnetworks/beyond-reality-z-image-diffusers with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use smartdigitalnetworks/beyond-reality-z-image-diffusers with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("smartdigitalnetworks/beyond-reality-z-image-diffusers", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
- Local Apps
- Draw Things
- DiffusionBee
Commit ·
c395401
0
Parent(s):
Duplicate from linoyts/beyond-reality-z-image-diffusers
Browse filesCo-authored-by: Linoy Tsaban <linoyts@users.noreply.huggingface.co>
- .gitattributes +35 -0
- README.md +67 -0
- config.json +31 -0
- diffusion_pytorch_model.safetensors +3 -0
.gitattributes
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
base_model: Tongyi-MAI/Z-Image-Turbo
|
| 4 |
+
tags:
|
| 5 |
+
- diffusers
|
| 6 |
+
- text-to-image
|
| 7 |
+
- z-image
|
| 8 |
+
library_name: diffusers
|
| 9 |
+
pipeline_tag: text-to-image
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
# beyond-reality-z-image-diffusers
|
| 13 |
+
|
| 14 |
+
This is a converted version of the Beyond Reality Z-Image transformer, converted to diffusers format for use with the `ZImagePipeline`.
|
| 15 |
+
|
| 16 |
+
## Model Description
|
| 17 |
+
|
| 18 |
+
This transformer is based on [Beyond Reality Z-Image](https://huggingface.co/Nurburgring/BEYOND_REALITY_Z_IMAGE), converted from ComfyUI format to diffusers format.
|
| 19 |
+
|
| 20 |
+
## Usage
|
| 21 |
+
|
| 22 |
+
```python
|
| 23 |
+
import torch
|
| 24 |
+
from diffusers import ZImagePipeline, ZImageTransformer2DModel
|
| 25 |
+
|
| 26 |
+
# Load the custom transformer
|
| 27 |
+
transformer = ZImageTransformer2DModel.from_pretrained(
|
| 28 |
+
"linoyts/beyond-reality-z-image-diffusers",
|
| 29 |
+
torch_dtype=torch.bfloat16
|
| 30 |
+
)
|
| 31 |
+
|
| 32 |
+
# Load the pipeline with custom transformer
|
| 33 |
+
pipe = ZImagePipeline.from_pretrained(
|
| 34 |
+
"Tongyi-MAI/Z-Image-Turbo",
|
| 35 |
+
transformer=transformer,
|
| 36 |
+
torch_dtype=torch.bfloat16,
|
| 37 |
+
)
|
| 38 |
+
pipe.to("cuda")
|
| 39 |
+
|
| 40 |
+
# Generate an image
|
| 41 |
+
prompt = "A beautiful landscape with mountains and a lake, photorealistic, 8k"
|
| 42 |
+
image = pipe(
|
| 43 |
+
prompt=prompt,
|
| 44 |
+
num_inference_steps=8,
|
| 45 |
+
guidance_scale=0.0, # Z-Image-Turbo uses guidance_scale=0
|
| 46 |
+
width=1024,
|
| 47 |
+
height=1024,
|
| 48 |
+
).images[0]
|
| 49 |
+
|
| 50 |
+
image.save("output.png")
|
| 51 |
+
```
|
| 52 |
+
|
| 53 |
+
## Original Model
|
| 54 |
+
|
| 55 |
+
- **Source**: [Nurburgring/BEYOND_REALITY_Z_IMAGE](https://huggingface.co/Nurburgring/BEYOND_REALITY_Z_IMAGE)
|
| 56 |
+
- **Base Architecture**: [Tongyi-MAI/Z-Image-Turbo](https://huggingface.co/Tongyi-MAI/Z-Image-Turbo)
|
| 57 |
+
|
| 58 |
+
## Conversion Details
|
| 59 |
+
|
| 60 |
+
The model was converted from ComfyUI format to diffusers format with the following key transformations:
|
| 61 |
+
- Removed `model.diffusion_model.` prefix from all keys
|
| 62 |
+
- Renamed `x_embedder` to `all_x_embedder.2-1`
|
| 63 |
+
- Renamed `final_layer` to `all_final_layer.2-1`
|
| 64 |
+
- Split `attention.qkv` into `attention.to_q`, `attention.to_k`, `attention.to_v`
|
| 65 |
+
- Renamed `attention.out` to `attention.to_out.0`
|
| 66 |
+
- Renamed `attention.q_norm` to `attention.norm_q`
|
| 67 |
+
- Renamed `attention.k_norm` to `attention.norm_k`
|
config.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_class_name": "ZImageTransformer2DModel",
|
| 3 |
+
"_diffusers_version": "0.36.0.dev0",
|
| 4 |
+
"all_f_patch_size": [
|
| 5 |
+
1
|
| 6 |
+
],
|
| 7 |
+
"all_patch_size": [
|
| 8 |
+
2
|
| 9 |
+
],
|
| 10 |
+
"axes_dims": [
|
| 11 |
+
32,
|
| 12 |
+
48,
|
| 13 |
+
48
|
| 14 |
+
],
|
| 15 |
+
"axes_lens": [
|
| 16 |
+
1536,
|
| 17 |
+
512,
|
| 18 |
+
512
|
| 19 |
+
],
|
| 20 |
+
"cap_feat_dim": 2560,
|
| 21 |
+
"dim": 3840,
|
| 22 |
+
"in_channels": 16,
|
| 23 |
+
"n_heads": 30,
|
| 24 |
+
"n_kv_heads": 30,
|
| 25 |
+
"n_layers": 30,
|
| 26 |
+
"n_refiner_layers": 2,
|
| 27 |
+
"norm_eps": 1e-05,
|
| 28 |
+
"qk_norm": true,
|
| 29 |
+
"rope_theta": 256.0,
|
| 30 |
+
"t_scale": 1000.0
|
| 31 |
+
}
|
diffusion_pytorch_model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2002fbb39c9790b408efc6fd3f92f5ed25e68b4e94d347231de992f78ee68968
|
| 3 |
+
size 12309881888
|