File size: 1,725 Bytes
fcc1876
 
 
 
 
 
 
 
 
 
c5f78fc
 
 
 
 
 
9358cff
c5f78fc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9358cff
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c5f78fc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
---
license: other
license_name: tencent-hunyuan-community
license_link: https://github.com/Tencent-Hunyuan/HunyuanImage-2.1/blob/master/LICENSE
language:
- en
- zh
pipeline_tag: text-to-image
library_name: diffusers
---
```py
from diffusers import HunyuanImagePipeline
import torch

device = "cuda:0"
dtype = torch.bfloat16
repo = "hunyuanvideo-community/HunyuanImage-2.1-Diffusers"

pipe = HunyuanImagePipeline.from_pretrained(repo, torch_dtype=dtype)
pipe = pipe.to(device)

prompt = "A cute, cartoon-style anthropomorphic penguin plush toy with fluffy fur, standing in a painting studio, wearing a red knitted scarf and a red beret with the word “Tencent” on it, holding a paintbrush with a focused expression as it paints an oil painting of the Mona Lisa, rendered in a photorealistic photographic style."

generator = torch.Generator(device=device).manual_seed(649151)
out = pipe(
    prompt, 
    num_inference_steps=50, 
    height=2048, 
    width=2048, 
    generator=generator,
).images[0]

out.save("test_hyimage_output.png")
```

to use a different `guidance_scale`

```py
pipe.guider = pipe.guider.new(guidance_scale=5.0)
prompt = "A cute, cartoon-style anthropomorphic penguin plush toy with fluffy fur, standing in a painting studio, wearing a red knitted scarf and a red beret with the word “Tencent” on it, holding a paintbrush with a focused expression as it paints an oil painting of the Mona Lisa, rendered in a photorealistic photographic style."

generator = torch.Generator(device=device).manual_seed(649151)
out = pipe(
    prompt, 
    num_inference_steps=50, 
    height=2048, 
    width=2048, 
    generator=generator,
).images[0]

out.save("test_hyimage_output_guidnce_scale_5.0.png")
```