From f02d856f76ede69d919fa93d150767833fdd7360 Mon Sep 17 00:00:00 2001 From: Nikhil Popli Date: Fri, 9 Feb 2024 17:15:30 +0530 Subject: [PATCH 1/6] added mnist example --- mnist-classifaction/train_job/deploy.py | 33 ++ .../train_job/requirements.txt | 3 + mnist-classifaction/train_job/train.py | 97 +++++ mnist-classifaction/train_model.ipynb | 377 ++++++++++++++++++ 4 files changed, 510 insertions(+) create mode 100644 mnist-classifaction/train_job/deploy.py create mode 100644 mnist-classifaction/train_job/requirements.txt create mode 100644 mnist-classifaction/train_job/train.py create mode 100644 mnist-classifaction/train_model.ipynb diff --git a/mnist-classifaction/train_job/deploy.py b/mnist-classifaction/train_job/deploy.py new file mode 100644 index 0000000..3e9fa25 --- /dev/null +++ b/mnist-classifaction/train_job/deploy.py @@ -0,0 +1,33 @@ +import logging, os, argparse +from servicefoundry import Build, Job, PythonBuild, Param, Port, LocalSource, Resources + +# parsing the arguments +parser = argparse.ArgumentParser() +parser.add_argument( + "--workspace_fqn", type=str, required=True, help="fqn of the workspace to deploy to" +) +args = parser.parse_args() + +# defining the job specifications +job = Job( + name="mnist-train-job", + image=Build( + build_spec=PythonBuild( + command="python train.py --num_epochs {{num_epochs}} --ml_repo {{ml_repo}}", + requirements_path="requirements.txt", + ), + build_source=LocalSource(local_build=False) + ), + params=[ + Param(name="num_epochs", default='4'), + Param(name="ml_repo", param_type="ml_repo"), + ], + resources=Resources( + cpu_request=0.5, + cpu_limit=0.5, + memory_request=1000, + memory_limit=1500 + ) + +) +deployment = job.deploy(workspace_fqn=args.workspace_fqn) \ No newline at end of file diff --git a/mnist-classifaction/train_job/requirements.txt b/mnist-classifaction/train_job/requirements.txt new file mode 100644 index 0000000..efd722c --- /dev/null +++ b/mnist-classifaction/train_job/requirements.txt @@ -0,0 +1,3 @@ +matplotlib==3.8.2 +tensorflow==2.15.0 +mlfoundry==0.10.4 \ No newline at end of file diff --git a/mnist-classifaction/train_job/train.py b/mnist-classifaction/train_job/train.py new file mode 100644 index 0000000..94eea5b --- /dev/null +++ b/mnist-classifaction/train_job/train.py @@ -0,0 +1,97 @@ +import mlfoundry +import tensorflow as tf +from tensorflow.keras.datasets import mnist +import matplotlib.pyplot as plt +from tensorflow.keras.datasets import mnist +import os +import argparse + +# parsing the arguments +parser = argparse.ArgumentParser() +parser.add_argument( + "--num_epochs", type=int, default=4 +) +parser.add_argument( + "--ml_repo", type=str, required=True +) +args = parser.parse_args() + +ML_REPO_NAME=args.ml_repo + +# Load the MNIST dataset +(x_train, y_train), (x_test, y_test) = mnist.load_data() + +print(f"The number of train images: {len(x_train)}") +print(f"The number of test images: {len(x_test)}") + +# Plot some sample images +plt.figure(figsize=(10, 5)) +for i in range(10): + plt.subplot(2, 5, i+1) + plt.imshow(x_train[i], cmap='gray') + plt.title(f"Label: {y_train[i]}") + plt.axis('off') +plt.tight_layout() +plt.show() + + +# Load the MNIST dataset +(x_train, y_train), (x_test, y_test) = mnist.load_data() + +# Normalize the pixel values between 0 and 1 +x_train = x_train / 255.0 +x_test = x_test / 255.0 + + +# Define the model architecture +model = tf.keras.Sequential([ + tf.keras.layers.Flatten(input_shape=(28, 28)), + tf.keras.layers.Dense(128, activation='relu'), + tf.keras.layers.Dense(10, activation='softmax') +]) + +# Compile the model +model.compile(optimizer='adam', loss='sparse_categorical_crossentropy', metrics=['accuracy']) + + +# Creating client for logging the metadata +client = mlfoundry.get_client() + +client.create_ml_repo(ML_REPO_NAME) +run = client.create_run(ml_repo=ML_REPO_NAME) + + +#logging the parameters +run.log_params({"optimizer": "adam", "loss": "sparse_categorical_crossentropy", "metric": ["accuracy"]}) + + + +# Train the model +epochs = args.num_epochs +model.fit(x_train, y_train, epochs=epochs, validation_data=(x_test, y_test)) + +# Evaluate the model +loss, accuracy = model.evaluate(x_test, y_test) +print(f'Test loss: {loss}') +print(f'Test accuracy: {accuracy}') + + +# Log Metrics and Model + +# Logging the metrics of the model +run.log_metrics(metric_dict={"accuracy": accuracy, "loss": loss}) + +# Save the trained model +model.save('mnist_model.h5') + +# Logging the model +run.log_model( + name="handwritten-digits-recognition", + model_file_or_folder='mnist_model.h5', + framework="tensorflow", + description="sample model to recognize the handwritten digits", + metadata={"accuracy": accuracy, "loss": loss}, + step=1, # step number, useful when using iterative algorithms like SGD +) + + diff --git a/mnist-classifaction/train_model.ipynb b/mnist-classifaction/train_model.ipynb new file mode 100644 index 0000000..db2c111 --- /dev/null +++ b/mnist-classifaction/train_model.ipynb @@ -0,0 +1,377 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "id": "QOAnoPl-dlSY" + }, + "source": [ + "# Train and Deploy Model on Truefoundry\n", + "This notebook demonstrates a demo on how you can train an image classification model on mnist dataset and deploy the model as a Gradio App on truefoundry platform." + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "2c6nhZIxSvl2", + "tags": [] + }, + "source": [ + "# 🛠 Setup\n", + "To follow along with the notebook, you will have to do the following:\n", + "* Install **mlfoundry** and required ML Libraries\n", + "* Setup logging\n", + "* Select the Workspace in which you want to deploy your application.\n", + "* Install the required packages" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "rnalU7uLTgmr", + "outputId": "f86ff448-85c4-4d71-8508-19d5fe89cc36" + }, + "outputs": [], + "source": [ + "!pip install -U \"mlfoundry\" tensorflow matplotlib" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "NN133xapzkt7" + }, + "outputs": [], + "source": [ + "import logging\n", + "[logging.root.removeHandler(h) for h in logging.root.handlers]\n", + "logging.basicConfig(level=logging.INFO, format='%(asctime)s [%(name)s] %(levelname)-8s %(message)s')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "FmmB5HHfXvES", + "outputId": "da5fce00-b2b9-4ee4-9d88-b5d24a59cb5c" + }, + "outputs": [], + "source": [ + "!mlfoundry login --host https://app.truefoundry.com" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "ML_REPO_NAME=input(\"Enter the name of ML Repo:\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "29MYl11z2HTj", + "outputId": "fa8f8d4c-d81f-422d-ae8c-2f7405994009" + }, + "outputs": [], + "source": [ + "import mlfoundry\n", + "\n", + "client = mlfoundry.get_client()" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "ZMUlU9JaFqjb" + }, + "source": [ + "# MNIST Dataset - Problem Statement and Data Exploration\n", + "\n", + "The MNIST dataset is a popular benchmark dataset in the field of machine learning and computer vision. It consists of a large collection of handwritten digits (0-9) in grayscale images, along with their corresponding labels.\n", + "\n", + "### Problem Statement\n", + "\n", + "The problem associated with the MNIST dataset is to train a model that can accurately classify the given images of handwritten digits into their respective classes. It is a classification problem with 10 classes (0-9), where each image represents a single digit.\n", + "\n", + "### Data Exploration\n", + "\n", + "Let's explore the MNIST dataset by loading and visualizing some of its samples." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "yobS2EbrGuuU", + "outputId": "da2bf2e9-9161-4d53-d14c-332a189c3999" + }, + "outputs": [], + "source": [ + "import matplotlib.pyplot as plt\n", + "from tensorflow.keras.datasets import mnist\n", + "\n", + "# Load the MNIST dataset\n", + "(x_train, y_train), (x_test, y_test) = mnist.load_data()\n", + "\n", + "print(f\"The number of train images: {len(x_train)}\")\n", + "print(f\"The number of test images: {len(x_test)}\")" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "hZV7qQlMG2v3" + }, + "source": [ + "The MNIST dataset is divided into two sets: a training set (x_train and y_train) and a testing set (x_test and y_test). The training set contains 60,000 images, while the testing set contains 10,000 images.\n", + "\n", + "Now, let's visualize some samples from the dataset using matplotlib:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 473 + }, + "id": "AYV6qMxaHf0K", + "outputId": "5b4f7607-c3c8-4318-9704-56c4f60ecb65" + }, + "outputs": [], + "source": [ + "# Plot some sample images\n", + "plt.figure(figsize=(10, 5))\n", + "for i in range(10):\n", + " plt.subplot(2, 5, i+1)\n", + " plt.imshow(x_train[i], cmap='gray')\n", + " plt.title(f\"Label: {y_train[i]}\")\n", + " plt.axis('off')\n", + "plt.tight_layout()\n", + "plt.show()" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "jZ0w7bA2HkPs" + }, + "source": [ + "\n", + "The code above plots a grid of 10 sample images from the training set. Each image is displayed in grayscale, and the corresponding label is shown as the title.\n", + "\n", + "You can see that the images are 28x28 pixels in size and represent handwritten digits. The labels indicate the true values of the digits." + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "dVuzxCrHEzdq" + }, + "source": [ + "# Train the model\n", + "\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Preparing the Dataset" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import tensorflow as tf\n", + "from tensorflow.keras.datasets import mnist\n", + "\n", + "# Load the MNIST dataset\n", + "(x_train, y_train), (x_test, y_test) = mnist.load_data()\n", + "\n", + "# Normalize the pixel values between 0 and 1\n", + "x_train = x_train / 255.0\n", + "x_test = x_test / 255.0" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Defining the model" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Define the model architecture\n", + "model = tf.keras.Sequential([\n", + " tf.keras.layers.Flatten(input_shape=(28, 28)),\n", + " tf.keras.layers.Dense(128, activation='relu'),\n", + " tf.keras.layers.Dense(10, activation='softmax')\n", + "])\n", + "\n", + "# Compile the model\n", + "model.compile(optimizer='adam', loss='sparse_categorical_crossentropy', metrics=['accuracy'])" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Log Parameters" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "client.create_ml_repo(ML_REPO_NAME)\n", + "run = client.create_run(ml_repo=ML_REPO_NAME)\n", + "\n", + "\n", + "#logging the parameters\n", + "run.log_params({\"optimizer\": \"adam\", \"loss\": \"sparse_categorical_crossentropy\", \"metric\": [\"accuracy\"]})" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Train the model" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Train the model\n", + "epochs = 3\n", + "model.fit(x_train, y_train, epochs=epochs, validation_data=(x_test, y_test))\n", + "\n", + "# Evaluate the model\n", + "loss, accuracy = model.evaluate(x_test, y_test)\n", + "print(f'Test loss: {loss}')\n", + "print(f'Test accuracy: {accuracy}')" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Log Metrics and Model" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "QYdt42PLp05W", + "outputId": "2d47d0e1-c9ea-4477-cb5f-6d6a051f465b" + }, + "outputs": [], + "source": [ + "#Here we are logging the metrics of the model\n", + "run.log_metrics(metric_dict={\"accuracy\": accuracy, \"loss\": loss})\n", + "\n", + "# Save the trained model\n", + "model.save('mnist_model.h5')\n", + "\n", + "#here we are logging the model\n", + "run.log_model(\n", + " name=\"handwritten-digits-recognition\",\n", + " model_file_or_folder='mnist_model.h5',\n", + " framework=\"tensorflow\",\n", + " description=\"sample model to recognize the handwritten digits\",\n", + " metadata={\"accuracy\": accuracy, \"loss\": loss}\n", + ")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Making predictions with the model" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Make predictions using the model\n", + "predictions = model.predict(x_test[:10])\n", + "predicted_labels = [tf.argmax(prediction).numpy() for prediction in predictions]\n", + "print(f'Predicted labels: {predicted_labels}')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "accelerator": "GPU", + "colab": { + "gpuType": "T4", + "provenance": [] + }, + "kernelspec": { + "display_name": ".conda-jupyter-base", + "language": "python", + "name": "conda-env-.conda-jupyter-base-py" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.6" + } + }, + "nbformat": 4, + "nbformat_minor": 4 + } + \ No newline at end of file From b0c834fd6a6d23cc91dea829060adae5954d652d Mon Sep 17 00:00:00 2001 From: Nikhil Popli <97437109+nikp1172@users.noreply.github.com> Date: Fri, 9 Feb 2024 17:31:37 +0530 Subject: [PATCH 2/6] Update mnist-classifaction/train_job/train.py Co-authored-by: debajyoti-truefoundry <97010181+debajyoti-truefoundry@users.noreply.github.com> --- mnist-classifaction/train_job/train.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mnist-classifaction/train_job/train.py b/mnist-classifaction/train_job/train.py index 94eea5b..75cdc35 100644 --- a/mnist-classifaction/train_job/train.py +++ b/mnist-classifaction/train_job/train.py @@ -57,8 +57,8 @@ # Creating client for logging the metadata client = mlfoundry.get_client() -client.create_ml_repo(ML_REPO_NAME) -run = client.create_run(ml_repo=ML_REPO_NAME) +client.create_ml_repo(args.ml_repo) +run = client.create_run(ml_repo=args.ml_repo) #logging the parameters From e4a068ce62ea977e768ce69d15f4285b41a6a4da Mon Sep 17 00:00:00 2001 From: Nikhil Popli <97437109+nikp1172@users.noreply.github.com> Date: Fri, 9 Feb 2024 17:31:42 +0530 Subject: [PATCH 3/6] Update mnist-classifaction/train_job/train.py Co-authored-by: debajyoti-truefoundry <97010181+debajyoti-truefoundry@users.noreply.github.com> --- mnist-classifaction/train_job/train.py | 1 - 1 file changed, 1 deletion(-) diff --git a/mnist-classifaction/train_job/train.py b/mnist-classifaction/train_job/train.py index 75cdc35..abf072d 100644 --- a/mnist-classifaction/train_job/train.py +++ b/mnist-classifaction/train_job/train.py @@ -16,7 +16,6 @@ ) args = parser.parse_args() -ML_REPO_NAME=args.ml_repo # Load the MNIST dataset (x_train, y_train), (x_test, y_test) = mnist.load_data() From 4e745f93ceb619c1f958170d1776b6dc5f30fca7 Mon Sep 17 00:00:00 2001 From: Nikhil Popli Date: Fri, 9 Feb 2024 18:08:19 +0530 Subject: [PATCH 4/6] nit: resolve comments --- mnist-classifaction/train_job/train.py | 29 +++++++---------- mnist-classifaction/train_model.ipynb | 44 ++++++-------------------- 2 files changed, 21 insertions(+), 52 deletions(-) diff --git a/mnist-classifaction/train_job/train.py b/mnist-classifaction/train_job/train.py index abf072d..ece0d24 100644 --- a/mnist-classifaction/train_job/train.py +++ b/mnist-classifaction/train_job/train.py @@ -20,9 +20,19 @@ # Load the MNIST dataset (x_train, y_train), (x_test, y_test) = mnist.load_data() +# Normalize the pixel values between 0 and 1 +x_train = x_train / 255.0 +x_test = x_test / 255.0 + print(f"The number of train images: {len(x_train)}") print(f"The number of test images: {len(x_test)}") +# Creating client for logging the metadata +client = mlfoundry.get_client() + +client.create_ml_repo(args.ml_repo) +run = client.create_run(ml_repo=args.ml_repo) + # Plot some sample images plt.figure(figsize=(10, 5)) for i in range(10): @@ -30,18 +40,11 @@ plt.imshow(x_train[i], cmap='gray') plt.title(f"Label: {y_train[i]}") plt.axis('off') +run.log_plots({"images": plt}) plt.tight_layout() plt.show() -# Load the MNIST dataset -(x_train, y_train), (x_test, y_test) = mnist.load_data() - -# Normalize the pixel values between 0 and 1 -x_train = x_train / 255.0 -x_test = x_test / 255.0 - - # Define the model architecture model = tf.keras.Sequential([ tf.keras.layers.Flatten(input_shape=(28, 28)), @@ -52,19 +55,9 @@ # Compile the model model.compile(optimizer='adam', loss='sparse_categorical_crossentropy', metrics=['accuracy']) - -# Creating client for logging the metadata -client = mlfoundry.get_client() - -client.create_ml_repo(args.ml_repo) -run = client.create_run(ml_repo=args.ml_repo) - - #logging the parameters run.log_params({"optimizer": "adam", "loss": "sparse_categorical_crossentropy", "metric": ["accuracy"]}) - - # Train the model epochs = args.num_epochs model.fit(x_train, y_train, epochs=epochs, validation_data=(x_test, y_test)) diff --git a/mnist-classifaction/train_model.ipynb b/mnist-classifaction/train_model.ipynb index db2c111..95060f4 100644 --- a/mnist-classifaction/train_model.ipynb +++ b/mnist-classifaction/train_model.ipynb @@ -130,6 +130,9 @@ "\n", "# Load the MNIST dataset\n", "(x_train, y_train), (x_test, y_test) = mnist.load_data()\n", + "# Normalize the pixel values between 0 and 1\n", + "x_train = x_train / 255.0\n", + "x_test = x_test / 255.0\n", "\n", "print(f\"The number of train images: {len(x_train)}\")\n", "print(f\"The number of test images: {len(x_test)}\")" @@ -159,13 +162,18 @@ }, "outputs": [], "source": [ + "client.create_ml_repo(ML_REPO_NAME)\n", + "run = client.create_run(ml_repo=ML_REPO_NAME, name=\"train-model\")\n", + "\n", "# Plot some sample images\n", "plt.figure(figsize=(10, 5))\n", - "for i in range(10):\n", + "for i in range(5):\n", " plt.subplot(2, 5, i+1)\n", " plt.imshow(x_train[i], cmap='gray')\n", " plt.title(f\"Label: {y_train[i]}\")\n", " plt.axis('off')\n", + "\n", + "run.log_plots({\"images\": plt})\n", "plt.tight_layout()\n", "plt.show()" ] @@ -197,7 +205,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "### Preparing the Dataset" + "### Defining the model" ] }, { @@ -208,28 +216,6 @@ "source": [ "import tensorflow as tf\n", "from tensorflow.keras.datasets import mnist\n", - "\n", - "# Load the MNIST dataset\n", - "(x_train, y_train), (x_test, y_test) = mnist.load_data()\n", - "\n", - "# Normalize the pixel values between 0 and 1\n", - "x_train = x_train / 255.0\n", - "x_test = x_test / 255.0" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Defining the model" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ "# Define the model architecture\n", "model = tf.keras.Sequential([\n", " tf.keras.layers.Flatten(input_shape=(28, 28)),\n", @@ -254,9 +240,6 @@ "metadata": {}, "outputs": [], "source": [ - "client.create_ml_repo(ML_REPO_NAME)\n", - "run = client.create_run(ml_repo=ML_REPO_NAME)\n", - "\n", "\n", "#logging the parameters\n", "run.log_params({\"optimizer\": \"adam\", \"loss\": \"sparse_categorical_crossentropy\", \"metric\": [\"accuracy\"]})" @@ -338,13 +321,6 @@ "predicted_labels = [tf.argmax(prediction).numpy() for prediction in predictions]\n", "print(f'Predicted labels: {predicted_labels}')" ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": { From 4632942634ce95cb1a5da9722a89025b170b3d07 Mon Sep 17 00:00:00 2001 From: Nikhil Popli Date: Fri, 9 Feb 2024 18:09:58 +0530 Subject: [PATCH 5/6] give run a name --- mnist-classifaction/train_job/train.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mnist-classifaction/train_job/train.py b/mnist-classifaction/train_job/train.py index ece0d24..a37c299 100644 --- a/mnist-classifaction/train_job/train.py +++ b/mnist-classifaction/train_job/train.py @@ -31,7 +31,7 @@ client = mlfoundry.get_client() client.create_ml_repo(args.ml_repo) -run = client.create_run(ml_repo=args.ml_repo) +run = client.create_run(ml_repo=args.ml_repo, run_name="train-model") # Plot some sample images plt.figure(figsize=(10, 5)) From ea63c3e90c2040010f09c9c8bbc303a2a7e1cfca Mon Sep 17 00:00:00 2001 From: Nikhil Popli Date: Fri, 9 Feb 2024 18:18:25 +0530 Subject: [PATCH 6/6] nit: fixes --- mnist-classifaction/train_job/deploy.py | 4 ++-- mnist-classifaction/train_job/train.py | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/mnist-classifaction/train_job/deploy.py b/mnist-classifaction/train_job/deploy.py index 3e9fa25..d5c3480 100644 --- a/mnist-classifaction/train_job/deploy.py +++ b/mnist-classifaction/train_job/deploy.py @@ -25,8 +25,8 @@ resources=Resources( cpu_request=0.5, cpu_limit=0.5, - memory_request=1000, - memory_limit=1500 + memory_request=1500, + memory_limit=2000 ) ) diff --git a/mnist-classifaction/train_job/train.py b/mnist-classifaction/train_job/train.py index a37c299..acfdcf2 100644 --- a/mnist-classifaction/train_job/train.py +++ b/mnist-classifaction/train_job/train.py @@ -42,7 +42,6 @@ plt.axis('off') run.log_plots({"images": plt}) plt.tight_layout() -plt.show() # Define the model architecture