Skip to content
This repository has been archived by the owner on May 29, 2024. It is now read-only.

Commit

Permalink
Merge pull request #2 from MGTheTrain/feature/ml-training-app
Browse files Browse the repository at this point in the history
[Feature] Simple feedforward neural network with MNIST dataset to map input images to their corresponding digit classes
  • Loading branch information
MGTheTrain authored Apr 27, 2024
2 parents 0dcbdc2 + 6731ac0 commit 6642ae2
Show file tree
Hide file tree
Showing 28 changed files with 143 additions and 5 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [Feature] kubeflow operator or mlflow helm chart installations in deployed AKS clusters
- [Feature] CD workflow for on-demand AKS deployments and kubeflow operator or mlflow helm chart installations
- [Feature] CD wofklow for on demand deployments of an Azure Storage Account Container **(For storing terraform state files)**
- [Feature] Added `devcontainer.json` with necessary tooling for local development
- [Feature] Added `devcontainer.json` with necessary tooling for local development
- [Feature] Simple feedforward neural network with MNIST dataset to map input images to their corresponding digit classes
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@ Repository showcasing ML Ops practices with kubeflow and mlflow
- [x] CD workflow for on-demand AKS deployments and kubeflow operator or mlflow helm chart installations
- [x] CD wofklow for on demand deployments of an Azure Storage Account Container **(For storing terraform state files)**
- [x] Added `devcontainer.json` with necessary tooling for local development
- [ ] Dockerized Python (pytorch or tensorflow) application for ML training purposes or Jupyter notebooks
- [ ] CNN architecture training considering pre-trained models for image classification AI applications
- [ ] Dockerized Python (pytorch or tensorflow) application for ML training purposes and Jupyter notebooks
- [x] Simple feedforward neural network with MNIST dataset to map input images to their corresponding digit classes
- [ ] CNN architecture training considering COCO dataset and pre-trained models for image classification AI applications
- [ ] (**OPTIONAL**) Transformer architecture training considering pre-trained models for chatbot AI applications
- [ ] Helm charts with K8s manifests for ML jobs (with and without kubeflow)
- [ ] Helm charts with K8s manifests for ML jobs (with and without kubeflow) considering the [Training Operator for CRDs](https://github.com/kubeflow/training-operator)
- [ ] Demonstration of model training and model deployment trough automation workflows
- [ ] (**OPTIONAL**) mlflow experiments for the machine learning lifecycle

Expand Down Expand Up @@ -77,6 +78,14 @@ The volumes that were created appear as follows:

![Jupyter instance created volumes](./images/jupyter-instance-created-volumes.PNG)

The Jypter instace that was created appear as follows:

![Created Jupyter instance](./images/created-jupyter-instance.PNG)

Once `CONNECTED` to a Jupyter instance ensure to clone this Git repository (HTTPS URL: `https://github.com/MGTheTrain/ml-ops-ftw.git`):

![Clone git repository](./images/clone-git-repository.PNG)

TBD


Expand Down
Binary file added images/clone-git-repository.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/created-jupyter-instance.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
2 changes: 1 addition & 1 deletion python/README.md → python/keras-mnist-training/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# python
# Keras training app with mnist dataset

### Folder structure

Expand Down
File renamed without changes.
4 changes: 4 additions & 0 deletions python/keras-mnist-training/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from src import train

if __name__ == "__main__":
train.main()
File renamed without changes.
2 changes: 2 additions & 0 deletions python/keras-mnist-training/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
tensorflow=2.16.1
numpy
14 changes: 14 additions & 0 deletions python/keras-mnist-training/src/data_loader.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import tensorflow as tf

def load_data():
# Load MNIST dataset
(x_train, y_train), (x_test, y_test) = tf.keras.datasets.mnist.load_data()

# Normalize pixel values to the range [0, 1]
x_train, x_test = x_train / 255.0, x_test / 255.0

# Add channel dimension for convolutional networks
x_train = x_train[..., tf.newaxis]
x_test = x_test[..., tf.newaxis]

return (x_train, y_train), (x_test, y_test)
9 changes: 9 additions & 0 deletions python/keras-mnist-training/src/model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import tensorflow as tf
from tensorflow.keras import layers, models

def build_model():
model = models.Sequential([
layers.Dense(64, activation='relu', input_shape=(28, 28)),
layers.Dense(10, activation='softmax')
])
return model
11 changes: 11 additions & 0 deletions python/keras-mnist-training/src/train.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from .data_loader import load_data
from .model import build_model

def main():
x_train, y_train = load_data()
model = build_model()
model.compile(optimizer='adam',
loss='sparse_categorical_crossentropy',
metrics=['accuracy'])

model.fit(x_train, y_train, epochs=10, batch_size=32)
3 changes: 3 additions & 0 deletions python/keras-mnist-training/src/utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
def preprocess_data(data):
# Data preprocessing code here
pass
Empty file removed python/src/data_loader.py
Empty file.
Empty file removed python/src/model.py
Empty file.
Empty file removed python/src/train.py
Empty file.
Empty file removed python/src/utils.py
Empty file.
39 changes: 39 additions & 0 deletions python/tf-yolo-coco-training/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
dist/
eggs/
*.egg-info/

# IDEs
.idea/
.vscode/

# Dependency directories
venv/
env/

# Compiled Python files
*.pyc
*.pyo

# Logs and databases
*.log
*.sqlite
*.db

# Model artifacts
*.pt # PyTorch model files
*.h5 # TensorFlow model files

# Miscellaneous
.DS_Store
25 changes: 25 additions & 0 deletions python/tf-yolo-coco-training/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Tensorflow yolov4 training app with coco dataset

### Folder structure

```sh
project_root/
├── data/ # Directory for storing datasets
│ └── dataset/
│ └── ...
├── models/ # Directory for storing trained models
│ └── saved_models/
│ └── ...
├── src/ # Source code directory
│ ├── data_loader.py # Data loading utilities. Load the dataset from the specified directory (data/ in this case) or from external sources like databases or APIs
│ ├── model.py # Model architecture definition
│ ├── train.py # Training script
│ └── utils.py # Utility functions
├── requirements.txt # Python dependencies
├── README.md # Project README file
└── main.py # Main entry point script for running the application
```
File renamed without changes.
4 changes: 4 additions & 0 deletions python/tf-yolo-coco-training/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from src import train

if __name__ == "__main__":
train.main()
File renamed without changes.
2 changes: 2 additions & 0 deletions python/tf-yolo-coco-training/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
tensorflow=2.16.1
numpy
4 changes: 4 additions & 0 deletions python/tf-yolo-coco-training/src/data_loader.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import tensorflow as tf

def load_data():
pass
3 changes: 3 additions & 0 deletions python/tf-yolo-coco-training/src/model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

def build_model():
pass
5 changes: 5 additions & 0 deletions python/tf-yolo-coco-training/src/train.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from .data_loader import load_data
from .model import build_model

def main():
pass
3 changes: 3 additions & 0 deletions python/tf-yolo-coco-training/src/utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
def preprocess_data(data):
# Data preprocessing code here
pass

0 comments on commit 6642ae2

Please sign in to comment.