Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,48 @@
|
|
1 |
-
---
|
2 |
-
license: creativeml-openrail-m
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: creativeml-openrail-m
|
3 |
+
base_model: ptx0/pixart-900m-1024-ft-large
|
4 |
+
tags:
|
5 |
+
- stable-diffusion
|
6 |
+
- stable-diffusion-diffusers
|
7 |
+
- text-to-image
|
8 |
+
- diffusers
|
9 |
+
- full
|
10 |
+
- pixart
|
11 |
+
- pixart sigma
|
12 |
+
inference: true
|
13 |
+
|
14 |
+
|
15 |
+
## Inference
|
16 |
+
|
17 |
+
### ComfyUI
|
18 |
+
- Download model file `transformer/diffusion_pytorch_model.safetensors` and put into `ComfyUI/models/checkpoints`
|
19 |
+
- Use ExtraModels node: https://github.com/city96/ComfyUI_ExtraModels?tab=readme-ov-file#pixart
|
20 |
+
|
21 |
+
![image/png](https://cdn-uploads.huggingface.co/production/uploads/643c7e91b409fef15e0bd11b/MJfTShin1fYOOCo4mTv2-.png)
|
22 |
+
|
23 |
+
```python
|
24 |
+
import torch
|
25 |
+
from diffusers import DiffusionPipeline, EulerAncestralDiscreteScheduler
|
26 |
+
from diffusers.models import PixArtTransformer2DModel
|
27 |
+
|
28 |
+
|
29 |
+
model_id = "anyMODE/realMODE_900M"
|
30 |
+
negative_prompt = "malformed, disgusting, overexposed, washed-out"
|
31 |
+
|
32 |
+
pipeline = DiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
|
33 |
+
pipeline.transformer = PixArtTransformer2DModel.from_pretrained(model_id, subfolder="transformer", torch_dtype=torch.float16)
|
34 |
+
pipeline.scheduler = EulerAncestralDiscreteScheduler.from_config(pipeline.scheduler.config)
|
35 |
+
pipeline.to('cuda' if torch.cuda.is_available() else 'cpu')
|
36 |
+
|
37 |
+
prompt = "On the left, there is a red cube. On the right, there is a blue sphere. On top of the red cube is a dog. On top of the blue sphere is a cat"
|
38 |
+
image = pipeline(
|
39 |
+
prompt=prompt,
|
40 |
+
negative_prompt='blurry, cropped, ugly',
|
41 |
+
num_inference_steps=30,
|
42 |
+
generator=torch.Generator(device='cuda' if torch.cuda.is_available() else 'mps' if torch.backends.mps.is_available() else 'cpu').manual_seed(1641421826),
|
43 |
+
width=1024,
|
44 |
+
height=1024,
|
45 |
+
guidance_scale=5.5,
|
46 |
+
).images[0]
|
47 |
+
image.save("output.png", format="JPEG")
|
48 |
+
```
|