Skip to content

MindLab-Research/mint-doc

Repository files navigation

MinT Quickstart

Tutorial for training language models with MinT (Mind Lab Toolkit) using SFT and RL.

What's Included

  • mint_quickstart.ipynb - Complete tutorial: train a model to solve multiplication using SFT, then refine with RL
  • mint-skill/ - Migration skill for converting code from verl/TRL/OpenRLHF to MinT

Using the Migration Skill

The mint-skill/ directory contains a skill that helps AI coding agents migrate your existing training code to MinT.

Coding Agent:

cp -r mint-skill/ /path/to/your/project/.claude/skills/

Then ask Claude Code to migrate your code:

Help me migrate my verl PPO training loop to MinT

Other coding agents: Copy mint-skill/ into your agent's skills directory (consult your agent's documentation). The skill reads SKILL.md for instructions and mint_api_reference.txt for API details.

Supported frameworks: verl, TRL, OpenRLHF, custom PyTorch training loops.

Local Ask AI Setup

For the docs-side Ask AI assistant, keep the Novita key in a local server env file instead of a markdown note.

cp .env.example .env.local

Then fill in NOVITA_API_KEY in mint-doc-alpha/.env.local. For a local production-style run, load that file before starting the docs app:

set -a
source .env.local
set +a
npm start -- --hostname 0.0.0.0 --port 3200

The key stays server-side and .env.local is already ignored by git.

Quick Start

Requirements: Python >= 3.11

pip install git+https://github.com/MindLab-Research/mindlab-toolkit.git python-dotenv matplotlib numpy

Create .env:

MINT_API_KEY=sk-your-api-key-here

Use the MinT endpoint that matches your region:

  • Mainland China: https://mint-cn.macaron.xin/
  • Outside Mainland China: https://mint.macaron.xin/

Open mint_quickstart.ipynb and run the cells.

Using Tinker SDK

If you have existing code using the Tinker SDK, you can use it to connect to MinT by setting these environment variables:

pip install tinker
TINKER_BASE_URL=<your-region-endpoint>
TINKER_API_KEY=<your-mint-api-key>

Use the MinT endpoint that matches your region:

  • Mainland China: https://mint-cn.macaron.xin/
  • Outside Mainland China: https://mint.macaron.xin/

Note: Use your MinT API key (starts with sk-). Current mindlab-toolkit depends on tinker>=0.15.0 and applies MinT compatibility patches when you import mint. Prefer import mint; if you need to keep import tinker, import mint first in the same process before constructing Tinker clients.

Tutorial Overview

Stage Method Loss Function Goal
1 SFT cross_entropy Learn multiplication from labeled examples
2 RL importance_sampling Refine with reward signals

Key API:

import mint

service_client = mint.ServiceClient()
training_client = service_client.create_lora_training_client(base_model="Qwen/Qwen3-0.6B", rank=16)

# Train
training_client.forward_backward(data, loss_fn="cross_entropy").result()
training_client.optim_step(types.AdamParams(learning_rate=5e-5)).result()

# Checkpoint
checkpoint = training_client.save_state(name="my-model").result()

# Inference
sampling_client = training_client.save_weights_and_get_sampling_client(name="my-model")
sampling_client.sample(prompt, num_samples=1, sampling_params=params).result()

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages