-
Notifications
You must be signed in to change notification settings - Fork 611
Add export_dtype parameter to convert_to_hf function
#2041
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
Conversation
wwwjn
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for contributing, I have a basic question - When do we need low precision weights?
|
|
||
| @torch.inference_mode() | ||
| def convert_to_hf(input_dir, output_dir, model_name, model_flavor, hf_assets_path): | ||
| if model_name == "flux": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why we are removing this line here? Could you provide some tests results (can be simple as a screenshot or terminal outputs) to show it still works for FLUX model?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, I removed it because the import didn't make sense anymore as the flux folder was moved from experiments to the main models folders. So now it does not require "special" treatment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding when to use low precision, it is more space efficient, especially when uploading checkpoints to cloud storage. I kept the default export fp32 but IMO making bf16 the default export type makes more sense as most models that are uploaded today are in bf16.
|
Thank you! Could you fix the |
8edfa3d to
9ce21b6
Compare
|
@wwwjn Thanks, I fixed it so now the linting should pass. |
tianyu-l
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sgtm
The current
convert_to_hf.pydoes not supportexport_dtype, which makes itfloat32by default. This PR adds support for export dtypes of["float16", "bfloat16", "float32"].