Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Saving and Loading pytorch model as state dict (mlflow#3705)
* Adding save_state_dict and load_state_dict method to mlflow.pytorch library Signed-off-by: Shrinath Suresh <shrinath@ideas2it.com> * Removing unwanted changes Signed-off-by: Shrinath Suresh <shrinath@ideas2it.com> * Resetting empty lines Signed-off-by: Shrinath Suresh <shrinath@ideas2it.com> * Adding Unit tests for save_state_dict and load_state_dict model Signed-off-by: Shrinath Suresh <shrinath@ideas2it.com> * Adding log_state_dict method and refactored load_model to reuse most of the code in load_state_dict method Signed-off-by: Shrinath Suresh <shrinath@ideas2it.com> * Removing unused argument Signed-off-by: Shrinath Suresh <shrinath@ideas2it.com> * Applying black Signed-off-by: Shrinath Suresh <shrinath@ideas2it.com> * save_state_dict, log_state_dict and load_state_dict with pytorch flavor Signed-off-by: Shrinath Suresh <shrinath@ideas2it.com> * Removing MLModel file for state dict and adding appropriate conditions to load the state dict Signed-off-by: Shrinath Suresh <shrinath@ideas2it.com> * Updating doc strings Signed-off-by: Shrinath Suresh <shrinath@ideas2it.com> * Setting experimental annotation and saving state dict as state_dict.pth Signed-off-by: Shrinath Suresh <shrinath@ideas2it.com> * Fixing doc strings Signed-off-by: Shrinath Suresh <shrinath@ideas2it.com> * Removing state_dict key from save_model Signed-off-by: Shrinath Suresh <shrinath@ideas2it.com> * Addressing review comments Signed-off-by: Shrinath Suresh <shrinath@ideas2it.com> * Applying black Signed-off-by: Shrinath Suresh <shrinath@ideas2it.com> * Removing doc string Signed-off-by: Shrinath Suresh <shrinath@ideas2it.com> * swapping arguments Signed-off-by: Shrinath Suresh <shrinath@ideas2it.com> * Using get_artifact_uri to derive model path Signed-off-by: Shrinath Suresh <shrinath@ideas2it.com> * Removing pickle_module from save and log state dict Signed-off-by: Shrinath Suresh <shrinath@ideas2it.com> * rephrasing doc strings Signed-off-by: Shrinath Suresh <shrinath@ideas2it.com> * Renaming tests Signed-off-by: Shrinath Suresh <shrinath@ideas2it.com> * Comparing state dicts in test Signed-off-by: Shrinath Suresh <shrinath@ideas2it.com> * Disabling reimport error Signed-off-by: Shrinath Suresh <shrinath@ideas2it.com> * Removing blank line between params in doc string Signed-off-by: Shrinath Suresh <shrinath@ideas2it.com> * Removing model Signed-off-by: Shrinath Suresh <shrinath@ideas2it.com> * Replacing _get_model_artifact_path with _download_artifact_from_uri Signed-off-by: Shrinath Suresh <shrinath@ideas2it.com> * creating get_sequential_model utility and renamving model_class to model Signed-off-by: Shrinath Suresh <shrinath@ideas2it.com> * Removing pd.DataFrame type conversion Signed-off-by: Shrinath Suresh <shrinath@ideas2it.com> * Adding compare state dicts utility Signed-off-by: Shrinath Suresh <shrinath@ideas2it.com> * Removing Ordered Dictionary from doc string Signed-off-by: Shrinath Suresh <shrinath@ideas2it.com> * Fixing Docstring Signed-off-by: Shrinath Suresh <shrinath@ideas2it.com> * Removing unused variable Signed-off-by: Shrinath Suresh <shrinath@ideas2it.com> * Removing unused import Signed-off-by: Shrinath Suresh <shrinath@ideas2it.com> * Addressing review comments Signed-off-by: Shrinath Suresh <shrinath@ideas2it.com> * Removing unrelated change Signed-off-by: Shrinath Suresh <shrinath@ideas2it.com> * Addressing review comments Signed-off-by: Shrinath Suresh <shrinath@ideas2it.com> * Removing data folder Signed-off-by: Shrinath Suresh <shrinath@ideas2it.com> * Addressing review comments Signed-off-by: Shrinath Suresh <shrinath@ideas2it.com> * revert changes on load_model Signed-off-by: harupy <17039389+harupy@users.noreply.github.com> * remove redundant folder generation Signed-off-by: harupy <17039389+harupy@users.noreply.github.com> * Set exist_ok to True Signed-off-by: harupy <17039389+harupy@users.noreply.github.com> * Assert state_dict is dict Signed-off-by: harupy <17039389+harupy@users.noreply.github.com> * wording fix Signed-off-by: harupy <17039389+harupy@users.noreply.github.com> * kwargs Signed-off-by: harupy <17039389+harupy@users.noreply.github.com> * remove redundant model.eval Signed-off-by: harupy <17039389+harupy@users.noreply.github.com> * fix Signed-off-by: harupy <17039389+harupy@users.noreply.github.com> * Prevent false positive Signed-off-by: harupy <17039389+harupy@users.noreply.github.com> * test for nested_state_dict Signed-off-by: harupy <17039389+harupy@users.noreply.github.com> * blank line Signed-off-by: harupy <17039389+harupy@users.noreply.github.com> * move tests Signed-off-by: harupy <17039389+harupy@users.noreply.github.com> * put state dict functions in one place Signed-off-by: harupy <17039389+harupy@users.noreply.github.com> * remove unused variable Signed-off-by: harupy <17039389+harupy@users.noreply.github.com> * comment on test_save_state_dict_can_save_nested_state_dict Signed-off-by: harupy <17039389+harupy@users.noreply.github.com> * Fix Signed-off-by: harupy <17039389+harupy@users.noreply.github.com> * ensure model and optim can load state dict Signed-off-by: harupy <17039389+harupy@users.noreply.github.com> * enhance comment Signed-off-by: harupy <17039389+harupy@users.noreply.github.com> * comment Signed-off-by: harupy <17039389+harupy@users.noreply.github.com> * dot Signed-off-by: harupy <17039389+harupy@users.noreply.github.com> * remove useless comma Signed-off-by: harupy <17039389+harupy@users.noreply.github.com> * use pos args Signed-off-by: harupy <17039389+harupy@users.noreply.github.com> * rename Signed-off-by: harupy <17039389+harupy@users.noreply.github.com> * nit Signed-off-by: harupy <17039389+harupy@users.noreply.github.com> * article Signed-off-by: harupy <17039389+harupy@users.noreply.github.com> * example Signed-off-by: harupy <17039389+harupy@users.noreply.github.com> * Add checkpoint example Signed-off-by: harupy <17039389+harupy@users.noreply.github.com> * remove ... Signed-off-by: harupy <17039389+harupy@users.noreply.github.com> * warning Signed-off-by: harupy <17039389+harupy@users.noreply.github.com> Co-authored-by: harupy <17039389+harupy@users.noreply.github.com> Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>
- Loading branch information