Welcome to the Azure Machine Learning: Step-by-Step Pipelining repository! π This repository is your one-stop guide to learning how to build and deploy machine learning pipelines using Azure ML. The codes are 100% reproducible and it is beginner-friendly.
Here's a quick look at the repository contents:
π¦ Repository
βββ π model
β βββ π new_model_state_dict.pth
β βββ π vocab.txt
βββ π scripts
β βββ π score.py
β βββ π script1.py
β βββ π script2.py
β βββ π script3.py
β βββ π script4.py
βββ π workspace
β βββ π dataset.csv
β βββ π env.yml
βββ πΌοΈ Pipeline_Structure.png
βββ π README.md
βββ π readme_MLOps.ipynb
- Contains pre-trained models and vocabulary files.
- π
new_model_state_dict.pth: The saved state dictionary of the model. - π
vocab.txt: Vocabulary used by the model.
- π
- Includes Python scripts for various stages of the pipeline.
- π
score.py: Script to evaluate the model's performance. - π
script1.py: First stage of the CI pipeline (e.g., data preprocessing). - π
script2.py: Second stage of the CI pipeline (e.g., model training). - π
script3.py: Third stage of CI pipeline (e.g., old and new model (the one after training) comparison). - π
script4.py: The first and only stage of the CD Pipeline that is triggered only if new model is better than the old one.
- π
- Workspace-related files like datasets and environment configurations.
- π
dataset.csv: Dataset used for training and evaluation. - π
env.yml: Conda environment file to set up dependencies.
- π
- Diagram illustrating the pipeline's structure or workflow.
- Main documentation file providing an overview of the repository.
- A Jupyter Notebook used to create this project and 100% reproducible.
Before you start, make sure you have the following installed and understand the basics:
- PyTorch: For building and training neural networks.
- NumPy: For numerical operations and data manipulation.
- Training and Testing Models: Fit models to training data and evaluate them on test data.
- API Endpoints: Deploy models as RESTful APIs for real-time inference.
Pipelines simplify and automate the machine learning lifecycle, addressing challenges like:
- Seamless Model Updates: Automate retraining and deployment without manual intervention.
- Access Control: Restrict changes to specific workflow stages.
- Scalability: Handle growing datasets and complex models.
Example: Need to deploy an updated model? Pipelines ensure the transition is smooth, avoiding downtime or conflicts.
- Set up an Azure workspace and provision compute resources (e.g., Azure Virtual Machines) for data processing and model training.
- These resources enable efficient handling of large-scale operations.
- Upload the pretrained model and
vocab.txtto the Azure workspace. - Ensure these resources are available for future training and tokenization tasks.
- Establish a secure connection to the Azure workspace using the Azure ML SDK.
- This allows seamless access to Azure resources for model management and machine learning tasks.
- Register the pretrained model within Azure ML to facilitate:
- Versioning
- Easy access
- Future training or deployment steps
- Upload the
vocab.txtfile to the workspace. - This file contains the vocabulary needed for tokenizing input data and training the model.
- Store
dataset.csvin Azure Blob Storage for easy access during preprocessing and model training. - Blob Storage ensures efficient handling of large-scale data.
- Develop
script1.pyto preprocess the dataset:- Tokenize input data
- Extract features
- Split into training (
train_x,train_y) and testing (test_x,test_y) sets
- Save the preprocessed data for use in subsequent pipeline steps.
- Create
script2.pyto fine-tune the pretrained model using the training data (train_x,train_y). - Prepare the trained model for evaluation with test data (
test_x,test_y).
- Implement
script3.pyto evaluate both old and new models using the test data (test_x,test_y). - Record performance in an output file:
True: New model performs better- Otherwise,
False
- Design a pipeline to automate:
- Model training
- Evaluation
- Comparison
- Ensure reproducibility and integrate it into a CI/CD workflow for efficient updates.
- Develop
score.pyto handle incoming data from web applications:- Tokenize text using
vocab.txt - Feed it to the trained model
- Generate predictions
- Tokenize text using
- Designed for real-time inference in production environments.
- Write
script4.pyto automate the deployment of the latest model to an Azure endpoint. - Ensure the model is ready to serve predictions via web requests.
- Build a deployment pipeline that automates:
- Model registration
- Deployment scripts
- Scaling capabilities
- Ensure efficient and seamless deployment.
- Develop the
MLOpsfunction to orchestrate:- Training pipeline
- Deployment pipeline
- By passing the dataset name as an argument, this function ensures smooth execution of the entire ML lifecycle.
β
Automation: Reduces errors and ensures reproducibility.
β
Versioning: Track datasets, models, and workflows.
β
Scalability: Handles large-scale operations efficiently.
β
Collaboration: Supports team-based workflows with access control.
- What is MLOPS? (lang:Hindi)
- Brief Idea about Devops in Azure (lang:en)
- Azure Machine Learning Documentation
- PyTorch Official Website
- NumPy Official Documentation
π Thank you for exploring this project! Let's make ML workflows efficient and scalable with Azure Pipelines.


