Skip to content

Commit

Permalink
update TF/Keras formats using the saving method as the artifact type
Browse files Browse the repository at this point in the history
  • Loading branch information
rbavery committed Dec 12, 2024
1 parent 15b293c commit b4885f6
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -655,26 +655,29 @@ Following are some proposed *Artifact Type* values for corresponding approaches,
permitted as well. Note that the names are selected using the framework-specific definitions to help
the users understand the source explicitly, although this is not strictly required either.

| Artifact Type | Description |
|--------------------|--------------------------------------------------------------------------------------|
| `torch.save` | A [serialized python pickle object][pytorch-save] (i.e.: `.pt`) which can represent a model or state_dict. |
| `torch.jit.save` | A [`TorchScript`][pytorch-jit-script] model artifact obtained with one or more of the graph export options Torchscript Tracing and Torchscript Scripting. |
| `torch.export.save` | A model artifact storing an ExportedProgram obtained by [`torch.export.export`][pytorch-export] (i.e.: `.pt2`). |
| `TFSavedModel` | A [SavedModel][tf-save] from Tensorflow or Keras. |
| `Keras_v3` | Keras v3 is the [recommended format][keras-recommended] by the Tensorflow team. See this example to [save and load models][keras-example] and the update to date docs [disambiguating different save methods][keras-methods] in TF and Keras.. |
| `h5` | [Keras and tf.keras model][h5] weights format, which uses HDF5. |
| Artifact Type | Description |
|--------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `torch.save` | A [serialized python pickle object][pytorch-save] (i.e.: `.pt`) which can represent a model or state_dict. |
| `torch.jit.save` | A [`TorchScript`][pytorch-jit-script] model artifact obtained with one or more of the graph export options Torchscript Tracing and Torchscript Scripting. |
| `torch.export.save` | A model artifact storing an [ExportedProgram][exported-program] obtained by [`torch.export.export`][pytorch-export] (i.e.: `.pt2`). |
| `tf.keras.Model.save` | Saves a [.keras model file][keras-model], a unified zip archive format containing the architecture, weights, optimizer, losses, and metrics. |
| `tf.keras.Model.save_weights` | A [.weights.h5][keras-save-weights] file containing only model weights for use by Tensorflow or Keras. |
| `tf.keras.Model.export(format='tf_saved_model')` | TF Saved Model is the [recommended format][tf-keras-recommended] by the Tensorflow team for whole model saving/loading for inference. See this example to [save and load models][keras-example] and the docs for [different save methods][keras-methods] in TF and Keras. Also available from `keras.Model.export(format='tf_saved_model')` |



[exported-program]: https://pytorch.org/docs/main/export.html#serialization
[pytorch-compile]: https://pytorch.org/tutorials/intermediate/torch_compile_tutorial.html
[pytorch-export]: https://pytorch.org/docs/main/export.html
[pytorch-frameworks]: https://pytorch.org/docs/main/export.html#existing-frameworks
[pytorch-aot-inductor]: https://pytorch.org/docs/main/torch.compiler_aot_inductor.html
[pytorch-jit-script]: https://pytorch.org/docs/stable/jit.html
[pytorch-save]: https://pytorch.org/tutorials/beginner/saving_loading_models.html
[tf-save]: https://www.tensorflow.org/guide/saved_model
[keras-save-weights]: https://keras.io/api/models/model_saving_apis/weights_saving_and_loading/#save_weights-method
[keras-example]: https://keras.io/guides/serialization_and_saving/
[keras-recommended]: https://www.tensorflow.org/guide/saved_model#creating_a_savedmodel_from_keras
[h5]: https://keras.io/api/models/model_saving_apis/weights_saving_and_loading/
[keras-methods]: https://keras.io/2.16/api/models/model_saving_apis/model_saving_and_loading/
[tf-keras-recommended]: https://www.tensorflow.org/guide/saved_model#creating_a_savedmodel_from_keras
[keras-methods]: https://keras.io/2.16/api/models/model_saving_apis/
[keras-model]: https://keras.io/api/models/model_saving_apis/model_saving_and_loading/

### Source Code Asset

Expand Down

0 comments on commit b4885f6

Please sign in to comment.