|
import torch |
|
import time |
|
|
|
from lyrasd_model import LyraSdTxt2ImgPipeline |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib_path = "./lyrasd_model/lyrasd_lib/libth_lyrasd_cu12_sm86.so" |
|
model_path = "./models/lyrasd_rev_animated" |
|
lora_path = "./models/lyrasd_xiaorenshu_lora" |
|
|
|
|
|
model = LyraSdTxt2ImgPipeline(model_path, lib_path) |
|
|
|
|
|
|
|
model.load_lora(lora_path, "xiaorenshu", 0.4, "fp32") |
|
|
|
|
|
prompt = "a cat, cute, cartoon, concise, traditional, chinese painting, Tang and Song Dynasties, masterpiece, 4k, 8k, UHD, best quality" |
|
negative_prompt = "(((horrible))), (((scary))), (((naked))), (((large breasts))), high saturation, colorful, human:2, body:2, low quality, bad quality, lowres, out of frame, duplicate, watermark, signature, text, frames, cut, cropped, malformed limbs, extra limbs, (((missing arms))), (((missing legs)))" |
|
height, width = 512, 512 |
|
steps = 30 |
|
guidance_scale = 7 |
|
generator = torch.Generator().manual_seed(123) |
|
num_images = 1 |
|
|
|
start = time.perf_counter() |
|
|
|
images = model(prompt, height, width, steps, |
|
guidance_scale, negative_prompt, num_images, |
|
generator=generator) |
|
print("image gen cost: ",time.perf_counter() - start) |
|
|
|
for i, image in enumerate(images): |
|
image.save(f"outputs/res_txt2img_lora_{i}.png") |
|
|
|
|
|
|
|
|