Skip to content

Conversation

@kabachuha
Copy link
Contributor

Now the precision type for Dreambooth class images generation can be set with mixed_precision as well.

Fixes #1831

Copy link
Contributor

@patil-suraj patil-suraj left a comment

Choose a reason for hiding this comment

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

Thanks a lot for the PR! I'm not in favor of this because IMO it's fine to just use fp16 for generating images here. If mixed-precision is not used for training, then the generation will happen in fp32 which will make it twice slower and require more memory. Generating images in fp16 doesn't really hurt the quality of the images. Hope this makes sense :)

Also, is there any specific reason for doing inference in fp32?

@kabachuha
Copy link
Contributor Author

@patil-suraj Using fp16 for generating images may not work for every hardware, like in my case. It's specified in the settings anyway, so if your gpu is fine with it, just leave it on fp16 as it is by default

@patil-suraj
Copy link
Contributor

I see, in this maybe we can could add a new argument, --prior_generation_dtype which will be None by default and the script will use the current logic, and if it's not None use that dtype.

@kabachuha
Copy link
Contributor Author

@patil-suraj sounds good, I can remake this PR then for this new argument. I did think of adding a new argument in the first place, yet decided against it in presence of another, but not entirely related argument. If adding a new one is fine, it will be even better

@kabachuha kabachuha marked this pull request as draft December 27, 2022 15:32
@patil-suraj
Copy link
Contributor

Yeah adding a new one is fine, go for it.

@kabachuha kabachuha marked this pull request as ready for review December 27, 2022 15:55
@kabachuha
Copy link
Contributor Author

named it prior_generation_precision instead of prior_generation_dtype to be similar with the existing mixed_precision argument, the options are also "no", "fp32", "fp16", "bp16" to reflect the choices for that option

Copy link
Contributor

@patil-suraj patil-suraj left a comment

Choose a reason for hiding this comment

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

Looks good!

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Dec 27, 2022

The documentation is not available anymore as the PR was closed or merged.

@patil-suraj patil-suraj merged commit cf5265a into huggingface:main Dec 27, 2022
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.

[Dreambooth] Precision mismatch when generating class images

3 participants