A scalable lightweight infrastructure for fine-tuning large language models (LLMs), vision-language models (VLMs), and embedding models. Supports LoRA, QLoRA, full fine-tuning, and reinforcement learning methods like DPO, GRPO, and PPO. Version 4.1.3 is the latest, with releases every few weeks.
pip install ms-swiftVerified import paths — ran on the pinned version, not inferred.
Basic LoRA fine-tuning with Qwen2.5. Demonstrates correct imports and usage.
Update imports: `from swift.trainers import SwiftTrainer`, `from swift.utils import get_dataset`. Use `from swift import LoRAConfig` instead of `from swift.tuners`.
If you rely on Megatron, use the new repo: https://github.com/modelscope/mcore-bridge
Check model module names via `model.named_modules()` and set `target_modules` accordingly. For most models, `["q_proj", "v_proj", "k_proj", "o_proj"]` works.
Use Python 3.10 or higher for full functionality.