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

Allowed saving model with different dtype (float16, float32) #18979

Open
pure-rgb opened this issue Dec 21, 2023 · 0 comments
Open

Allowed saving model with different dtype (float16, float32) #18979

pure-rgb opened this issue Dec 21, 2023 · 0 comments
Assignees
Labels
stat:awaiting keras-eng Awaiting response from Keras engineer type:feature The user is asking for a new feature.

Comments

@pure-rgb
Copy link

Whether enable mixed precision with dtype float16 or not (float32), it would be better to have option to save model with different dtype.

keras.callbacks.ModelCheckpoint(
    filepath,
    monitor="val_loss",
    verbose=0,
    save_best_only=False,
    save_weights_only=False,
    mode="auto",
    save_freq="epoch",
    initial_value_threshold=None,
    dtype='float16'  # < ---------------------- NEW ADD
)
  • It is usefull for some cases where the mode is too big to use. Saving it in float16 format, would definitly help.
  • The savaed float16 model should work properly later if mixed precision is not enabled, means float32.
  • If mixed precision is enabled (float16), the ModelCheckpoint should be independent, means if dtype=float32 is set for this callback, it should work.
@sachinprasadhs sachinprasadhs added type:feature The user is asking for a new feature. keras-team-review-pending Pending review by a Keras team member. labels Dec 26, 2023
@mattdangerw mattdangerw self-assigned this Jan 4, 2024
@mattdangerw mattdangerw removed the keras-team-review-pending Pending review by a Keras team member. label Jan 4, 2024
@sachinprasadhs sachinprasadhs added the stat:awaiting keras-eng Awaiting response from Keras engineer label Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stat:awaiting keras-eng Awaiting response from Keras engineer type:feature The user is asking for a new feature.
3 participants