Thank you for great work!
when I tested the time cost of linfusion and the dreamshape-v8-base model, I found that linfusion took an average of 1.8s on A100, but the average time consumption of the baseline model was 1.5s. Is this reasonable?
from diffusers import AutoPipelineForText2Image
import torch
from src.linfusion import LinFusion
from src.tools import seed_everything
from tqdm import tqdm
import os
import time
sd_repo = "dreamshaper-8"
pipeline = AutoPipelineForText2Image.from_pretrained(
sd_repo, torch_dtype=torch.float16, variant="fp16"
).to(torch.device("cuda"))
linfusion = LinFusion.construct_for(pipeline, pretrained_model_name_or_path="LinFusion-1-5")
seed_everything(123)
with open("prompts/inference_nvidia.txt", "r") as f:
prompts = f.readlines()
os.makedirs("outputs/linfusion", exist_ok=True)
for prompt in tqdm(prompts):
prompt = prompt.strip()
start_time = time.time()
image = pipeline(
# "An astronaut floating in space. Beautiful view of the stars and the universe in the background."
prompt,
num_inference_steps=50
).images[0]
print("time: ", time.time() - start_time)
image.save(f'outputs/linfusion/{prompt}.png')
from diffusers import AutoPipelineForText2Image, DEISMultistepScheduler
import torch, os
from src.tools import seed_everything
from tqdm import tqdm
import time
pipe = AutoPipelineForText2Image.from_pretrained('dreamshaper-8', torch_dtype=torch.float16, variant="fp16")
pipe.scheduler = DEISMultistepScheduler.from_config(pipe.scheduler.config)
pipe = pipe.to("cuda")
prompt = "A girl is smiling!"
seed_everything(123)
generator = torch.manual_seed(123)
with open("prompts/inference_nvidia.txt", "r") as f:
prompts = f.readlines()
os.makedirs("outputs/dreamshape", exist_ok=True)
for prompt in tqdm(prompts):
prompt = prompt.strip()
start_time = time.time()
image = pipe(prompt, generator=generator, num_inference_steps=50).images[0]
print("time: ", time.time() - start_time)
image.save(f"outputs/dreamshape/{prompt}.png")
Thank you for great work!
when I tested the time cost of linfusion and the dreamshape-v8-base model, I found that linfusion took an average of 1.8s on A100, but the average time consumption of the baseline model was 1.5s. Is this reasonable?