An end to end pipeline for labeling, training and deployment of an object detection model.
Cloning the repository and setting up virtual environment
git clone https://github.com/ayush9818/AWS-MLops-Pipeline
cd AWS-MLops-Pipeline
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
- Labelling Objects using Sagemaker Ground Truth
- Custom Training Jobs on Sagemaker
- Deployment of custom models using Real Time Endpoint on Sagemaker
- Inference using Real Time Endpoint
Click me
-
Upload the Labelling Template Link on s3
-
Update the config : Link. Config parameters reference : Link
-
To create a labelling job, run the following commands
cd labelling python create_labelling_job.py --cfg configs/labelling_config.json
-
Now worker will be assigned a labelling job, once the worker complete the task, an output.manifest file will be written on s3 which will be used for model training.
- Use GPU base image to enable GPU support.
cd training
docker build -f Dockerfiles/AwsCPUDockerfile -t <image_name> .
- Need to add ECR FullAccessRole Policy in Sagemaker IAM Role
- Login into ECR repo using commands on ECR UI
- To tag and push the image, run the following commands
docker tag <image_name> <ecr_repo_uri>:<tag_name>
docker push <ecr_repo_uri>:<tag_name>
- Prepare a Job Config : Link. Parameters Reference : Link
- Prepare a Train Config : Link. Parameters Reference : Link
- To create a training job, run the following commands
cd AWS-MLops-Pipeline
python create_training_job.py --cfg configs/job_config.json
- Use GPU base image to enable GPU support.
cd inference
aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin 763104351884.dkr.ecr.us-east-1.amazonaws.com
docker build -f Dockerfiles/CpuDockerfile -t <image_name> .
- Need to add ECR FullAccessRole Policy in Sagemaker IAM Role
- Login into ECR repo using commands on ECR UI
- To tag and push the image, run the following commands
docker tag <image_name> <ecr_repo_uri>:<tag_name>
docker push <ecr_repo_uri>:<tag_name>
- Prepare an endpoint config : Link. Parameters Reference : Link
- To create an inference endpoint, run the following commands
cd AWS-MLops-Pipeline
python inference_resources.py --cfg configs/endpoint_config.json --action create_endpoint --endpoint-type real-time-endpoint/multi-model-endpoint/serverless-endpoint
python inference_resources.py --cfg configs/endpoint_config.json --action delete_endpoint --endpoint-type real-time-endpoint/multi-model-endpoint/serverless-endpoint
cd AWS-MLops-Pipeline
## This script enables Data Capture for Real Time Endpoints and uses Sagemaker Predictor class
python invoke_endpoint_v2.py --cfg configs/inference_config.json --endpoint-type real-time-endpoint/multi-model-endpoint/serverless-endpoint
## This script is based on invoking endpoints using Boto3 and do not enable Data Capture for Real Time Endpoints
python invoke_endpoint.py --cfg configs/inference_config.json --endpoint-type real-time-endpoint/multi-model-endpoint/serverless-endpoint