Unsloth MCP Server
Unsloth MCP 服务器
Unsloth的 MCP 服务器 - 一个使 LLM 微调速度提高 2 倍且内存减少 80% 的库。
Unsloth 是什么?
Unsloth 是一个可以显著提高微调大型语言模型效率的库:
速度:与标准方法相比,微调速度提高 2 倍
内存:VRAM 使用量减少 80%,允许在消费级 GPU 上对更大的模型进行微调
上下文长度:上下文长度最多增加 13 倍(例如,80GB GPU 上的 Llama 3.3 有 89K 个令牌)
准确性:模型质量或性能没有损失
Unsloth 通过用 OpenAI 的 Triton 语言编写的自定义 CUDA 内核、优化的反向传播和动态 4 位量化实现这些改进。
Related MCP server: genpark-int8-symmetric-per-tensor-quantizer-skill
特征
针对 Llama、Mistral、Phi、Gemma 等模型进行优化微调
4 位量化,实现高效训练
扩展上下文长度支持
用于模型加载、微调和推理的简单 API
导出为各种格式(GGUF、Hugging Face 等)
快速入门
安装 Unsloth:
pip install unsloth安装并构建服务器:
cd unsloth-server npm install npm run build添加到 MCP 设置:
{ "mcpServers": { "unsloth-server": { "command": "node", "args": ["/path/to/unsloth-server/build/index.js"], "env": { "HUGGINGFACE_TOKEN": "your_token_here" // Optional }, "disabled": false, "autoApprove": [] } } }
可用工具
检查安装
验证 Unsloth 是否已正确安装在您的系统上。
参数:无
例子:
const result = await use_mcp_tool({
server_name: "unsloth-server",
tool_name: "check_installation",
arguments: {}
});列出支持的型号
获取 Unsloth 支持的所有模型的列表,包括 Llama、Mistral、Phi 和 Gemma 变体。
参数:无
例子:
const result = await use_mcp_tool({
server_name: "unsloth-server",
tool_name: "list_supported_models",
arguments: {}
});加载模型
加载具有 Unsloth 优化的预训练模型,以实现更快的推理和微调。
参数:
model_name(必需):要加载的模型的名称(例如,“unsloth/Llama-3.2-1B”)max_seq_length(可选):模型的最大序列长度(默认值:2048)load_in_4bit(可选):是否以 4 位量化加载模型(默认值:true)use_gradient_checkpointing(可选):是否使用梯度检查点来节省内存(默认值:true)
例子:
const result = await use_mcp_tool({
server_name: "unsloth-server",
tool_name: "load_model",
arguments: {
model_name: "unsloth/Llama-3.2-1B",
max_seq_length: 4096,
load_in_4bit: true
}
});微调模型
使用 LoRA/QLoRA 技术通过 Unsloth 优化对模型进行微调。
参数:
model_name(必需):需要微调的模型的名称dataset_name(必需):用于微调的数据集的名称output_dir(必需):保存微调模型的目录max_seq_length(可选):训练的最大序列长度(默认值:2048)lora_rank(可选):LoRA 微调的排名(默认值:16)lora_alpha(可选):LoRA 微调的 Alpha(默认值:16)batch_size(可选):训练的批次大小(默认值:2)gradient_accumulation_steps(可选):梯度累积步数(默认值:4)learning_rate(可选):训练的学习率(默认值:2e-4)max_steps(可选):最大训练步数(默认值:100)dataset_text_field(可选):数据集中包含文本的字段(默认值:“text”)load_in_4bit(可选):是否使用4位量化(默认值:true)
例子:
const result = await use_mcp_tool({
server_name: "unsloth-server",
tool_name: "finetune_model",
arguments: {
model_name: "unsloth/Llama-3.2-1B",
dataset_name: "tatsu-lab/alpaca",
output_dir: "./fine-tuned-model",
max_steps: 100,
batch_size: 2,
learning_rate: 2e-4
}
});生成文本
使用经过微调的 Unsloth 模型生成文本。
参数:
model_path(必需):微调模型的路径prompt(必需):提示文本生成max_new_tokens(可选):要生成的最大令牌数(默认值:256)temperature(可选):文本生成的温度(默认值:0.7)top_p(可选):文本生成的 Top-p(默认值:0.9)
例子:
const result = await use_mcp_tool({
server_name: "unsloth-server",
tool_name: "generate_text",
arguments: {
model_path: "./fine-tuned-model",
prompt: "Write a short story about a robot learning to paint:",
max_new_tokens: 512,
temperature: 0.8
}
});导出模型
将经过微调的 Unsloth 模型导出为各种格式以供部署。
参数:
model_path(必需):微调模型的路径export_format(必需):导出格式(gguf、ollama、vllm、huggingface)output_path(必需):保存导出模型的路径quantization_bits(可选):量化位(用于 GGUF 导出)(默认值:4)
例子:
const result = await use_mcp_tool({
server_name: "unsloth-server",
tool_name: "export_model",
arguments: {
model_path: "./fine-tuned-model",
export_format: "gguf",
output_path: "./exported-model.gguf",
quantization_bits: 4
}
});高级用法
自定义数据集
您可以通过正确格式化自定义数据集并将其托管在 Hugging Face 上或提供本地路径来使用它们:
const result = await use_mcp_tool({
server_name: "unsloth-server",
tool_name: "finetune_model",
arguments: {
model_name: "unsloth/Llama-3.2-1B",
dataset_name: "json",
data_files: {"train": "path/to/your/data.json"},
output_dir: "./fine-tuned-model"
}
});内存优化
对于有限硬件上的大型模型:
减少批次大小并增加梯度积累步骤
使用 4 位量化
启用梯度检查点
如果可能的话减少序列长度
故障排除
常见问题
CUDA 内存不足:减少批量大小,使用 4 位量化,或尝试更小的模型
导入错误:确保安装了正确版本的 torch、transformers 和 unsloth
未找到模型:请检查您是否正在使用受支持的模型名称或是否有权访问私有模型
版本兼容性
Python:3.10、3.11 或 3.12(不是 3.13)
CUDA:建议使用 11.8 或 12.1+
PyTorch:推荐 2.0+
性能基准
模型 | 显存 | 不懒惰的速度 | 显存减少 | 上下文长度 |
骆驼 3.3 (70B) | 80GB | 速度快 2 倍 | >75% | 13倍长 |
骆驼 3.1 (8B) | 80GB | 速度快 2 倍 | >70% | 12倍长 |
米斯特拉尔 v0.3 (7B) | 80GB | 速度快 2.2 倍 | 减少 75% | - |
要求
Python 3.10-3.12
支持 CUDA 的 NVIDIA GPU(推荐)
Node.js 和 npm
执照
Apache-2.0
Available Tools
6 toolscheck_installationB
Check if Unsloth is properly installed
Inputs: no named parameters.
export_modelB
Export a fine-tuned Unsloth model to various formats
Inputs: model_path (required), export_format (required), output_path (required), quantization_bits.
finetune_modelC
Fine-tune a model with Unsloth optimizations
Inputs: model_name (required), dataset_name (required), output_dir (required), max_seq_length, +8 more.
generate_textC
Generate text using a fine-tuned Unsloth model
Inputs: model_path (required), prompt (required), max_new_tokens, temperature, +1 more.
list_supported_modelsB
List all models supported by Unsloth
Inputs: no named parameters.
load_modelC
Load a pretrained model with Unsloth optimizations
Inputs: model_name (required), max_seq_length, load_in_4bit, use_gradient_checkpointing.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
Each tool has a clearly distinct purpose with no overlap: checking installation, listing models, loading models, fine-tuning, generating text, and exporting models. The descriptions make it unambiguous which tool to use for each step in the workflow.
All tools follow a consistent verb_noun pattern with clear, descriptive names (e.g., check_installation, export_model, finetune_model). There are no deviations in naming conventions or style mixing.
With 6 tools, this server is well-scoped for its purpose of fine-tuning and using models with Unsloth optimizations. Each tool earns its place by covering a distinct, essential operation in the model lifecycle.
The tool set provides complete coverage for the domain: from checking prerequisites and listing models, through loading, fine-tuning, and generating text, to exporting the final model. There are no obvious gaps or dead ends in the workflow.
Maintenance
Related MCP Connectors
LLM chat, text tools, image generation, editing, batch image jobs, and asynchronous video generation
Optimize your Hugging Face model for your GPU type, plus RightNow open models and data retention.
33 tools: LLM chat, summaries, translation, embeddings, speech, images. From $0.002.
Live prices, cost estimates and retirement dates for 4,100+ LLMs. Remote, no key needed.
Related MCP Servers
- AlicenseAqualityAmaintenanceOwn your sovereign AI model. Domain-specific fine-tuning of open-source LLMs and SLMs with total control and zero infrastructure hassle. Tuning Engines provides specialized tuning agents to tailor top open models to your needs — fast, predictable, fully delivered. Fine-tune Qwen, Llama, DeepSeek, Mistral, Gemma, Phi, StarCoder, and CodeLlama models from 1B to 72B parameters on your data via CLI o38184 npm6MIT
- AlicenseNot gradedqualityBmaintenanceEnables zero-dependency INT8 symmetric quantization of LLM weights and activations on a per-tensor or per-channel basis, reporting SNR and MSE reconstruction telemetry along with TTFT/TPOT latency and jitter metrics. Also exposes edge inference primitives such as PagedAttention block allocation, radix prefix caching, and speculative decoding verification through the Model Context Protocol.7MIT
- AlicenseNot gradedqualityBmaintenanceEnables MCP clients to manage LLM inference memory through virtual paged-attention KV-cache block mapping, non-contiguous physical page allocation, zero-copy fragmentation tracking, radix-trie prefix caching, INT8 quantized compute, and speculative decoding verification. It also exposes prefill and decode latency telemetry so edge deployments can be benchmarked and tuned without external dependencies.7MIT
- AlicenseNot gradedqualityNot gradedmaintenanceEnables profiling and optimizing edge and on-device LLM inference by measuring TTFT, TPOT, tokens/second throughput, and P50/P90/P99 jitter while providing standard-library primitives for quantization, paged attention, speculative decoding, and prefix caching.MIT