diff --git a/docs/readthedocs/source/doc/Orca/QuickStart/orca-pytorch-distributed-quickstart.md b/docs/readthedocs/source/doc/Orca/QuickStart/orca-pytorch-distributed-quickstart.md index 2dbf38d2fc6..3a20bfebbbe 100644 --- a/docs/readthedocs/source/doc/Orca/QuickStart/orca-pytorch-distributed-quickstart.md +++ b/docs/readthedocs/source/doc/Orca/QuickStart/orca-pytorch-distributed-quickstart.md @@ -130,4 +130,18 @@ for r in result: print(r, ":", result[r]) ``` +### **Step 5: Save and Load the Model** + +Save the Estimator states (including model and optimizer) to the provided model path. + +```python +est.save("mnist_model") +``` + +Load the Estimator states (model and possibly with optimizer) from provided model path. + +```python +est.load("mnist_model") +``` + **Note:** You should call `stop_orca_context()` when your application finishes. diff --git a/docs/readthedocs/source/doc/Orca/QuickStart/orca-pytorch-quickstart.md b/docs/readthedocs/source/doc/Orca/QuickStart/orca-pytorch-quickstart.md index 73bad54af7f..0bfce47e7de 100644 --- a/docs/readthedocs/source/doc/Orca/QuickStart/orca-pytorch-quickstart.md +++ b/docs/readthedocs/source/doc/Orca/QuickStart/orca-pytorch-quickstart.md @@ -132,4 +132,18 @@ for r in result: print(r, ":", result[r]) ``` +### **Step 5: Save and Load the Model** + +Save the Estimator states (including model and optimizer) to the provided model path. + +```python +est.save("mnist_model") +``` + +Load the Estimator states (model and possibly with optimizer) from the provided model path. + +```python +est.load("mnist_model") +``` + **Note:** You should call `stop_orca_context()` when your application finishes. diff --git a/docs/readthedocs/source/doc/Orca/QuickStart/orca-tf2keras-quickstart.md b/docs/readthedocs/source/doc/Orca/QuickStart/orca-tf2keras-quickstart.md index c460ef674d4..c1fd8f136fa 100644 --- a/docs/readthedocs/source/doc/Orca/QuickStart/orca-tf2keras-quickstart.md +++ b/docs/readthedocs/source/doc/Orca/QuickStart/orca-tf2keras-quickstart.md @@ -130,20 +130,20 @@ You could also save the model to Keras H5 format by passingĀ `save_format='h5'` ```python # save model in SavedModel format -estimator.save("/tmp/cifar10_model") +est.save("/tmp/cifar10_model") # load model -estimator.load("/tmp/cifar10_model") +est.load("/tmp/cifar10_model") ``` **2. HDF5 format** ```python # save model in H5 format -estimator.save("/tmp/cifar10_model.h5", save_format='h5') +est.save("/tmp/cifar10_model.h5", save_format='h5') # load model -estimator.load("/tmp/cifar10_model.h5") +est.load("/tmp/cifar10_model.h5") ``` That's it, the same code can run seamlessly in your local laptop and to distribute K8s or Hadoop cluster. diff --git a/python/orca/colab-notebook/quickstart/pytorch_distributed_lenet_mnist.ipynb b/python/orca/colab-notebook/quickstart/pytorch_distributed_lenet_mnist.ipynb index b68df39197a..8a2db378e82 100644 --- a/python/orca/colab-notebook/quickstart/pytorch_distributed_lenet_mnist.ipynb +++ b/python/orca/colab-notebook/quickstart/pytorch_distributed_lenet_mnist.ipynb @@ -426,6 +426,35 @@ "The accuracy of this model has reached 98%." ] }, + { + "cell_type": "markdown", + "metadata": { + "id": "uL9QMvCRLjae" + }, + "source": [ + "### **Step 5: Save the model**" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "icshLUG2LlR6" + }, + "source": [ + "Save the Estimator states (including model and optimizer) to the provided model path." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "sQjoelcfL-Mv" + }, + "outputs": [], + "source": [ + "est.save(\"mnist_model\")" + ] + }, { "cell_type": "code", "execution_count": null, diff --git a/python/orca/colab-notebook/quickstart/pytorch_lenet_mnist.ipynb b/python/orca/colab-notebook/quickstart/pytorch_lenet_mnist.ipynb index 0b6b1a733cb..350fc05c6f4 100644 --- a/python/orca/colab-notebook/quickstart/pytorch_lenet_mnist.ipynb +++ b/python/orca/colab-notebook/quickstart/pytorch_lenet_mnist.ipynb @@ -465,6 +465,35 @@ "The accuracy of this model has reached 98%." ] }, + { + "cell_type": "markdown", + "metadata": { + "id": "qhLhJ4vWc-95" + }, + "source": [ + "### **Step 5: Save the Model**" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "DmmtHcPodLA3" + }, + "source": [ + "Save the Estimator states (including model and optimizer) to the provided model path." + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "WUbsriiBdprT" + }, + "source": [ + "est.save(\"mnist_model\")" + ], + "execution_count": null, + "outputs": [] + }, { "cell_type": "code", "metadata": {