OzzyGT HF Staff commited on
Commit
cf15fb3
·
verified ·
1 Parent(s): 77f71cb

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +40 -1
README.md CHANGED
@@ -59,7 +59,7 @@ blocks = ModularPipelineBlocks.from_pretrained(
59
  trust_components_code=True,
60
  )
61
  pipe = blocks.init_pipeline()
62
- pipe.load_components(dtype={"default": torch.bfloat16, "vae": torch.float32})
63
  pipe.to("cuda")
64
 
65
  layout = {
@@ -131,6 +131,45 @@ image = pipe(
131
  image.save("moss_image_int8.png")
132
  ```
133
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
134
  ## License
135
 
136
  This model is released under the [Apache-2.0 license](LICENSE), the same as the original.
 
59
  trust_components_code=True,
60
  )
61
  pipe = blocks.init_pipeline()
62
+ pipe.load_components(workflow="text2image", dtype={"default": torch.bfloat16, "vae": torch.float32})
63
  pipe.to("cuda")
64
 
65
  layout = {
 
131
  image.save("moss_image_int8.png")
132
  ```
133
 
134
+ ## Reference images
135
+
136
+ MOSS-Image can also take reference images, through the vision part of its Qwen3.5 text encoder. The model wasn't trained for this: references guide the content, style and layout of the image, not exact pixels or identity. Load the `reference` workflow and pass the images with `reference_images`:
137
+
138
+ ```python
139
+ import sdnq # noqa: F401
140
+ import torch
141
+ from diffusers import ModularPipelineBlocks
142
+ from diffusers.utils import load_image
143
+
144
+
145
+ blocks = ModularPipelineBlocks.from_pretrained(
146
+ "OzzyGT/moss_image_custom_blocks",
147
+ trust_remote_code=True,
148
+ components_repo="OzzyGT/MOSS_Image_Base_sdnq_dynamic_8bit",
149
+ trust_components_code=True,
150
+ )
151
+ pipe = blocks.init_pipeline()
152
+ pipe.load_components(workflow="reference", dtype={"default": torch.bfloat16, "vae": torch.float32})
153
+ pipe.to("cuda")
154
+
155
+ reference = load_image(
156
+ "https://huggingface.co/datasets/OzzyGT/diffusers-examples/resolve/main/krea2_reference/20260907154202_edit_image_0.png"
157
+ )
158
+
159
+ image = pipe(
160
+ prompt="photo",
161
+ reference_images=reference,
162
+ num_inference_steps=28,
163
+ height=1024,
164
+ width=1024,
165
+ generator=torch.Generator("cuda").manual_seed(42),
166
+ output="images",
167
+ )[0]
168
+ image.save("moss_image_reference.png")
169
+ ```
170
+
171
+ `reference_max_pixels` (default 1024 x 1024) sets how large each reference is for the vision encoder. To load only what text-to-image needs, without the vision encoder, use `workflow="text2image"` as in the sample above.
172
+
173
  ## License
174
 
175
  This model is released under the [Apache-2.0 license](LICENSE), the same as the original.