OzzyGT HF Staff commited on
Commit
54e9e7d
·
verified ·
1 Parent(s): 62c38ac

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +39 -1
README.md CHANGED
@@ -52,7 +52,7 @@ blocks = ModularPipelineBlocks.from_pretrained(
52
  trust_components_code=True,
53
  )
54
  pipe = blocks.init_pipeline()
55
- pipe.load_components(dtype={"default": torch.bfloat16, "vae": torch.float32})
56
  pipe.to("cuda")
57
 
58
  layout = {
@@ -124,6 +124,44 @@ image = pipe(
124
  image.save("moss_image.png")
125
  ```
126
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
127
  ## License
128
 
129
  This model is released under the [Apache-2.0 license](LICENSE), the same as the original.
 
52
  trust_components_code=True,
53
  )
54
  pipe = blocks.init_pipeline()
55
+ pipe.load_components(workflow="text2image", dtype={"default": torch.bfloat16, "vae": torch.float32})
56
  pipe.to("cuda")
57
 
58
  layout = {
 
124
  image.save("moss_image.png")
125
  ```
126
 
127
+ ## Reference images
128
+
129
+ 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`:
130
+
131
+ ```python
132
+ import torch
133
+ from diffusers import ModularPipelineBlocks
134
+ from diffusers.utils import load_image
135
+
136
+
137
+ blocks = ModularPipelineBlocks.from_pretrained(
138
+ "OzzyGT/moss_image_custom_blocks",
139
+ trust_remote_code=True,
140
+ components_repo="OzzyGT/MOSS_Image_SFT_diffusers",
141
+ trust_components_code=True,
142
+ )
143
+ pipe = blocks.init_pipeline()
144
+ pipe.load_components(workflow="reference", dtype={"default": torch.bfloat16, "vae": torch.float32})
145
+ pipe.to("cuda")
146
+
147
+ reference = load_image(
148
+ "https://huggingface.co/datasets/OzzyGT/diffusers-examples/resolve/main/krea2_reference/20260907154202_edit_image_0.png"
149
+ )
150
+
151
+ image = pipe(
152
+ prompt="photo",
153
+ reference_images=reference,
154
+ num_inference_steps=28,
155
+ height=1024,
156
+ width=1024,
157
+ generator=torch.Generator("cuda").manual_seed(42),
158
+ output="images",
159
+ )[0]
160
+ image.save("moss_image_reference.png")
161
+ ```
162
+
163
+ `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.
164
+
165
  ## License
166
 
167
  This model is released under the [Apache-2.0 license](LICENSE), the same as the original.