run.py 820 Bytes
Newer Older
weishb's avatar
weishb committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import yaml
import torch
from ldm.utils.util import instantiate_from_config


configs = yaml.load(open('/public/home/weishb/iflytek/AudioFly/config/config.yaml', "r"), Loader=yaml.FullLoader)
model = instantiate_from_config(configs["model"])

checkpoint = torch.load('/public/home/weishb/iflytek/AudioFly/models/ldm/model.ckpt')
model.load_state_dict(checkpoint, strict=False)
model.eval()
model = model.cuda()
text = 'Fierce winds howl through the valley' 
name = 'result'
savedir = './result'
model.generate_sample(
        textlist=[text],
        name=name,
        cfg=3.5,# Guidance scale (controls how strongly generation follows the text prompt); not recommended to change
        ddim_steps=200,  # Number of denoising steps in the diffusion process; not recommended to change
        outputdir=f"{savedir}")