fp16 inference
Browse files
README.md
CHANGED
@@ -26,6 +26,7 @@ pipeline = DiffusionPipeline.from_pretrained(
|
|
26 |
vae=sd3_vae,
|
27 |
custom_pipeline="StonyBrook-CVLab/PixCell-pipeline",
|
28 |
trust_remote_code=True,
|
|
|
29 |
)
|
30 |
|
31 |
pipeline.to(device);
|
@@ -61,7 +62,8 @@ uni_model.to(device);
|
|
61 |
### Unconditional generation
|
62 |
```python
|
63 |
uncond = pipeline.get_unconditional_embedding(1)
|
64 |
-
|
|
|
65 |
```
|
66 |
|
67 |
### Conditional generation
|
@@ -87,5 +89,6 @@ print("Extracted UNI:", uni_emb.shape)
|
|
87 |
# Get unconditional embedding for classifier-free guidance
|
88 |
uncond = pipeline.get_unconditional_embedding(uni_emb.shape[0])
|
89 |
# Generate new samples
|
90 |
-
|
|
|
91 |
```
|
|
|
26 |
vae=sd3_vae,
|
27 |
custom_pipeline="StonyBrook-CVLab/PixCell-pipeline",
|
28 |
trust_remote_code=True,
|
29 |
+
torch_dtype=torch.float16,
|
30 |
)
|
31 |
|
32 |
pipeline.to(device);
|
|
|
62 |
### Unconditional generation
|
63 |
```python
|
64 |
uncond = pipeline.get_unconditional_embedding(1)
|
65 |
+
with torch.amp.autocast('cuda'):
|
66 |
+
samples = pipeline(uni_embeds=uncond, negative_uni_embeds=None, guidance_scale=1.0)
|
67 |
```
|
68 |
|
69 |
### Conditional generation
|
|
|
89 |
# Get unconditional embedding for classifier-free guidance
|
90 |
uncond = pipeline.get_unconditional_embedding(uni_emb.shape[0])
|
91 |
# Generate new samples
|
92 |
+
with torch.amp.autocast('cuda'):
|
93 |
+
samples = pipeline(uni_embeds=uni_emb, negative_uni_embeds=uncond, guidance_scale=3., num_images_per_prompt=1).images
|
94 |
```
|