Open githubofhuo opened 1 year ago
@githubofhuo hi, I am also testing img2img with AITemplate(with RTX3090), in my test, with same configs(steps, sampler, strength...), when compile a model with 640x640
model work fine, but in some resolutions (e.g: 768x768, 1024*1024), the model will randomly generate a black image, have you ever encountered this problem? Thanks
update:
I am using the following code to check the output of each component(clip, unet, vae), when generate image is black vae
output returns False
def isfinite(t: torch.Tensor) -> bool:
return torch.isfinite(t).all()
@githubofhuo hi, I am also testing img2img with AITemplate(with RTX3090), in my test, with same configs(steps, sampler, strength...), when compile a model with
640x640
model work fine, but in some resolutions (e.g: 768x768, 1024*1024), the model will randomly generate a black image, have you ever encountered this problem? Thanksupdate:
I am using the following code to check the output of each component(clip, unet, vae), when generate image is black
vae
output returnsFalse
def isfinite(t: torch.Tensor) -> bool: return torch.isfinite(t).all()
I haven't met black image. I only run on A100, AITemplate v0.1.1. with size 512512, 768768 and 1024*1024. Now the result is acceptable, although there are few differences between the results of diffusers and ait. Dont use eular a, use DDIM or PNMD works well.
for repeatable results, please check seed of the generator I use this config:
def set_seed(seed=0):
torch.manual_seed(seed)
torch.cuda.manual_seed(seed)
torch.cuda.manual_seed_all(seed)
np.random.seed(seed)
random.seed(seed)
torch.backends.cudnn.benchmark = False
torch.backends.cudnn.deterministic = True
os.environ["CUBLAS_WORKSPACE_CONFIG"] = ":16:8"
torch.use_deterministic_algorithms(True)
update: fixed by applying the following operations
I see that @Sanster found a workaround for their issue, however, @githubofhuo, is your issue still there?
@githubofhuo does the discrepancy come from the precision casting? fp16 AIT is supposed to have some nuanced differences compared to the ones generated from PyTorch fp32.
I see that @Sanster found a workaround for their issue, however, @githubofhuo, is your issue still there?
thx, output image now is almost identical to diffusers result, although intermediate results have little discrepancy.
thx, output image now is almost identical to diffusers result, although intermediate results have little discrepancy.
Hi, I met a similar issue and couldn't find out why. Could you please educate me how did you manage to reduce the discrepancy? Thanks ahead!
@githubofhuo The same here. How do you reduce the discrepancy?
python3 ./scripts/demo.py --local-dir /root/AT3P-diffusers/ --prompt "girl,skirt,full body"
why?i convert the ckpt to diffusers
I use aitmplate for stable diffusion inference and complie success, but img2img result is different from pytorch diffusers img2img result. Two results are basically the same, but there are differences in the details and background of the generated characters, and I have same input arguments.
I checked the intermediate result and found that the output of clip text encoder has diff in the thousandth (eps=1e-3).
The following are clip text encoder outputs, both seqlen is truncate to 64, (pt for pytorch diffusers StableDiffusionImg2ImgPipeline, ait for AITemplate StableDiffusionImg2ImgAITPipeline)
The following are the specific parameters:
And the results of img2img pt: ait:
Does anyone have idea to fix precision error and make ait reuslt equal to pytorch diffusers results? Thanks