Skip to content

EdatozTraining/MLModel1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

MLModel1

First model to experment MLOps, CI CD and several other Operative featuers

]You can set up a completely free CI/CD pipeline for your ML model using GitHub Actions, and it's a great way to automate testing, training, and deployment without paying for third-party services.

Here’s a step-by-step guide to set up CI/CD for your ML project:

  1. Pre-requisites: A GitHub repository with your ML model code.

Docker or Python-based project (e.g., requirements.txt, Dockerfile, etc.).

Optional: Deployment target (e.g., Hugging Face, AWS S3, Google Cloud, etc.).

  1. Basic Folder Structure Example: bash Copy Edit /my-ml-project │ ├── .github/workflows/ci-cd.yml # GitHub Actions pipeline ├── requirements.txt # Python dependencies ├── train.py # Model training script ├── test_model.py # Tests for model ├── model.pkl # Trained model artifact (after training) └── README.md
  2. Create GitHub Actions Workflow: Create a file at:

bash Copy Edit .github/workflows/ci-cd.yml Minimal Example: yaml Copy Edit name: ML CI/CD Pipeline

on: [push, pull_request]

jobs: build-test-train: runs-on: ubuntu-latest

steps:
- name: Checkout code
  uses: actions/checkout@v4

- name: Set up Python
  uses: actions/setup-python@v5
  with:
    python-version: '3.10'

- name: Install dependencies
  run: |
    pip install --upgrade pip
    pip install -r requirements.txt

- name: Run unit tests
  run: |
    pytest test_model.py

- name: Train model
  run: |
    python train.py

- name: Upload model artifact
  uses: actions/upload-artifact@v4
  with:
    name: trained-model
    path: model.pkl
  1. Explanation: ✅ Trigger: Runs on every push or pull_request. ✅ Steps:

Checks out the repo.

Sets up Python.

Installs dependencies from requirements.txt.

Runs unit tests (pytest recommended).

Trains the ML model.

Uploads the trained model as an artifact (you can later download it from GitHub).

  1. Optional: Add Deployment (Free Options) You can extend this pipeline to deploy:

To Hugging Face Hub (free)

To GitHub Pages (for models with frontends)

To Google Drive/S3 (via CLI)

Or use Streamlit Community Cloud to deploy ML apps for free.

Example for Hugging Face deployment:

yaml Copy Edit - name: Upload to Hugging Face Hub run: | pip install huggingface_hub python upload_to_huggingface.py # script using huggingface_hub APIs 6. Free Tier Limits: GitHub Actions (free plan):

2000 mins/month for public + private repos.

Unlimited for public repos.

Ubuntu runners are free.

  1. (Optional) Notify on Failure: Add Slack/Email notifications for CI/CD failures:

yaml Copy Edit - name: Notify via Slack uses: slackapi/slack-github-action@v1.24.0 with: payload: '{"text":"CI/CD Pipeline Failed 😢"}'

About

First model to experment MLOps, CI CD and several other Operative featuers

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages