Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

显存不足 #29

Open
DIDIDA1713 opened this issue Nov 9, 2024 · 1 comment
Open

显存不足 #29

DIDIDA1713 opened this issue Nov 9, 2024 · 1 comment

Comments

@DIDIDA1713
Copy link

在扩散模型浅空间中更新扰动,将潜在向量变为图片时,需要使用
def diffusion_step(model, latents, context, t, guidance_scale):
latents_input = torch.cat([latents] * 2)
noise_pred = model.unet(latents_input, t, encoder_hidden_states=context)["sample"]
noise_pred_uncond, noise_prediction_text = noise_pred.chunk(2)
noise_pred = noise_pred_uncond + guidance_scale * (noise_prediction_text - noise_pred_uncond)
latents = model.scheduler.step(noise_pred, t, latents)["prev_sample"]
return latents
这时会显示显存不足,我是24G的显存

@WindVChen
Copy link
Owner

哈喽 @DIDIDA1713

是否有对代码哪部分进行了更改呢?目前这版代码在24GB的显卡上(RTX3090和4090)都有测试能够跑通的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants