File size: 997 Bytes
a8a63dd
 
fbd4c7f
 
0cf459d
a8a63dd
5d590ff
e6a1dec
 
0cf459d
 
8747d5d
a8a63dd
 
 
3a2ea0a
 
 
fbd4c7f
 
53fc90d
3a2ea0a
e94af11
8747d5d
 
 
 
 
 
 
3a2ea0a
53fc90d
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
import torch
import kiui
import numpy as np
import argparse
from pipeline_mvdream import MVDreamPipeline

pipe = MVDreamPipeline.from_pretrained(
    # "./weights_imagedream", # local weights
    "ashawkey/imagedream-ipmv-diffusers", # remote weights
    torch_dtype=torch.float16,
    trust_remote_code=True,
)
pipe = pipe.to("cuda")


parser = argparse.ArgumentParser(description="ImageDream")
parser.add_argument("image", type=str, default='data/anya_rgba.png')
parser.add_argument("--prompt", type=str, default="")
args = parser.parse_args()

for i in range(5):
    input_image = kiui.read_image(args.image, mode='float')
    image = pipe(args.prompt, input_image, guidance_scale=5, num_inference_steps=30, elevation=0)
    grid = np.concatenate(
        [
            np.concatenate([image[0], image[2]], axis=0),
            np.concatenate([image[1], image[3]], axis=0),
        ],
        axis=1,
    )
    # kiui.vis.plot_image(grid)
    kiui.write_image(f'test_imagedream_{i}.jpg', grid)