Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/redhat-na-ssa/demo-rosa-sagemaker
How to use ROSA with AWS sagemaker
https://github.com/redhat-na-ssa/demo-rosa-sagemaker
aws biometric deep-learning fingerprint kubernetes machine-learning odh opendatahub openshift rosa sagemaker tensorflow
Last synced: 19 days ago
JSON representation
How to use ROSA with AWS sagemaker
- Host: GitHub
- URL: https://github.com/redhat-na-ssa/demo-rosa-sagemaker
- Owner: redhat-na-ssa
- Created: 2022-11-14T17:47:01.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-11-22T01:02:45.000Z (about 1 year ago)
- Last Synced: 2023-11-22T15:54:45.009Z (about 1 year ago)
- Topics: aws, biometric, deep-learning, fingerprint, kubernetes, machine-learning, odh, opendatahub, openshift, rosa, sagemaker, tensorflow
- Language: Shell
- Homepage:
- Size: 5.2 MB
- Stars: 10
- Watchers: 4
- Forks: 9
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Fingerprint Prediction on Red Hat OpenShift Container Platform
Table of Contents
## The Project
![](docs/ml-lifecycle-sm-ocp.png)
Goal for this demo is to demonstrate the flexible integration of tools to train a model with SageMaker, serve the model on OpenShift using the NVIDIA Triton Inference engine and interact with the model using Gradio.
## Why do this?
Overall, Data science needs flexibility and IT needs standardization.
- From a development perspective, SageMaker is a robust toolkit that data scientists are familiar with from preparing data and training models.
- From an operational perspective, Red Hat OpenShift is a best-in-class enterprise Kubernetes container platform. It provides a hybrid cloud solution from private data centers to multiple cloud vendors. It makes it easier to build, operate, and scale globally, and on demand, through a familiar management interface.
- Partner and open source software easily extend Red Hat OpenShift for other AI/ML needs:
- AWS Controller for Kubernetes Operators: IAM, EC2, S3, SageMaker
- NVIDIA Triton Inference server
- and the Gradio UI software library### The Scenario
The scenario we use was to train a model that could predict suspect attributes from an unknown fingerprint.
For example, in the data center or in the field, this model could help down-select possible suspects given an unseen fingerprint.
Since we only had public data, the predictions are basic, but the possibilities are what we intend to inspire.### The demo
This demo covers several topics across the lifecycle for extending Red Hat OpenShift to perform common
data science tasks from data ingestion to inference monitoring.Training Notebook | Inference UI
:-------------------------:|:-------------------------:
![sagemaker notebook](docs/sagemaker-notebook.png) | ![gradion fingerprint user interface](docs/gradio-fingerprint-ui.png)See the Getting Started to get started.
### Built With
- [Red Hat OpenShift Self-Managed on AWS](https://www.redhat.com/en/resources/self-managed-openshift-sizing-subscription-guide)
- [AWS SageMaker Notebooks](https://aws.amazon.com/pm/sagemaker/)
- [NVIDIA Triton Inference Server](https://docs.nvidia.com/launchpad/ai/classification-openshift/latest/openshift-classification-triton-overview.html)
- [Gradio User Interface](https://gradio.app/)
- [AWS Controller for Kubernetes Operators](https://operatorhub.io/?provider=%5B%22Amazon%22%5D): IAM, EC2, S3, SageMaker
- [Hardware Acceleration](https://catalog.redhat.com/software/containers/nvidia/gpu-operator/5f9b0279ac3db90370a2128d)## Getting Started
If you have the demo installed, start in the AWS Console SageMaker Notebooks.
If not, see the Prerequisites.### Prerequisites
- [x] Red Hat OpenShift Cluster 4.10+
- [x] Cluster admin permissions
- [x] AWS Web Console access
- [x] `oc` cli installed locally
- [x] `python3.x` installed locally
- [x] `aws-cli` installed locally### Installation
```commandline
# From the browser,
# 1. Access the web console and login# 2. copy your terminal login command and token from the web console.
# From your terminal,
# 3. log into the cluster using oc login (you may need to add --insecure-skip-tls-verify=true)
oc login# 4. clone in the demo-rosa-sagemaker repo to provision the demo
git clone https://github.com/redhat-na-ssa/demo-rosa-sagemaker.git# 5. change in to the demo-rosa-sagemaker directory
cd demo-rosa-sagemaker# 6. run the scripts/bootstrap.sh
./scripts/bootstrap.sh# optional
# source ./scripts/bootstrap.sh and run commands individually, i.e.
setup_demo
delete_demo
```### Tutorial
```commandline
# From the AWS Web Console
# search for `S3` in the searchbar and navigate to the bucket where our data (sagemaker-fingerprint-data-'# search for `SageMaker` in the searchbar and go to the page
# navigate down the menu to `Notebook > Notebook Instances`
# (optional) instance the instance and lifecycle configuration
# launch the JupyterLab instance
# in jupyter, go to `notebooks` directory, open and run each notebook in order
# IMPORTANT You should only have one notebook open at a time. After you run each notebook, Restart the Kernel and Clear the output, then Close the notebook
# open, run and close the following notebooks in order:
# 00_data_exploration.ipynb
# 01_data_processing.ipynb
# 02_model_train_hand.ipynb# search for `S3` in the searchbar and navigate to the bucket where our data (sagemaker-fingerprint-data-'
# move into the folder with our model
# From the OpenShift Web Console
# navigate to the `Operators > Installed Operators` and notice the AWS operators
# navigate to the Project `models`
# go to the `Networking > Routes` menu item
# open the URL for the `gradio-client` instance and interact with the model
# under the `Routes` menu, open the URL for the `grafana` instance
# to obtain the credentials, from the OCP Web Console, click on `Workloads > Secrets`
# open the `grafana-admin-credentials` instance, copy and paste the credentials into the grafana dashboard
# go to the four-block waffle menu and click `models`
# go to `Triton Model Server` and view the dashboard metrics
# From the AWS Web Console SageMaker Notebook
# open, run and close the following notebooks in order:# 03_model_tune_hand.ipynb
# 04_model_batch_inference.ipynb
# Review the reports and the prediction.csv files saved to your scratch folder
# From the AWS Web Console
# search for `S3` in the searchbar and navigate to the bucket where our data (sagemaker-fingerprint-data-'# move into the folder with our model and review the second version of our tuned model
# From the OpenShift Web Console
# click on `Workloads > Deployments'# open the gradio-client' deplyoment instance and click on the `Environment` menu item
# notice the MODEL_REPOSITORY value that will pull the latest version of the model available for inference
# open the URL for the `gradio-client` instance and interact with the model (notice the "model_version": "2")
```
### Intended Usage
Intended to be run on Red Hat OpenShift Container Platform on AWS (self-managed). Alternatively, Red Hat OpenShift on AWS (managed).
Extend RHOCP with AWS capabilities.## Contributing
## License
## Contact
## Acknowledgements
- [Explore: Fingerprint Data Set](https://github.com/redhat-na-ssa/datasci-fingerprint.git)
- [Best-README-Template](https://github.com/othneildrew/Best-README-Template)
- [Kaggle - Sokoto Coventry Fingerprint Dataset](https://www.kaggle.com/datasets/ruizgara/socofing)
- [TensorFlow Image Classification](https://www.tensorflow.org/tutorials/images/classification#use_tensorflow_lite)
- [TensorFlow Lite Image Classification](https://www.tensorflow.org/lite/models/modify/model_maker/image_classification#simple_end-to-end_example)