Instructions to use OzzyGT/MOSS_Image_SFT_diffusers with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use OzzyGT/MOSS_Image_SFT_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("OzzyGT/MOSS_Image_SFT_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 Settings
- Draw Things
- DiffusionBee
Upload README.md
Browse files
README.md
CHANGED
|
@@ -124,44 +124,6 @@ image = pipe(
|
|
| 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.
|
|
|
|
| 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.
|