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

Fix bug in stable diffusion when mask_pad_tokens is false #147

Merged
merged 1 commit into from
May 31, 2024

Conversation

coryMosaicML
Copy link
Collaborator

Currently when mask_pad_tokens=False in the stable diffusion model, the mask is still passed to the text encoder at generation time. This introduces a train/test mismatch because the masked tokens in the text encoder output are different from the unmasked tokens, and the model is trained with the unmasked pad tokens. The result is a degradation in image quality. The fix is to only use the mask from the tokenizer output if mask_pad_tokens=True.

Copy link
Contributor

@Landanjs Landanjs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@coryMosaicML coryMosaicML merged commit 7d3a7cc into mosaicml:main May 31, 2024
5 checks passed
coryMosaicML added a commit to coryMosaicML/diffusion that referenced this pull request Jun 4, 2024
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

Successfully merging this pull request may close these issues.

3 participants