Yihong Luo
commited on
Commit
•
7a62402
1
Parent(s):
2fb2f3f
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# You Only Sample Once (YOSO)
|
2 |
+
|
3 |
+
This algorithm was proposed in YOSO.
|
4 |
+
|
5 |
+
This model is fine-tuning from PixArt, enabling one-step inference to perform text-to-image generation.
|
6 |
+
|
7 |
+
## usage
|
8 |
+
```python
|
9 |
+
from diffusers import PixArtAlphaPipeline, LCMScheduler, Transformer2DModel, DPMSolverMultistepScheduler
|
10 |
+
|
11 |
+
transformer = Transformer2DModel.from_pretrained(
|
12 |
+
"Yihong666/yoso_pixart512", torch_dtype=torch.float16).to('cuda')
|
13 |
+
|
14 |
+
pipe = PixArtAlphaPipeline.from_pretrained("./models--PixArt-alpha--PixArt-XL-2-512x512",
|
15 |
+
transformer=transformer,
|
16 |
+
torch_dtype=torch.float16, use_safetensors=True)
|
17 |
+
|
18 |
+
pipe = pipe.to('cuda')
|
19 |
+
pipe.scheduler = LCMScheduler.from_config(pipe.scheduler.config)
|
20 |
+
pipe.scheduler.config.prediction_type = "v_prediction"
|
21 |
+
generator = torch.manual_seed(318)
|
22 |
+
imgs = pipe(prompt="Pirate ship trapped in a cosmic maelstrom nebula, rendered in cosmic beach whirlpool engine, volumetric lighting, spectacular, ambient lights, light pollution, cinematic atmosphere, art nouveau style, illustration art artwork by SenseiJaye, intricate detail.",
|
23 |
+
num_inference_steps=1,
|
24 |
+
num_images_per_prompt = 1,
|
25 |
+
generator = generator,
|
26 |
+
guidance_scale=1.,
|
27 |
+
)[0]
|
28 |
+
imgs[0]
|
29 |
+
```
|
30 |
+
![Ship](ship.jpg)
|