🤗 ML Intern: Your Autonomous ML Engineer

An open-source ML engineer that reads papers, trains models, and ships ML models using the Hugging Face ecosystem

9,710 Stars ⭐
1,034 Forks 🍴
44 Subscribers 📧
Python Language 🐍

Powerful Features

📚

Auto-Research

Deep access to docs, papers, datasets, and cloud compute. Researches ML topics autonomously.

🤖

Model Training

Automatically trains models with optimized hyperparameters and proper validation.

🚀

Ship Models

Deploys trained models to production environments with proper packaging and documentation.

🔧

Code Generation

Writes high-quality ML code using the Hugging Face ecosystem best practices.

🌐

Multi-Model Support

Supports Claude, GPT, local models, and Hugging Face router models like MiniMax, Kimi, GLM, DeepSeek.

📊

Session Tracking

Auto-uploads sessions to your private Hugging Face dataset for easy review and debugging.

Quick Start Guide

Installation

git clone git@github.com:huggingface/ml-intern.git
cd ml-intern
uv sync
uv tool install -e .

Usage

# Interactive mode
ml-intern

# Headless mode (single prompt)
ml-intern "fine-tune llama on my dataset"

# Different models
ml-intern --model anthropic/claude-opus-4-7 "your prompt"
ml-intern --model openai/gpt-5.5 "your prompt"
ml-intern --model ollama/llama3.1:8b "your prompt"

Environment Setup

# Create .env file
ANTHROPIC_API_KEY=
OPENAI_API_KEY=
LOCAL_LLM_BASE_URL=http://localhost:8000
HF_TOKEN=
GITHUB_TOKEN=

Architecture Overview

┌─────────────────────────────────────────────────────────────┐
│                         User/CLI                            │
└────────────┬─────────────────────────────────────┬──────────┘
             │ Operations                          │ Events
             ↓ (user_input, exec_approval,         ↑
      submission_queue  interrupt, compact, ...)  event_queue
             │                                          │
             ↓                                          │
┌────────────────────────────────────────────────────┐  │
│            submission_loop (agent_loop.py)         │  │
│  ┌──────────────────────────────────────────────┐  │  │
│  │  1. Receive Operation from queue             │  │  │
│  │  2. Route to handler (run_agent/compact/...) │  │  │
│  └──────────────────────────────────────────────┘  │  │
│                      ↓                             │  │
│  ┌──────────────────────────────────────────────┐  │  │
│  │         Handlers.run_agent()                 │  ├──┤
│  │                                              │  │  │
│  │  ┌────────────────────────────────────────┐  │  │  │
│  │  │  Agentic Loop (max 300 iterations)     │  │  │  │
│  │  │                                        │  │  │  │
│  │  │  ┌────────────────────────────────────┐  │  │  │  │
│  │  │  │ Session & Context Management       │  │  │  │  │
│  │  │  │ • Message history                  │  │  │  │  │
│  │  │  │ • Auto-compaction (170k)           │  │  │  │  │
│  │  │  │ • Session upload to HF             │  │  │  │  │
│  │  │  └────────────────────────────────────┘  │  │  │  │
│  │  │                                          │  │  │  │
│  │  │  ┌────────────────────────────────────┐  │  │  │  │
│  │  │  │ ToolRouter                         │  │  │  │  │
│  │  │  │  ├─ HF docs & research             │  │  │  │  │
│  │  │  │  ├─ HF repos, datasets, jobs       │  │  │  │  │
│  │  │  │  ├─ GitHub code search             │  │  │  │  │
│  │  │  │  ├─ Sandbox & local tools          │  │  │  │  │
│  │  │  │  └─ Planning & MCP servers         │  │  │  │  │
│  │  │  └────────────────────────────────────┘  │  │  │  │
│  │  └──────────────────────────────────────────┘  │  │  │
│  └──────────────────────────────────────────────┘  │  │
└────────────────────────────────────────────────────┴──┘
                
91 Open Issues 🐛
Apache 2.0 License 📄
9,710 Watchers 👀

Ready to Automate Your ML Workflow?

Join thousands of developers using ML Intern to accelerate their machine learning projects