[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-hiyouga--LlamaFactory":3,"tool-hiyouga--LlamaFactory":61},[4,18,26,36,44,53],{"id":5,"name":6,"github_repo":7,"description_zh":8,"stars":9,"difficulty_score":10,"last_commit_at":11,"category_tags":12,"status":17},4358,"openclaw","openclaw\u002Fopenclaw","OpenClaw 是一款专为个人打造的本地化 AI 助手，旨在让你在自己的设备上拥有完全可控的智能伙伴。它打破了传统 AI 助手局限于特定网页或应用的束缚，能够直接接入你日常使用的各类通讯渠道，包括微信、WhatsApp、Telegram、Discord、iMessage 等数十种平台。无论你在哪个聊天软件中发送消息，OpenClaw 都能即时响应，甚至支持在 macOS、iOS 和 Android 设备上进行语音交互，并提供实时的画布渲染功能供你操控。\n\n这款工具主要解决了用户对数据隐私、响应速度以及“始终在线”体验的需求。通过将 AI 部署在本地，用户无需依赖云端服务即可享受快速、私密的智能辅助，真正实现了“你的数据，你做主”。其独特的技术亮点在于强大的网关架构，将控制平面与核心助手分离，确保跨平台通信的流畅性与扩展性。\n\nOpenClaw 非常适合希望构建个性化工作流的技术爱好者、开发者，以及注重隐私保护且不愿被单一生态绑定的普通用户。只要具备基础的终端操作能力（支持 macOS、Linux 及 Windows WSL2），即可通过简单的命令行引导完成部署。如果你渴望拥有一个懂你",349277,3,"2026-04-06T06:32:30",[13,14,15,16],"Agent","开发框架","图像","数据工具","ready",{"id":19,"name":20,"github_repo":21,"description_zh":22,"stars":23,"difficulty_score":10,"last_commit_at":24,"category_tags":25,"status":17},3808,"stable-diffusion-webui","AUTOMATIC1111\u002Fstable-diffusion-webui","stable-diffusion-webui 是一个基于 Gradio 构建的网页版操作界面，旨在让用户能够轻松地在本地运行和使用强大的 Stable Diffusion 图像生成模型。它解决了原始模型依赖命令行、操作门槛高且功能分散的痛点，将复杂的 AI 绘图流程整合进一个直观易用的图形化平台。\n\n无论是希望快速上手的普通创作者、需要精细控制画面细节的设计师，还是想要深入探索模型潜力的开发者与研究人员，都能从中获益。其核心亮点在于极高的功能丰富度：不仅支持文生图、图生图、局部重绘（Inpainting）和外绘（Outpainting）等基础模式，还独创了注意力机制调整、提示词矩阵、负向提示词以及“高清修复”等高级功能。此外，它内置了 GFPGAN 和 CodeFormer 等人脸修复工具，支持多种神经网络放大算法，并允许用户通过插件系统无限扩展能力。即使是显存有限的设备，stable-diffusion-webui 也提供了相应的优化选项，让高质量的 AI 艺术创作变得触手可及。",162132,"2026-04-05T11:01:52",[14,15,13],{"id":27,"name":28,"github_repo":29,"description_zh":30,"stars":31,"difficulty_score":32,"last_commit_at":33,"category_tags":34,"status":17},1381,"everything-claude-code","affaan-m\u002Feverything-claude-code","everything-claude-code 是一套专为 AI 编程助手（如 Claude Code、Codex、Cursor 等）打造的高性能优化系统。它不仅仅是一组配置文件，而是一个经过长期实战打磨的完整框架，旨在解决 AI 代理在实际开发中面临的效率低下、记忆丢失、安全隐患及缺乏持续学习能力等核心痛点。\n\n通过引入技能模块化、直觉增强、记忆持久化机制以及内置的安全扫描功能，everything-claude-code 能显著提升 AI 在复杂任务中的表现，帮助开发者构建更稳定、更智能的生产级 AI 代理。其独特的“研究优先”开发理念和针对 Token 消耗的优化策略，使得模型响应更快、成本更低，同时有效防御潜在的攻击向量。\n\n这套工具特别适合软件开发者、AI 研究人员以及希望深度定制 AI 工作流的技术团队使用。无论您是在构建大型代码库，还是需要 AI 协助进行安全审计与自动化测试，everything-claude-code 都能提供强大的底层支持。作为一个曾荣获 Anthropic 黑客大奖的开源项目，它融合了多语言支持与丰富的实战钩子（hooks），让 AI 真正成长为懂上",146793,2,"2026-04-08T23:32:35",[14,13,35],"语言模型",{"id":37,"name":38,"github_repo":39,"description_zh":40,"stars":41,"difficulty_score":32,"last_commit_at":42,"category_tags":43,"status":17},2271,"ComfyUI","Comfy-Org\u002FComfyUI","ComfyUI 是一款功能强大且高度模块化的视觉 AI 引擎，专为设计和执行复杂的 Stable Diffusion 图像生成流程而打造。它摒弃了传统的代码编写模式，采用直观的节点式流程图界面，让用户通过连接不同的功能模块即可构建个性化的生成管线。\n\n这一设计巧妙解决了高级 AI 绘图工作流配置复杂、灵活性不足的痛点。用户无需具备编程背景，也能自由组合模型、调整参数并实时预览效果，轻松实现从基础文生图到多步骤高清修复等各类复杂任务。ComfyUI 拥有极佳的兼容性，不仅支持 Windows、macOS 和 Linux 全平台，还广泛适配 NVIDIA、AMD、Intel 及苹果 Silicon 等多种硬件架构，并率先支持 SDXL、Flux、SD3 等前沿模型。\n\n无论是希望深入探索算法潜力的研究人员和开发者，还是追求极致创作自由度的设计师与资深 AI 绘画爱好者，ComfyUI 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",108111,"2026-04-08T11:23:26",[14,15,13],{"id":45,"name":46,"github_repo":47,"description_zh":48,"stars":49,"difficulty_score":32,"last_commit_at":50,"category_tags":51,"status":17},4721,"markitdown","microsoft\u002Fmarkitdown","MarkItDown 是一款由微软 AutoGen 团队打造的轻量级 Python 工具，专为将各类文件高效转换为 Markdown 格式而设计。它支持 PDF、Word、Excel、PPT、图片（含 OCR）、音频（含语音转录）、HTML 乃至 YouTube 链接等多种格式的解析，能够精准提取文档中的标题、列表、表格和链接等关键结构信息。\n\n在人工智能应用日益普及的今天，大语言模型（LLM）虽擅长处理文本，却难以直接读取复杂的二进制办公文档。MarkItDown 恰好解决了这一痛点，它将非结构化或半结构化的文件转化为模型“原生理解”且 Token 效率极高的 Markdown 格式，成为连接本地文件与 AI 分析 pipeline 的理想桥梁。此外，它还提供了 MCP（模型上下文协议）服务器，可无缝集成到 Claude Desktop 等 LLM 应用中。\n\n这款工具特别适合开发者、数据科学家及 AI 研究人员使用，尤其是那些需要构建文档检索增强生成（RAG）系统、进行批量文本分析或希望让 AI 助手直接“阅读”本地文件的用户。虽然生成的内容也具备一定可读性，但其核心优势在于为机器",93400,"2026-04-06T19:52:38",[52,14],"插件",{"id":54,"name":55,"github_repo":56,"description_zh":57,"stars":58,"difficulty_score":10,"last_commit_at":59,"category_tags":60,"status":17},4487,"LLMs-from-scratch","rasbt\u002FLLMs-from-scratch","LLMs-from-scratch 是一个基于 PyTorch 的开源教育项目，旨在引导用户从零开始一步步构建一个类似 ChatGPT 的大型语言模型（LLM）。它不仅是同名技术著作的官方代码库，更提供了一套完整的实践方案，涵盖模型开发、预训练及微调的全过程。\n\n该项目主要解决了大模型领域“黑盒化”的学习痛点。许多开发者虽能调用现成模型，却难以深入理解其内部架构与训练机制。通过亲手编写每一行核心代码，用户能够透彻掌握 Transformer 架构、注意力机制等关键原理，从而真正理解大模型是如何“思考”的。此外，项目还包含了加载大型预训练权重进行微调的代码，帮助用户将理论知识延伸至实际应用。\n\nLLMs-from-scratch 特别适合希望深入底层原理的 AI 开发者、研究人员以及计算机专业的学生。对于不满足于仅使用 API，而是渴望探究模型构建细节的技术人员而言，这是极佳的学习资源。其独特的技术亮点在于“循序渐进”的教学设计：将复杂的系统工程拆解为清晰的步骤，配合详细的图表与示例，让构建一个虽小但功能完备的大模型变得触手可及。无论你是想夯实理论基础，还是为未来研发更大规模的模型做准备",90106,"2026-04-06T11:19:32",[35,15,13,14],{"id":62,"github_repo":63,"name":64,"description_en":65,"description_zh":66,"ai_summary_zh":67,"readme_en":68,"readme_zh":69,"quickstart_zh":70,"use_case_zh":71,"hero_image_url":72,"owner_login":73,"owner_name":74,"owner_avatar_url":75,"owner_bio":76,"owner_company":77,"owner_location":78,"owner_email":79,"owner_twitter":80,"owner_website":81,"owner_url":82,"languages":83,"stars":96,"forks":97,"last_commit_at":98,"license":99,"difficulty_score":10,"env_os":100,"env_gpu":101,"env_ram":102,"env_deps":103,"category_tags":116,"github_topics":117,"view_count":136,"oss_zip_url":81,"oss_zip_packed_at":81,"status":17,"created_at":137,"updated_at":138,"faqs":139,"releases":169},5730,"hiyouga\u002FLlamaFactory","LlamaFactory","Unified Efficient Fine-Tuning of 100+ LLMs & VLMs (ACL 2024)","LlamaFactory 是一个专为大语言模型（LLM）和视觉语言模型（VLM）打造的高效微调框架，旨在让模型定制变得简单快捷。它统一支持超过 100 种主流开源模型的训练，无论是 LLaMA、Qwen 还是多模态模型，都能在一个平台上一站式完成。\n\n过去，微调大模型往往面临环境配置复杂、代码门槛高、资源消耗大等难题。LlamaFactory 通过提供零代码的命令行工具和直观的 Web 界面（LLaMA Board），极大地降低了操作难度，让用户无需深入底层代码即可轻松启动训练任务。同时，它在显存优化和训练速度上进行了深度打磨，支持多种高效微调算法，显著减少了硬件资源需求。\n\n这款工具非常适合 AI 开发者、研究人员以及希望将大模型应用于特定场景的企业团队使用。无论你是想快速验证算法的研究者，还是需要定制行业专属模型的工程师，甚至是希望通过图形界面入门大模型的学生，都能从中受益。其独特的亮点在于广泛的模型兼容性、对国产算力（如华为昇腾 NPU）的良好支持，以及被亚马逊、英伟达等巨头认可的稳定性。借助 LlamaFactory，你可以更专注于业务逻辑与数据本身，高效打造属于自己的智能模型","LlamaFactory 是一个专为大语言模型（LLM）和视觉语言模型（VLM）打造的高效微调框架，旨在让模型定制变得简单快捷。它统一支持超过 100 种主流开源模型的训练，无论是 LLaMA、Qwen 还是多模态模型，都能在一个平台上一站式完成。\n\n过去，微调大模型往往面临环境配置复杂、代码门槛高、资源消耗大等难题。LlamaFactory 通过提供零代码的命令行工具和直观的 Web 界面（LLaMA Board），极大地降低了操作难度，让用户无需深入底层代码即可轻松启动训练任务。同时，它在显存优化和训练速度上进行了深度打磨，支持多种高效微调算法，显著减少了硬件资源需求。\n\n这款工具非常适合 AI 开发者、研究人员以及希望将大模型应用于特定场景的企业团队使用。无论你是想快速验证算法的研究者，还是需要定制行业专属模型的工程师，甚至是希望通过图形界面入门大模型的学生，都能从中受益。其独特的亮点在于广泛的模型兼容性、对国产算力（如华为昇腾 NPU）的良好支持，以及被亚马逊、英伟达等巨头认可的稳定性。借助 LlamaFactory，你可以更专注于业务逻辑与数据本身，高效打造属于自己的智能模型。","![# LLaMA Factory](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fhiyouga_LlamaFactory_readme_4fc78d1daa24.png)\n\n[![GitHub Repo stars](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fstars\u002Fhiyouga\u002FLLaMA-Factory?style=social)](https:\u002F\u002Fgithub.com\u002Fhiyouga\u002FLLaMA-Factory\u002Fstargazers)\n[![GitHub last commit](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Flast-commit\u002Fhiyouga\u002FLLaMA-Factory)](https:\u002F\u002Fgithub.com\u002Fhiyouga\u002FLLaMA-Factory\u002Fcommits\u002Fmain)\n[![GitHub contributors](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fcontributors\u002Fhiyouga\u002FLLaMA-Factory?color=orange)](https:\u002F\u002Fgithub.com\u002Fhiyouga\u002FLLaMA-Factory\u002Fgraphs\u002Fcontributors)\n[![GitHub workflow](https:\u002F\u002Fgithub.com\u002Fhiyouga\u002FLLaMA-Factory\u002Factions\u002Fworkflows\u002Ftests.yml\u002Fbadge.svg)](https:\u002F\u002Fgithub.com\u002Fhiyouga\u002FLLaMA-Factory\u002Factions\u002Fworkflows\u002Ftests.yml)\n[![PyPI](https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fv\u002Fllamafactory)](https:\u002F\u002Fpypi.org\u002Fproject\u002Fllamafactory\u002F)\n[![Citation](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fcitation-1000+-green)](https:\u002F\u002Fscholar.google.com\u002Fscholar?cites=12620864006390196564)\n[![Docker Pulls](https:\u002F\u002Fimg.shields.io\u002Fdocker\u002Fpulls\u002Fhiyouga\u002Fllamafactory)](https:\u002F\u002Fhub.docker.com\u002Fr\u002Fhiyouga\u002Fllamafactory\u002Ftags)\n\n[![Twitter](https:\u002F\u002Fimg.shields.io\u002Ftwitter\u002Ffollow\u002Fllamafactory_ai)](https:\u002F\u002Ftwitter.com\u002Fllamafactory_ai)\n[![Discord](assets\u002Fthirdparty\u002Fdiscord.svg)](https:\u002F\u002Fdiscord.gg\u002FrKfvV9r9FK)\n[![WeChat](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FWeChat-User%20Group-blue?logo=wechat)](https:\u002F\u002Fgithub.com\u002Fhiyouga\u002Fllamafactory-community)\n[![Blog](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FHugo-Official%20Blog-blue?logo=hugo)](https:\u002F\u002Fblog.llamafactory.net\u002Fen\u002F)\n\n[![Open in Colab](assets\u002Fthirdparty\u002Fcolab.svg)](https:\u002F\u002Fcolab.research.google.com\u002Fdrive\u002F1eRTPn37ltBbYsISy9Aw2NuI2Aq5CQrD9?usp=sharing)\n[![Open in DSW](assets\u002Fthirdparty\u002Fdsw.svg)](https:\u002F\u002Fgallery.pai-ml.com\u002F#\u002Fpreview\u002FdeepLearning\u002Fnlp\u002Fllama_factory)\n[![Open in Lab4ai](assets\u002Fthirdparty\u002Flab4ai.svg)](https:\u002F\u002Fwww.lab4ai.cn\u002Fcourse\u002Fdetail?id=7c13e60f6137474eb40f6fd3983c0f46&utm_source=LLaMA-Factory)\n[![Open in Online](assets\u002Fthirdparty\u002Fonline.svg)](https:\u002F\u002Fwww.llamafactory.com.cn\u002F?utm_source=LLaMA-Factory)\n[![Open in Spaces](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002F🤗-Open%20in%20Spaces-blue)](https:\u002F\u002Fhuggingface.co\u002Fspaces\u002Fhiyouga\u002FLLaMA-Board)\n[![Open in Studios](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FModelScope-Open%20in%20Studios-blue)](https:\u002F\u002Fmodelscope.cn\u002Fstudios\u002Fhiyouga\u002FLLaMA-Board)\n[![Open in Novita](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FNovita-Deploy%20Template-blue)](https:\u002F\u002Fnovita.ai\u002Ftemplates-library\u002F105981?sharer=88115474-394e-4bda-968e-b88e123d0c47)\n\n### Used by [Amazon](https:\u002F\u002Faws.amazon.com\u002Fcn\u002Fblogs\u002Fmachine-learning\u002Fhow-apoidea-group-enhances-visual-information-extraction-from-banking-documents-with-multimodal-models-using-llama-factory-on-amazon-sagemaker-hyperpod\u002F), [NVIDIA](https:\u002F\u002Fdeveloper.nvidia.com\u002Frtx\u002Fai-toolkit), [Aliyun](https:\u002F\u002Fhelp.aliyun.com\u002Fzh\u002Fpai\u002Fuse-cases\u002Ffine-tune-a-llama-3-model-with-llama-factory), etc.\n\n\u003Cdiv align=\"center\" markdown=\"1\">\n\n### Supporters ❤️\n\n| \u003Cdiv style=\"text-align: center;\">\u003Ca href=\"https:\u002F\u002Fwarp.dev\u002Fllama-factory\">\u003Cimg alt=\"Warp sponsorship\" width=\"400\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fhiyouga_LlamaFactory_readme_39ad7a71b3f4.jpg\">\u003C\u002Fa>\u003Cbr>\u003Ca href=\"https:\u002F\u002Fwarp.dev\u002Fllama-factory\" style=\"font-size:larger;\">Warp, the agentic terminal for developers\u003C\u002Fa>\u003Cbr>\u003Ca href=\"https:\u002F\u002Fwarp.dev\u002Fllama-factory\">Available for MacOS, Linux, & Windows\u003C\u002Fa> | \u003Ca href=\"https:\u002F\u002Fserpapi.com\">\u003Cimg alt=\"SerpAPI sponsorship\" width=\"250\" src=\"assets\u002Fsponsors\u002Fserpapi.svg\"> \u003C\u002Fa> |\n| ---- | ---- |\n\n----\n\n### Easily fine-tune 100+ large language models with zero-code [CLI](#quickstart) and [Web UI](#fine-tuning-with-llama-board-gui-powered-by-gradio)\n\n![GitHub Trend](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fhiyouga_LlamaFactory_readme_4a68feb902da.png)\n\n\u003C\u002Fdiv>\n\n👋 Join our [WeChat](https:\u002F\u002Fgithub.com\u002Fhiyouga\u002Fllamafactory-community\u002Fblob\u002Fmain\u002Fwechat\u002Fmain.jpg), [NPU](https:\u002F\u002Fgithub.com\u002Fhiyouga\u002Fllamafactory-community\u002Fblob\u002Fmain\u002Fwechat\u002Fnpu.jpg), [Lab4AI](https:\u002F\u002Fgithub.com\u002Fhiyouga\u002Fllamafactory-community\u002Fblob\u002Fmain\u002Fwechat\u002Flab4ai.jpg), [LLaMA Factory Online](https:\u002F\u002Fgithub.com\u002Fhiyouga\u002Fllamafactory-community\u002Fblob\u002Fmain\u002Fwechat\u002Fonline.jpg) user group.\n\n\\[ English | [中文](README_zh.md) \\]\n\n**Fine-tuning a large language model can be easy as...**\n\nhttps:\u002F\u002Fgithub.com\u002Fuser-attachments\u002Fassets\u002F3991a3a8-4276-4d30-9cab-4cb0c4b9b99e\n\nStart local training:\n- Please refer to [usage](#getting-started)\n\nStart cloud training:\n- **Colab (free)**: https:\u002F\u002Fcolab.research.google.com\u002Fdrive\u002F1eRTPn37ltBbYsISy9Aw2NuI2Aq5CQrD9?usp=sharing\n- **PAI-DSW (free trial)**: https:\u002F\u002Fgallery.pai-ml.com\u002F#\u002Fpreview\u002FdeepLearning\u002Fnlp\u002Fllama_factory\n- **LLaMA Factory Online**: https:\u002F\u002Fwww.llamafactory.com.cn\u002F?utm_source=LLaMA-Factory\n- **Alaya NeW (cloud GPU deal)**: https:\u002F\u002Fdocs.alayanew.com\u002Fdocs\u002Fdocuments\u002FuseGuide\u002FLLaMAFactory\u002Fmutiple\u002F?utm_source=LLaMA-Factory\n\nRead technical notes:\n- **Documentation (WIP)**: https:\u002F\u002Fllamafactory.readthedocs.io\u002Fen\u002Flatest\u002F\n- **Documentation (AMD GPU)**: https:\u002F\u002Frocm.docs.amd.com\u002Fprojects\u002Fai-developer-hub\u002Fen\u002Flatest\u002Fnotebooks\u002Ffine_tune\u002Fllama_factory_llama3.html\n- **Official Blog**: https:\u002F\u002Fblog.llamafactory.net\u002Fen\u002F\n- **Official Course**: https:\u002F\u002Fwww.lab4ai.cn\u002Fcourse\u002Fdetail?id=7c13e60f6137474eb40f6fd3983c0f46&utm_source=LLaMA-Factory\n\n> [!NOTE]\n> Except for the above links, all other websites are unauthorized third-party websites. Please carefully use them.\n\n## Table of Contents\n\n- [Features](#features)\n- [Blogs](#blogs)\n- [Changelog](#changelog)\n- [Supported Models](#supported-models)\n- [Supported Training Approaches](#supported-training-approaches)\n- [Provided Datasets](#provided-datasets)\n- [Requirement](#requirement)\n- [Getting Started](#getting-started)\n  - [Installation](#installation)\n  - [Data Preparation](#data-preparation)\n  - [Quickstart](#quickstart)\n  - [Fine-Tuning with LLaMA Board GUI](#fine-tuning-with-llama-board-gui-powered-by-gradio)\n  - [LLaMA Factory Online](#llama-factory-online)\n  - [Build Docker](#build-docker)\n  - [Deploy with OpenAI-style API and vLLM](#deploy-with-openai-style-api-and-vllm)\n  - [Download from ModelScope Hub](#download-from-modelscope-hub)\n  - [Download from Modelers Hub](#download-from-modelers-hub)\n  - [Use W&B Logger](#use-wb-logger)\n  - [Use SwanLab Logger](#use-swanlab-logger)\n- [Projects using LLaMA Factory](#projects-using-llama-factory)\n- [License](#license)\n- [Citation](#citation)\n- [Acknowledgement](#acknowledgement)\n\n## Features\n\n- **Various models**: LLaMA, LLaVA, Mistral, Mixtral-MoE, Qwen3, Qwen3-VL, DeepSeek, Gemma, GLM, Phi, etc.\n- **Integrated methods**: (Continuous) pre-training, (multimodal) supervised fine-tuning, reward modeling, PPO, DPO, KTO, ORPO, etc.\n- **Scalable resources**: 16-bit full-tuning, freeze-tuning, LoRA and 2\u002F3\u002F4\u002F5\u002F6\u002F8-bit QLoRA via AQLM\u002FAWQ\u002FGPTQ\u002FLLM.int8\u002FHQQ\u002FEETQ.\n- **Advanced algorithms**: [GaLore](https:\u002F\u002Fgithub.com\u002Fjiaweizzhao\u002FGaLore), [BAdam](https:\u002F\u002Fgithub.com\u002FLedzy\u002FBAdam), [APOLLO](https:\u002F\u002Fgithub.com\u002Fzhuhanqing\u002FAPOLLO), [Adam-mini](https:\u002F\u002Fgithub.com\u002Fzyushun\u002FAdam-mini), [Muon](https:\u002F\u002Fgithub.com\u002FKellerJordan\u002FMuon), [OFT](https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Fpeft\u002Ftree\u002Fmain\u002Fsrc\u002Fpeft\u002Ftuners\u002Foft), DoRA, LongLoRA, LLaMA Pro, Mixture-of-Depths, LoRA+, LoftQ and PiSSA.\n- **Practical tricks**: [FlashAttention-2](https:\u002F\u002Fgithub.com\u002FDao-AILab\u002Fflash-attention), [Unsloth](https:\u002F\u002Fgithub.com\u002Funslothai\u002Funsloth), [Liger Kernel](https:\u002F\u002Fgithub.com\u002Flinkedin\u002FLiger-Kernel), [KTransformers](https:\u002F\u002Fgithub.com\u002Fkvcache-ai\u002Fktransformers\u002F), RoPE scaling, NEFTune and rsLoRA.\n- **Wide tasks**: Multi-turn dialogue, tool using, image understanding, visual grounding, video recognition, audio understanding, etc.\n- **Experiment monitors**: LlamaBoard, TensorBoard, Wandb, MLflow, [SwanLab](https:\u002F\u002Fgithub.com\u002FSwanHubX\u002FSwanLab), etc.\n- **Faster inference**: OpenAI-style API, Gradio UI and CLI with [vLLM worker](https:\u002F\u002Fgithub.com\u002Fvllm-project\u002Fvllm) or [SGLang worker](https:\u002F\u002Fgithub.com\u002Fsgl-project\u002Fsglang).\n\n### Day-N Support for Fine-Tuning Cutting-Edge Models\n\n| Support Date | Model Name                                                           |\n| ------------ | -------------------------------------------------------------------- |\n| Day 0        | Qwen3 \u002F Qwen2.5-VL \u002F Gemma 3 \u002F GLM-4.1V \u002F InternLM 3 \u002F MiniCPM-o-2.6 |\n| Day 1        | Llama 3 \u002F GLM-4 \u002F Mistral Small \u002F PaliGemma2 \u002F Llama 4               |\n\n## Blogs\n\n> [!TIP]\n> Now we have a dedicated blog for LLaMA Factory!\n>\n> Website: https:\u002F\u002Fblog.llamafactory.net\u002Fen\u002F\n\n- 💡 [KTransformers Fine-Tuning × LLaMA Factory: Fine-tuning 1000 Billion models with 2 4090-GPU + CPU](https:\u002F\u002Fblog.llamafactory.net\u002Fen\u002Fposts\u002Fktransformers\u002F) (English)\n- 💡 [Easy Dataset × LLaMA Factory: Enabling LLMs to Efficiently Learn Domain Knowledge](https:\u002F\u002Fbuaa-act.feishu.cn\u002Fwiki\u002FGVzlwYcRFiR8OLkHbL6cQpYin7g) (English)\n- [Fine-tune a mental health LLM using LLaMA-Factory](https:\u002F\u002Fwww.lab4ai.cn\u002Fproject\u002Fdetail?id=25cce32ec131497b9e06a93336a0817f&type=project&utm_source=LLaMA-Factory) (Chinese)\n- [Fine-tune GPT-OSS for Role-Playing using LLaMA-Factory](https:\u002F\u002Fdocs.llamafactory.com.cn\u002Fdocs\u002Fdocuments\u002Fbest-practice\u002Fgptroleplay\u002F?utm_source=LLaMA-Factory) (Chinese)\n- [A One-Stop Code-Free Model Reinforcement Learning and Deployment Platform based on LLaMA-Factory and EasyR1](https:\u002F\u002Faws.amazon.com\u002Fcn\u002Fblogs\u002Fchina\u002Fbuilding-llm-model-hub-based-on-llamafactory-and-easyr1\u002F) (Chinese)\n- [How Apoidea Group enhances visual information extraction from banking documents with multimodal models using LLaMA-Factory on Amazon SageMaker HyperPod](https:\u002F\u002Faws.amazon.com\u002Fcn\u002Fblogs\u002Fmachine-learning\u002Fhow-apoidea-group-enhances-visual-information-extraction-from-banking-documents-with-multimodal-models-using-llama-factory-on-amazon-sagemaker-hyperpod\u002F) (English)\n\n\u003Cdetails>\u003Csummary>All Blogs\u003C\u002Fsummary>\n\n- [Fine-tune Llama3.1-70B for Medical Diagnosis using LLaMA-Factory](https:\u002F\u002Fdocs.alayanew.com\u002Fdocs\u002Fdocuments\u002FbestPractice\u002FbigModel\u002Fllama70B\u002F?utm_source=LLaMA-Factory) (Chinese)\n- [Fine-tune Qwen2.5-VL for Autonomous Driving using LLaMA-Factory](https:\u002F\u002Fdocs.alayanew.com\u002Fdocs\u002Fdocuments\u002FuseGuide\u002FLLaMAFactory\u002Fmutiple\u002F?utm_source=LLaMA-Factory) (Chinese)\n- [LLaMA Factory: Fine-tuning the DeepSeek-R1-Distill-Qwen-7B Model for News Classifier](https:\u002F\u002Fgallery.pai-ml.com\u002F#\u002Fpreview\u002FdeepLearning\u002Fnlp\u002Fllama_factory_deepseek_r1_distill_7b) (Chinese)\n- [A One-Stop Code-Free Model Fine-Tuning \\& Deployment Platform based on SageMaker and LLaMA-Factory](https:\u002F\u002Faws.amazon.com\u002Fcn\u002Fblogs\u002Fchina\u002Fa-one-stop-code-free-model-fine-tuning-deployment-platform-based-on-sagemaker-and-llama-factory\u002F) (Chinese)\n- [LLaMA Factory Multi-Modal Fine-Tuning Practice: Fine-Tuning Qwen2-VL for Personal Tourist Guide](https:\u002F\u002Fgallery.pai-ml.com\u002F#\u002Fpreview\u002FdeepLearning\u002Fnlp\u002Fllama_factory_qwen2vl) (Chinese)\n- [LLaMA Factory: Fine-tuning Llama3 for Role-Playing](https:\u002F\u002Fgallery.pai-ml.com\u002F#\u002Fpreview\u002FdeepLearning\u002Fnlp\u002Fllama_factory) (Chinese)\n\n\u003C\u002Fdetails>\n\n## Changelog\n\n[25\u002F10\u002F26] We support Megatron-core training backend with [**mcore_adapter**](https:\u002F\u002Fgithub.com\u002Falibaba\u002FROLL\u002Ftree\u002Fmain\u002Fmcore_adapter). See [PR #9237](https:\u002F\u002Fgithub.com\u002Fhiyouga\u002FLLaMA-Factory\u002Fpull\u002F9237) to get started.\n\n[25\u002F08\u002F22] We supported **[OFT](https:\u002F\u002Farxiv.org\u002Fabs\u002F2306.07280)** and **[OFTv2](https:\u002F\u002Farxiv.org\u002Fabs\u002F2506.19847)**. See [examples](examples\u002FREADME.md) for usage.\n\n[25\u002F08\u002F20] We supported fine-tuning the **[Intern-S1-mini](https:\u002F\u002Fhuggingface.co\u002Finternlm\u002FIntern-S1-mini)** models. See [PR #8976](https:\u002F\u002Fgithub.com\u002Fhiyouga\u002FLLaMA-Factory\u002Fpull\u002F8976) to get started.\n\n[25\u002F08\u002F06] We supported fine-tuning the **[GPT-OSS](https:\u002F\u002Fgithub.com\u002Fopenai\u002Fgpt-oss)** models. See [PR #8826](https:\u002F\u002Fgithub.com\u002Fhiyouga\u002FLLaMA-Factory\u002Fpull\u002F8826) to get started.\n\n\u003Cdetails>\u003Csummary>Full Changelog\u003C\u002Fsummary>\n\n[25\u002F07\u002F02] We supported fine-tuning the **[GLM-4.1V-9B-Thinking](https:\u002F\u002Fgithub.com\u002FTHUDM\u002FGLM-4.1V-Thinking)** model.\n\n[25\u002F04\u002F28] We supported fine-tuning the **[Qwen3](https:\u002F\u002Fqwenlm.github.io\u002Fblog\u002Fqwen3\u002F)** model family.\n\n[25\u002F04\u002F21] We supported the **[Muon](https:\u002F\u002Fgithub.com\u002FKellerJordan\u002FMuon)** optimizer. See [examples](examples\u002FREADME.md) for usage. Thank [@tianshijing](https:\u002F\u002Fgithub.com\u002Ftianshijing)'s PR.\n\n[25\u002F04\u002F16] We supported fine-tuning the **[InternVL3](https:\u002F\u002Fhuggingface.co\u002FOpenGVLab\u002FInternVL3-8B)** model. See [PR #7258](https:\u002F\u002Fgithub.com\u002Fhiyouga\u002FLLaMA-Factory\u002Fpull\u002F7258) to get started.\n\n[25\u002F04\u002F14] We supported fine-tuning the **[GLM-Z1](https:\u002F\u002Fhuggingface.co\u002FTHUDM\u002FGLM-Z1-9B-0414)** and **[Kimi-VL](https:\u002F\u002Fhuggingface.co\u002Fmoonshotai\u002FKimi-VL-A3B-Instruct)** models.\n\n[25\u002F04\u002F06] We supported fine-tuning the **[Llama 4](https:\u002F\u002Fai.meta.com\u002Fblog\u002Fllama-4-multimodal-intelligence\u002F)** model. See [PR #7611](https:\u002F\u002Fgithub.com\u002Fhiyouga\u002FLLaMA-Factory\u002Fpull\u002F7611) to get started.\n\n[25\u002F03\u002F31] We supported fine-tuning the **[Qwen2.5 Omni](https:\u002F\u002Fqwenlm.github.io\u002Fblog\u002Fqwen2.5-omni\u002F)** model. See [PR #7537](https:\u002F\u002Fgithub.com\u002Fhiyouga\u002FLLaMA-Factory\u002Fpull\u002F7537) to get started.\n\n[25\u002F03\u002F15] We supported **[SGLang](https:\u002F\u002Fgithub.com\u002Fsgl-project\u002Fsglang)** as inference backend. Try `infer_backend: sglang` to accelerate inference.\n\n[25\u002F03\u002F12] We supported fine-tuning the **[Gemma 3](https:\u002F\u002Fhuggingface.co\u002Fblog\u002Fgemma3)** model.\n\n[25\u002F02\u002F24] Announcing **[EasyR1](https:\u002F\u002Fgithub.com\u002Fhiyouga\u002FEasyR1)**, an efficient, scalable and multi-modality RL training framework for efficient GRPO training.\n\n[25\u002F02\u002F11] We supported saving the **[Ollama](https:\u002F\u002Fgithub.com\u002Follama\u002Follama)** modelfile when exporting the model checkpoints. See [examples](examples\u002FREADME.md) for usage.\n\n[25\u002F02\u002F05] We supported fine-tuning the **[Qwen2-Audio](Qwen\u002FQwen2-Audio-7B-Instruct)** and **[MiniCPM-o-2.6](https:\u002F\u002Fhuggingface.co\u002Fopenbmb\u002FMiniCPM-o-2_6)** on audio understanding tasks.\n\n[25\u002F01\u002F31] We supported fine-tuning the **[DeepSeek-R1](https:\u002F\u002Fhuggingface.co\u002Fdeepseek-ai\u002FDeepSeek-R1)** and **[Qwen2.5-VL](https:\u002F\u002Fhuggingface.co\u002FQwen\u002FQwen2.5-VL-7B-Instruct)** models.\n\n[25\u002F01\u002F15] We supported **[APOLLO](https:\u002F\u002Farxiv.org\u002Fabs\u002F2412.05270)** optimizer. See [examples](examples\u002FREADME.md) for usage.\n\n[25\u002F01\u002F14] We supported fine-tuning the **[MiniCPM-o-2.6](https:\u002F\u002Fhuggingface.co\u002Fopenbmb\u002FMiniCPM-o-2_6)** and **[MiniCPM-V-2.6](https:\u002F\u002Fhuggingface.co\u002Fopenbmb\u002FMiniCPM-V-2_6)** models. Thank [@BUAADreamer](https:\u002F\u002Fgithub.com\u002FBUAADreamer)'s PR.\n\n[25\u002F01\u002F14] We supported fine-tuning the **[InternLM 3](https:\u002F\u002Fhuggingface.co\u002Fcollections\u002Finternlm\u002F)** models. Thank [@hhaAndroid](https:\u002F\u002Fgithub.com\u002FhhaAndroid)'s PR.\n\n[25\u002F01\u002F10] We supported fine-tuning the **[Phi-4](https:\u002F\u002Fhuggingface.co\u002Fmicrosoft\u002Fphi-4)** model.\n\n[24\u002F12\u002F21] We supported using **[SwanLab](https:\u002F\u002Fgithub.com\u002FSwanHubX\u002FSwanLab)** for experiment tracking and visualization. See [this section](#use-swanlab-logger) for details.\n\n[24\u002F11\u002F27] We supported fine-tuning the **[Skywork-o1](https:\u002F\u002Fhuggingface.co\u002FSkywork\u002FSkywork-o1-Open-Llama-3.1-8B)** model and the **[OpenO1](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FO1-OPEN\u002FOpenO1-SFT)** dataset.\n\n[24\u002F10\u002F09] We supported downloading pre-trained models and datasets from the **[Modelers Hub](https:\u002F\u002Fmodelers.cn\u002Fmodels)**. See [this tutorial](#download-from-modelers-hub) for usage.\n\n[24\u002F09\u002F19] We supported fine-tuning the **[Qwen2.5](https:\u002F\u002Fqwenlm.github.io\u002Fblog\u002Fqwen2.5\u002F)** models.\n\n[24\u002F08\u002F30] We supported fine-tuning the **[Qwen2-VL](https:\u002F\u002Fqwenlm.github.io\u002Fblog\u002Fqwen2-vl\u002F)** models. Thank [@simonJJJ](https:\u002F\u002Fgithub.com\u002FsimonJJJ)'s PR.\n\n[24\u002F08\u002F27] We supported **[Liger Kernel](https:\u002F\u002Fgithub.com\u002Flinkedin\u002FLiger-Kernel)**. Try `enable_liger_kernel: true` for efficient training.\n\n[24\u002F08\u002F09] We supported **[Adam-mini](https:\u002F\u002Fgithub.com\u002Fzyushun\u002FAdam-mini)** optimizer. See [examples](examples\u002FREADME.md) for usage. Thank [@relic-yuexi](https:\u002F\u002Fgithub.com\u002Frelic-yuexi)'s PR.\n\n[24\u002F07\u002F04] We supported [contamination-free packed training](https:\u002F\u002Fgithub.com\u002FMeetKai\u002Ffunctionary\u002Ftree\u002Fmain\u002Ffunctionary\u002Ftrain\u002Fpacking). Use `neat_packing: true` to activate it. Thank [@chuan298](https:\u002F\u002Fgithub.com\u002Fchuan298)'s PR.\n\n[24\u002F06\u002F16] We supported **[PiSSA](https:\u002F\u002Farxiv.org\u002Fabs\u002F2404.02948)** algorithm. See [examples](examples\u002FREADME.md) for usage.\n\n[24\u002F06\u002F07] We supported fine-tuning the **[Qwen2](https:\u002F\u002Fqwenlm.github.io\u002Fblog\u002Fqwen2\u002F)** and **[GLM-4](https:\u002F\u002Fgithub.com\u002FTHUDM\u002FGLM-4)** models.\n\n[24\u002F05\u002F26] We supported **[SimPO](https:\u002F\u002Farxiv.org\u002Fabs\u002F2405.14734)** algorithm for preference learning. See [examples](examples\u002FREADME.md) for usage.\n\n[24\u002F05\u002F20] We supported fine-tuning the **PaliGemma** series models. Note that the PaliGemma models are pre-trained models, you need to fine-tune them with `paligemma` template for chat completion.\n\n[24\u002F05\u002F18] We supported **[KTO](https:\u002F\u002Farxiv.org\u002Fabs\u002F2402.01306)** algorithm for preference learning. See [examples](examples\u002FREADME.md) for usage.\n\n[24\u002F05\u002F14] We supported training and inference on the Ascend NPU devices. Check [installation](#installation) section for details.\n\n[24\u002F04\u002F26] We supported fine-tuning the **LLaVA-1.5** multimodal LLMs. See [examples](examples\u002FREADME.md) for usage.\n\n[24\u002F04\u002F22] We provided a **[Colab notebook](https:\u002F\u002Fcolab.research.google.com\u002Fdrive\u002F1eRTPn37ltBbYsISy9Aw2NuI2Aq5CQrD9?usp=sharing)** for fine-tuning the Llama-3 model on a free T4 GPU. Two Llama-3-derived models fine-tuned using LLaMA Factory are available at Hugging Face, check [Llama3-8B-Chinese-Chat](https:\u002F\u002Fhuggingface.co\u002Fshenzhi-wang\u002FLlama3-8B-Chinese-Chat) and [Llama3-Chinese](https:\u002F\u002Fhuggingface.co\u002Fzhichen\u002FLlama3-Chinese) for details.\n\n[24\u002F04\u002F21] We supported **[Mixture-of-Depths](https:\u002F\u002Farxiv.org\u002Fabs\u002F2404.02258)** according to [AstraMindAI's implementation](https:\u002F\u002Fgithub.com\u002Fastramind-ai\u002FMixture-of-depths). See [examples](examples\u002FREADME.md) for usage.\n\n[24\u002F04\u002F16] We supported **[BAdam](https:\u002F\u002Farxiv.org\u002Fabs\u002F2404.02827)** optimizer. See [examples](examples\u002FREADME.md) for usage.\n\n[24\u002F04\u002F16] We supported **[unsloth](https:\u002F\u002Fgithub.com\u002Funslothai\u002Funsloth)**'s long-sequence training (Llama-2-7B-56k within 24GB). It achieves **117%** speed and **50%** memory compared with FlashAttention-2, more benchmarks can be found in [this page](https:\u002F\u002Fgithub.com\u002Fhiyouga\u002FLLaMA-Factory\u002Fwiki\u002FPerformance-comparison).\n\n[24\u002F03\u002F31] We supported **[ORPO](https:\u002F\u002Farxiv.org\u002Fabs\u002F2403.07691)**. See [examples](examples\u002FREADME.md) for usage.\n\n[24\u002F03\u002F21] Our paper \"[LlamaFactory: Unified Efficient Fine-Tuning of 100+ Language Models](https:\u002F\u002Farxiv.org\u002Fabs\u002F2403.13372)\" is available at arXiv!\n\n[24\u002F03\u002F20] We supported **FSDP+QLoRA** that fine-tunes a 70B model on 2x24GB GPUs. See [examples](examples\u002FREADME.md) for usage.\n\n[24\u002F03\u002F13] We supported **[LoRA+](https:\u002F\u002Farxiv.org\u002Fabs\u002F2402.12354)**. See [examples](examples\u002FREADME.md) for usage.\n\n[24\u002F03\u002F07] We supported **[GaLore](https:\u002F\u002Farxiv.org\u002Fabs\u002F2403.03507)** optimizer. See [examples](examples\u002FREADME.md) for usage.\n\n[24\u002F03\u002F07] We integrated **[vLLM](https:\u002F\u002Fgithub.com\u002Fvllm-project\u002Fvllm)** for faster and concurrent inference. Try `infer_backend: vllm` to enjoy **270%** inference speed.\n\n[24\u002F02\u002F28] We supported weight-decomposed LoRA (**[DoRA](https:\u002F\u002Farxiv.org\u002Fabs\u002F2402.09353)**). Try `use_dora: true` to activate DoRA training.\n\n[24\u002F02\u002F15] We supported **block expansion** proposed by [LLaMA Pro](https:\u002F\u002Fgithub.com\u002FTencentARC\u002FLLaMA-Pro). See [examples](examples\u002FREADME.md) for usage.\n\n[24\u002F02\u002F05] Qwen1.5 (Qwen2 beta version) series models are supported in LLaMA-Factory. Check this [blog post](https:\u002F\u002Fqwenlm.github.io\u002Fblog\u002Fqwen1.5\u002F) for details.\n\n[24\u002F01\u002F18] We supported **agent tuning** for most models, equipping model with tool using abilities by fine-tuning with `dataset: glaive_toolcall_en`.\n\n[23\u002F12\u002F23] We supported **[unsloth](https:\u002F\u002Fgithub.com\u002Funslothai\u002Funsloth)**'s implementation to boost LoRA tuning for the LLaMA, Mistral and Yi models. Try `use_unsloth: true` argument to activate unsloth patch. It achieves **170%** speed in our benchmark, check [this page](https:\u002F\u002Fgithub.com\u002Fhiyouga\u002FLLaMA-Factory\u002Fwiki\u002FPerformance-comparison) for details.\n\n[23\u002F12\u002F12] We supported fine-tuning the latest MoE model **[Mixtral 8x7B](https:\u002F\u002Fhuggingface.co\u002Fmistralai\u002FMixtral-8x7B-v0.1)** in our framework. See hardware requirement [here](#hardware-requirement).\n\n[23\u002F12\u002F01] We supported downloading pre-trained models and datasets from the **[ModelScope Hub](https:\u002F\u002Fmodelscope.cn\u002Fmodels)**. See [this tutorial](#download-from-modelscope-hub) for usage.\n\n[23\u002F10\u002F21] We supported **[NEFTune](https:\u002F\u002Farxiv.org\u002Fabs\u002F2310.05914)** trick for fine-tuning. Try `neftune_noise_alpha: 5` argument to activate NEFTune.\n\n[23\u002F09\u002F27] We supported **$S^2$-Attn** proposed by [LongLoRA](https:\u002F\u002Fgithub.com\u002Fdvlab-research\u002FLongLoRA) for the LLaMA models. Try `shift_attn: true` argument to enable shift short attention.\n\n[23\u002F09\u002F23] We integrated MMLU, C-Eval and CMMLU benchmarks in this repo. See [examples](examples\u002FREADME.md) for usage.\n\n[23\u002F09\u002F10] We supported **[FlashAttention-2](https:\u002F\u002Fgithub.com\u002FDao-AILab\u002Fflash-attention)**. Try `flash_attn: fa2` argument to enable FlashAttention-2 if you are using RTX4090, A100 or H100 GPUs.\n\n[23\u002F08\u002F12] We supported **RoPE scaling** to extend the context length of the LLaMA models. Try `rope_scaling: linear` argument in training and `rope_scaling: dynamic` argument at inference to extrapolate the position embeddings.\n\n[23\u002F08\u002F11] We supported **[DPO training](https:\u002F\u002Farxiv.org\u002Fabs\u002F2305.18290)** for instruction-tuned models. See [examples](examples\u002FREADME.md) for usage.\n\n[23\u002F07\u002F31] We supported **dataset streaming**. Try `streaming: true` and `max_steps: 10000` arguments to load your dataset in streaming mode.\n\n[23\u002F07\u002F29] We released two instruction-tuned 13B models at Hugging Face. See these Hugging Face Repos ([LLaMA-2](https:\u002F\u002Fhuggingface.co\u002Fhiyouga\u002FLlama-2-Chinese-13b-chat) \u002F [Baichuan](https:\u002F\u002Fhuggingface.co\u002Fhiyouga\u002FBaichuan-13B-sft)) for details.\n\n[23\u002F07\u002F18] We developed an **all-in-one Web UI** for training, evaluation and inference. Try `train_web.py` to fine-tune models in your Web browser. Thank [@KanadeSiina](https:\u002F\u002Fgithub.com\u002FKanadeSiina) and [@codemayq](https:\u002F\u002Fgithub.com\u002Fcodemayq) for their efforts in the development.\n\n[23\u002F07\u002F09] We released **[FastEdit](https:\u002F\u002Fgithub.com\u002Fhiyouga\u002FFastEdit)** ⚡🩹, an easy-to-use package for editing the factual knowledge of large language models efficiently. Please follow [FastEdit](https:\u002F\u002Fgithub.com\u002Fhiyouga\u002FFastEdit) if you are interested.\n\n[23\u002F06\u002F29] We provided a **reproducible example** of training a chat model using instruction-following datasets, see [Baichuan-7B-sft](https:\u002F\u002Fhuggingface.co\u002Fhiyouga\u002FBaichuan-7B-sft) for details.\n\n[23\u002F06\u002F22] We aligned the [demo API](src\u002Fapi_demo.py) with the [OpenAI's](https:\u002F\u002Fplatform.openai.com\u002Fdocs\u002Fapi-reference\u002Fchat) format where you can insert the fine-tuned model in **arbitrary ChatGPT-based applications**.\n\n[23\u002F06\u002F03] We supported quantized training and inference (aka **[QLoRA](https:\u002F\u002Fgithub.com\u002Fartidoro\u002Fqlora)**). See [examples](examples\u002FREADME.md) for usage.\n\n\u003C\u002Fdetails>\n\n> [!TIP]\n> If you cannot use the latest feature, please pull the latest code and install LLaMA-Factory again.\n\n## Supported Models\n\n| Model                                                             | Model size                       | Template             |\n| ----------------------------------------------------------------- | -------------------------------- | -------------------- |\n| [BLOOM\u002FBLOOMZ](https:\u002F\u002Fhuggingface.co\u002Fbigscience)                 | 560M\u002F1.1B\u002F1.7B\u002F3B\u002F7.1B\u002F176B      | -                    |\n| [DeepSeek (LLM\u002FCode\u002FMoE)](https:\u002F\u002Fhuggingface.co\u002Fdeepseek-ai)     | 7B\u002F16B\u002F67B\u002F236B                  | deepseek             |\n| [DeepSeek 3-3.2](https:\u002F\u002Fhuggingface.co\u002Fdeepseek-ai)              | 236B\u002F671B                        | deepseek3            |\n| [DeepSeek R1 (Distill)](https:\u002F\u002Fhuggingface.co\u002Fdeepseek-ai)       | 1.5B\u002F7B\u002F8B\u002F14B\u002F32B\u002F70B\u002F671B      | deepseekr1           |\n| [ERNIE-4.5](https:\u002F\u002Fhuggingface.co\u002Fbaidu)                         | 0.3B\u002F21B\u002F300B                    | ernie_nothink        |\n| [Falcon\u002FFalcon H1](https:\u002F\u002Fhuggingface.co\u002Ftiiuae)                 | 0.5B\u002F1.5B\u002F3B\u002F7B\u002F11B\u002F34B\u002F40B\u002F180B | falcon\u002Ffalcon_h1     |\n| [Gemma\u002FGemma 2\u002FCodeGemma](https:\u002F\u002Fhuggingface.co\u002Fgoogle)          | 2B\u002F7B\u002F9B\u002F27B                     | gemma\u002Fgemma2         |\n| [Gemma 3\u002FGemma 3n](https:\u002F\u002Fhuggingface.co\u002Fgoogle)                 | 270M\u002F1B\u002F4B\u002F6B\u002F8B\u002F12B\u002F27B         | gemma3\u002Fgemma3n       |\n| [GLM-4\u002FGLM-4-0414\u002FGLM-Z1](https:\u002F\u002Fhuggingface.co\u002Fzai-org)         | 9B\u002F32B                           | glm4\u002Fglmz1           |\n| [GLM-4.5\u002FGLM-4.5(6)V](https:\u002F\u002Fhuggingface.co\u002Fzai-org)             | 9B\u002F106B\u002F355B                     | glm4_moe\u002Fglm4_5v     |\n| [GPT-2](https:\u002F\u002Fhuggingface.co\u002Fopenai-community)                  | 0.1B\u002F0.4B\u002F0.8B\u002F1.5B              | -                    |\n| [GPT-OSS](https:\u002F\u002Fhuggingface.co\u002Fopenai)                          | 20B\u002F120B                         | gpt_oss              |\n| [Granite 3-4](https:\u002F\u002Fhuggingface.co\u002Fibm-granite)                 | 1B\u002F2B\u002F3B\u002F7B\u002F8B                   | granite3\u002Fgranite4    |\n| [Hunyuan\u002FHunyuan1.5 (MT)](https:\u002F\u002Fhuggingface.co\u002Ftencent\u002F)        | 0.5B\u002F1.8B\u002F4B\u002F7B\u002F13B              | hunyuan\u002Fhunyuan_small|\n| [InternLM 2-3](https:\u002F\u002Fhuggingface.co\u002Finternlm)                   | 7B\u002F8B\u002F20B                        | intern2              |\n| [InternVL 2.5-3.5](https:\u002F\u002Fhuggingface.co\u002FOpenGVLab)              | 1B\u002F2B\u002F4B\u002F8B\u002F14B\u002F30B\u002F38B\u002F78B\u002F241B | intern_vl            |\n| [Intern-S1-mini](https:\u002F\u002Fhuggingface.co\u002Finternlm\u002F)                | 8B                               | intern_s1            |\n| [Kimi-VL](https:\u002F\u002Fhuggingface.co\u002Fmoonshotai)                      | 16B                              | kimi_vl              |\n| [Ling 2.0 (mini\u002Fflash)](https:\u002F\u002Fhuggingface.co\u002FinclusionAI)       | 16B\u002F100B                         | bailing_v2           |\n| [LFM 2.5 (VL)](https:\u002F\u002Fhuggingface.co\u002FLiquidAI)                   | 1.2B\u002F1.6B                        | lfm2\u002Flfm2_vl         |\n| [Llama](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002Fllama)                | 7B\u002F13B\u002F33B\u002F65B                   | -                    |\n| [Llama 2](https:\u002F\u002Fhuggingface.co\u002Fmeta-llama)                      | 7B\u002F13B\u002F70B                       | llama2               |\n| [Llama 3-3.3](https:\u002F\u002Fhuggingface.co\u002Fmeta-llama)                  | 1B\u002F3B\u002F8B\u002F70B                     | llama3               |\n| [Llama 4](https:\u002F\u002Fhuggingface.co\u002Fmeta-llama)                      | 109B\u002F402B                        | llama4               |\n| [Llama 3.2 Vision](https:\u002F\u002Fhuggingface.co\u002Fmeta-llama)             | 11B\u002F90B                          | mllama               |\n| [LLaVA-1.5](https:\u002F\u002Fhuggingface.co\u002Fllava-hf)                      | 7B\u002F13B                           | llava                |\n| [LLaVA-NeXT](https:\u002F\u002Fhuggingface.co\u002Fllava-hf)                     | 7B\u002F8B\u002F13B\u002F34B\u002F72B\u002F110B           | llava_next           |\n| [LLaVA-NeXT-Video](https:\u002F\u002Fhuggingface.co\u002Fllava-hf)               | 7B\u002F34B                           | llava_next_video     |\n| [MiMo](https:\u002F\u002Fhuggingface.co\u002FXiaomiMiMo)                         | 7B\u002F309B                          | mimo\u002Fmimo_v2         |\n| [MiniCPM 4](https:\u002F\u002Fhuggingface.co\u002Fopenbmb)                       | 0.5B\u002F8B                          | cpm4                 |\n| [MiniCPM-o\u002FMiniCPM-V 4.5](https:\u002F\u002Fhuggingface.co\u002Fopenbmb)         | 8B\u002F9B                            | minicpm_o\u002Fminicpm_v  |\n| [MiniMax-M1\u002FMiniMax-M2](https:\u002F\u002Fhuggingface.co\u002FMiniMaxAI\u002Fmodels)  | 229B\u002F456B                        | minimax1\u002Fminimax2    |\n| [Ministral 3](https:\u002F\u002Fhuggingface.co\u002Fmistralai)                   | 3B\u002F8B\u002F14B                        | ministral3           |\n| [Mistral\u002FMixtral](https:\u002F\u002Fhuggingface.co\u002Fmistralai)               | 7B\u002F8x7B\u002F8x22B                    | mistral              |\n| [PaliGemma\u002FPaliGemma2](https:\u002F\u002Fhuggingface.co\u002Fgoogle)             | 3B\u002F10B\u002F28B                       | paligemma            |\n| [Phi-3\u002FPhi-3.5](https:\u002F\u002Fhuggingface.co\u002Fmicrosoft)                 | 4B\u002F14B                           | phi                  |\n| [Phi-3-small](https:\u002F\u002Fhuggingface.co\u002Fmicrosoft)                   | 7B                               | phi_small            |\n| [Phi-4-mini\u002FPhi-4](https:\u002F\u002Fhuggingface.co\u002Fmicrosoft)              | 3.8B\u002F14B                         | phi4_mini\u002Fphi4       |\n| [Pixtral](https:\u002F\u002Fhuggingface.co\u002Fmistralai)                       | 12B                              | pixtral              |\n| [Qwen2 (Code\u002FMath\u002FMoE\u002FQwQ)](https:\u002F\u002Fhuggingface.co\u002FQwen)          | 0.5B\u002F1.5B\u002F3B\u002F7B\u002F14B\u002F32B\u002F72B\u002F110B | qwen                 |\n| [Qwen3 (MoE\u002FInstruct\u002FThinking\u002FNext)](https:\u002F\u002Fhuggingface.co\u002FQwen) | 0.6B\u002F1.7B\u002F4B\u002F8B\u002F14B\u002F32B\u002F80B\u002F235B | qwen3\u002Fqwen3_nothink  |\n| [Qwen3.5](https:\u002F\u002Fhuggingface.co\u002FQwen)                            | 0.8B\u002F2B\u002F4B\u002F9B\u002F27B\u002F35B\u002F122B\u002F397B  | qwen3_5              |\n| [Qwen2-Audio](https:\u002F\u002Fhuggingface.co\u002FQwen)                        | 7B                               | qwen2_audio          |\n| [Qwen2.5-Omni](https:\u002F\u002Fhuggingface.co\u002FQwen)                       | 3B\u002F7B                            | qwen2_omni           |\n| [Qwen3-Omni](https:\u002F\u002Fhuggingface.co\u002FQwen)                         | 30B                              | qwen3_omni           |\n| [Qwen2-VL\u002FQwen2.5-VL\u002FQVQ](https:\u002F\u002Fhuggingface.co\u002FQwen)            | 2B\u002F3B\u002F7B\u002F32B\u002F72B                 | qwen2_vl             |\n| [Qwen3-VL](https:\u002F\u002Fhuggingface.co\u002FQwen)                           | 2B\u002F4B\u002F8B\u002F30B\u002F32B\u002F235B            | qwen3_vl             |\n| [Seed (OSS\u002FCoder)](https:\u002F\u002Fhuggingface.co\u002FByteDance-Seed)         | 8B\u002F36B                           | seed_oss\u002Fseed_coder  |\n| [StarCoder 2](https:\u002F\u002Fhuggingface.co\u002Fbigcode)                     | 3B\u002F7B\u002F15B                        | -                    |\n| [TeleChat 2-2.5](https:\u002F\u002Fhuggingface.co\u002FTele-AI)                  | 3B\u002F7B\u002F35B\u002F115B                   | telechat2            |\n| [Yuan 2](https:\u002F\u002Fhuggingface.co\u002FIEITYuan)                         | 2B\u002F51B\u002F102B                      | yuan                 |\n\n> [!NOTE]\n> For the \"base\" models, the `template` argument can be chosen from `default`, `alpaca`, `vicuna` etc. But make sure to use the **corresponding template** for the \"instruct\u002Fchat\" models.\n>\n> If the model has both reasoning and non-reasoning versions, please use the `_nothink` suffix to distinguish between them. For example, `qwen3` and `qwen3_nothink`.\n>\n> Remember to use the **SAME** template in training and inference.\n>\n> \\*: You should install the `transformers` from main branch and use `DISABLE_VERSION_CHECK=1` to skip version check.\n>\n> \\*\\*: You need to install a specific version of `transformers` to use the corresponding model.\n\nPlease refer to [constants.py](src\u002Fllamafactory\u002Fextras\u002Fconstants.py) for a full list of models we supported.\n\nYou also can add a custom chat template to [template.py](src\u002Fllamafactory\u002Fdata\u002Ftemplate.py).\n\n## Supported Training Approaches\n\n| Approach               |     Full-tuning    |    Freeze-tuning   |       LoRA         |       QLoRA        |        OFT         |        QOFT        |\n| ---------------------- | ------------------ | ------------------ | ------------------ | ------------------ | ------------------ | ------------------ |\n| Pre-Training           | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |\n| Supervised Fine-Tuning | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |\n| Reward Modeling        | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |\n| PPO Training           | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |\n| DPO Training           | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |\n| KTO Training           | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |\n| ORPO Training          | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |\n| SimPO Training         | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |\n\n> [!TIP]\n> The implementation details of PPO can be found in [this blog](https:\u002F\u002Fnewfacade.github.io\u002Fnotes-on-reinforcement-learning\u002F17-ppo-trl.html).\n\n## Provided Datasets\n\n\u003Cdetails>\u003Csummary>Pre-training datasets\u003C\u002Fsummary>\n\n- [Wiki Demo (en)](data\u002Fwiki_demo.txt)\n- [RefinedWeb (en)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Ftiiuae\u002Ffalcon-refinedweb)\n- [RedPajama V2 (en)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Ftogethercomputer\u002FRedPajama-Data-V2)\n- [Wikipedia (en)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Folm\u002Folm-wikipedia-20221220)\n- [Wikipedia (zh)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fpleisto\u002Fwikipedia-cn-20230720-filtered)\n- [Pile (en)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FEleutherAI\u002Fpile)\n- [SkyPile (zh)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FSkywork\u002FSkyPile-150B)\n- [FineWeb (en)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FHuggingFaceFW\u002Ffineweb)\n- [FineWeb-Edu (en)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FHuggingFaceFW\u002Ffineweb-edu)\n- [CCI3-HQ (zh)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FBAAI\u002FCCI3-HQ)\n- [CCI3-Data (zh)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FBAAI\u002FCCI3-Data)\n- [CCI4.0-M2-Base-v1 (en&zh)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FBAAI\u002FCCI4.0-M2-Base-v1)\n- [CCI4.0-M2-CoT-v1 (en&zh)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FBAAI\u002FCCI4.0-M2-CoT-v1)\n- [CCI4.0-M2-Extra-v1 (en&zh)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FBAAI\u002FCCI4.0-M2-Extra-v1)\n- [The Stack (en)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fbigcode\u002Fthe-stack)\n- [StarCoder (en)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fbigcode\u002Fstarcoderdata)\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>Supervised fine-tuning datasets\u003C\u002Fsummary>\n\n- [Identity (en&zh)](data\u002Fidentity.json)\n- [Stanford Alpaca (en)](https:\u002F\u002Fgithub.com\u002Ftatsu-lab\u002Fstanford_alpaca)\n- [Stanford Alpaca (zh)](https:\u002F\u002Fgithub.com\u002Fymcui\u002FChinese-LLaMA-Alpaca-3)\n- [Alpaca GPT4 (en&zh)](https:\u002F\u002Fgithub.com\u002FInstruction-Tuning-with-GPT-4\u002FGPT-4-LLM)\n- [Glaive Function Calling V2 (en&zh)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fglaiveai\u002Fglaive-function-calling-v2)\n- [LIMA (en)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FGAIR\u002Flima)\n- [Guanaco Dataset (multilingual)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FJosephusCheung\u002FGuanacoDataset)\n- [BELLE 2M (zh)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FBelleGroup\u002Ftrain_2M_CN)\n- [BELLE 1M (zh)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FBelleGroup\u002Ftrain_1M_CN)\n- [BELLE 0.5M (zh)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FBelleGroup\u002Ftrain_0.5M_CN)\n- [BELLE Dialogue 0.4M (zh)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FBelleGroup\u002Fgenerated_chat_0.4M)\n- [BELLE School Math 0.25M (zh)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FBelleGroup\u002Fschool_math_0.25M)\n- [BELLE Multiturn Chat 0.8M (zh)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FBelleGroup\u002Fmultiturn_chat_0.8M)\n- [UltraChat (en)](https:\u002F\u002Fgithub.com\u002Fthunlp\u002FUltraChat)\n- [OpenPlatypus (en)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fgarage-bAInd\u002FOpen-Platypus)\n- [CodeAlpaca 20k (en)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fsahil2801\u002FCodeAlpaca-20k)\n- [Alpaca CoT (multilingual)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FQingyiSi\u002FAlpaca-CoT)\n- [OpenOrca (en)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FOpen-Orca\u002FOpenOrca)\n- [SlimOrca (en)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FOpen-Orca\u002FSlimOrca)\n- [MathInstruct (en)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FTIGER-Lab\u002FMathInstruct)\n- [Firefly 1.1M (zh)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FYeungNLP\u002Ffirefly-train-1.1M)\n- [Wiki QA (en)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fwiki_qa)\n- [Web QA (zh)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fsuolyer\u002Fwebqa)\n- [WebNovel (zh)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fzxbsmk\u002Fwebnovel_cn)\n- [Nectar (en)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fberkeley-nest\u002FNectar)\n- [deepctrl (en&zh)](https:\u002F\u002Fwww.modelscope.cn\u002Fdatasets\u002Fdeepctrl\u002Fdeepctrl-sft-data)\n- [Advertise Generating (zh)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FHasturOfficial\u002Fadgen)\n- [ShareGPT Hyperfiltered (en)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Ftotally-not-an-llm\u002Fsharegpt-hyperfiltered-3k)\n- [ShareGPT4 (en&zh)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fshibing624\u002Fsharegpt_gpt4)\n- [UltraChat 200k (en)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FHuggingFaceH4\u002Fultrachat_200k)\n- [Infinity Instruct (zh)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FBAAI\u002FInfinity-Instruct)\n- [AgentInstruct (en)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FTHUDM\u002FAgentInstruct)\n- [LMSYS Chat 1M (en)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Flmsys\u002Flmsys-chat-1m)\n- [Evol Instruct V2 (en)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FWizardLM\u002FWizardLM_evol_instruct_V2_196k)\n- [Cosmopedia (en)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FHuggingFaceTB\u002Fcosmopedia)\n- [STEM (zh)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fhfl\u002Fstem_zh_instruction)\n- [Ruozhiba (zh)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fhfl\u002Fruozhiba_gpt4_turbo)\n- [Neo-sft (zh)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fm-a-p\u002Fneo_sft_phase2)\n- [Magpie-Pro-300K-Filtered (en)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FMagpie-Align\u002FMagpie-Pro-300K-Filtered)\n- [Magpie-ultra-v0.1 (en)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fargilla\u002Fmagpie-ultra-v0.1)\n- [WebInstructSub (en)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FTIGER-Lab\u002FWebInstructSub)\n- [OpenO1-SFT (en&zh)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FO1-OPEN\u002FOpenO1-SFT)\n- [Open-Thoughts (en)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fopen-thoughts\u002FOpenThoughts-114k)\n- [Open-R1-Math (en)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fopen-r1\u002FOpenR1-Math-220k)\n- [Chinese-DeepSeek-R1-Distill (zh)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FCongliu\u002FChinese-DeepSeek-R1-Distill-data-110k-SFT)\n- [LLaVA mixed (en&zh)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FBUAADreamer\u002Fllava-en-zh-300k)\n- [Pokemon-gpt4o-captions (en&zh)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fjugg1024\u002Fpokemon-gpt4o-captions)\n- [DLR-Web (en)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FAttention1115\u002FDLR-Web)\n- [Open Assistant (de)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fmayflowergmbh\u002Foasst_de)\n- [Dolly 15k (de)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fmayflowergmbh\u002Fdolly-15k_de)\n- [Alpaca GPT4 (de)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fmayflowergmbh\u002Falpaca-gpt4_de)\n- [OpenSchnabeltier (de)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fmayflowergmbh\u002Fopenschnabeltier_de)\n- [Evol Instruct (de)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fmayflowergmbh\u002Fevol-instruct_de)\n- [Dolphin (de)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fmayflowergmbh\u002Fdolphin_de)\n- [Booksum (de)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fmayflowergmbh\u002Fbooksum_de)\n- [Airoboros (de)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fmayflowergmbh\u002Fairoboros-3.0_de)\n- [Ultrachat (de)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fmayflowergmbh\u002Fultra-chat_de)\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>Preference datasets\u003C\u002Fsummary>\n\n- [DPO mixed (en&zh)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fhiyouga\u002FDPO-En-Zh-20k)\n- [UltraFeedback (en)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FHuggingFaceH4\u002Fultrafeedback_binarized)\n- [COIG-P (zh)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fm-a-p\u002FCOIG-P)\n- [RLHF-V (en)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fopenbmb\u002FRLHF-V-Dataset)\n- [VLFeedback (en)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FZhihui\u002FVLFeedback)\n- [RLAIF-V (en)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fopenbmb\u002FRLAIF-V-Dataset)\n- [Orca DPO Pairs (en)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FIntel\u002Forca_dpo_pairs)\n- [HH-RLHF (en)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FAnthropic\u002Fhh-rlhf)\n- [Nectar (en)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fberkeley-nest\u002FNectar)\n- [Orca DPO (de)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fmayflowergmbh\u002Fintel_orca_dpo_pairs_de)\n- [KTO mixed (en)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fargilla\u002Fkto-mix-15k)\n\n\u003C\u002Fdetails>\n\nSome datasets require confirmation before using them, so we recommend logging in with your Hugging Face account using these commands.\n\n```bash\npip install \"huggingface_hub\u003C1.0.0\"\nhuggingface-cli login\n```\n\n## Requirement\n\n| Mandatory    | Minimum | Recommend |\n| ------------ | ------- | --------- |\n| python       | 3.11     | >=3.11   |\n| torch        | 2.0.0   | 2.6.0     |\n| torchvision  | 0.15.0  | 0.21.0    |\n| transformers | 4.49.0  | 4.50.0    |\n| datasets     | 2.16.0  | 3.2.0     |\n| accelerate   | 0.34.0  | 1.2.1     |\n| peft         | 0.14.0  | 0.15.1    |\n| trl          | 0.8.6   | 0.9.6     |\n\n| Optional     | Minimum | Recommend |\n| ------------ | ------- | --------- |\n| CUDA         | 11.6    | 12.2      |\n| deepspeed    | 0.10.0  | 0.16.4    |\n| bitsandbytes | 0.39.0  | 0.43.1    |\n| vllm         | 0.4.3   | 0.8.2     |\n| flash-attn   | 2.5.6   | 2.7.2     |\n\n### Hardware Requirement\n\n\\* *estimated*\n\n| Method                              | Bits |   7B  |  14B  |  30B  |   70B  |   `x`B  |\n| ----------------------------------- | ---- | ----- | ----- | ----- | ------ | ------- |\n| Full (`bf16` or `fp16`)             |  32  | 120GB | 240GB | 600GB | 1200GB | `18x`GB |\n| Full (`pure_bf16`)                  |  16  |  60GB | 120GB | 300GB |  600GB |  `8x`GB |\n| Freeze\u002FLoRA\u002FGaLore\u002FAPOLLO\u002FBAdam\u002FOFT |  16  |  16GB |  32GB |  64GB |  160GB |  `2x`GB |\n| QLoRA \u002F QOFT                        |   8  |  10GB |  20GB |  40GB |   80GB |   `x`GB |\n| QLoRA \u002F QOFT                        |   4  |   6GB |  12GB |  24GB |   48GB | `x\u002F2`GB |\n| QLoRA \u002F QOFT                        |   2  |   4GB |   8GB |  16GB |   24GB | `x\u002F4`GB |\n\n## Getting Started\n\n### Installation\n\n> [!IMPORTANT]\n> Installation is mandatory.\n\n#### Install from Source\n\n```bash\ngit clone --depth 1 https:\u002F\u002Fgithub.com\u002Fhiyouga\u002FLlamaFactory.git\ncd LlamaFactory\npip install -e .\npip install -r requirements\u002Fmetrics.txt\n```\n\nOptional dependencies available: `metrics`, `deepspeed`. Install with: `pip install -e . && pip install -r requirements\u002Fmetrics.txt -r requirements\u002Fdeepspeed.txt`\n\nAdditional dependencies for specific features are available in `examples\u002Frequirements\u002F`.\n\n#### Install from Docker Image\n\n```bash\ndocker run -it --rm --gpus=all --ipc=host hiyouga\u002Fllamafactory:latest\n```\n\nThis image is built on Ubuntu 22.04 (x86\\_64), CUDA 12.4, Python 3.11, PyTorch 2.6.0, and Flash-attn 2.7.4.\n\nFind the pre-built images: https:\u002F\u002Fhub.docker.com\u002Fr\u002Fhiyouga\u002Fllamafactory\u002Ftags\n\nPlease refer to [build docker](#build-docker) to build the image yourself.\n\n\u003Cdetails>\u003Csummary>Setting up a virtual environment with \u003Cb>uv\u003C\u002Fb>\u003C\u002Fsummary>\n\nCreate an isolated Python environment with [uv](https:\u002F\u002Fgithub.com\u002Fastral-sh\u002Fuv):\n\n```bash\nuv run llamafactory-cli webui\n```\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>For Windows users\u003C\u002Fsummary>\n\n#### Install PyTorch\n\nYou need to manually install the GPU version of PyTorch on the Windows platform. Please refer to the [official website](https:\u002F\u002Fpytorch.org\u002Fget-started\u002Flocally\u002F) and the following command to install PyTorch with CUDA support:\n\n```bash\npip uninstall torch torchvision torchaudio\npip install torch torchvision torchaudio --index-url https:\u002F\u002Fdownload.pytorch.org\u002Fwhl\u002Fcu126\npython -c \"import torch; print(torch.cuda.is_available())\"\n```\n\nIf you see `True` then you have successfully installed PyTorch with CUDA support.\n\nTry `dataloader_num_workers: 0` if you encounter `Can't pickle local object` error.\n\n#### Install BitsAndBytes\n\nIf you want to enable the quantized LoRA (QLoRA) on the Windows platform, you need to install a pre-built version of `bitsandbytes` library, which supports CUDA 11.1 to 12.2, please select the appropriate [release version](https:\u002F\u002Fgithub.com\u002Fjllllll\u002Fbitsandbytes-windows-webui\u002Freleases\u002Ftag\u002Fwheels) based on your CUDA version.\n\n```bash\npip install https:\u002F\u002Fgithub.com\u002Fjllllll\u002Fbitsandbytes-windows-webui\u002Freleases\u002Fdownload\u002Fwheels\u002Fbitsandbytes-0.41.2.post2-py3-none-win_amd64.whl\n```\n\n#### Install Flash Attention-2\n\nTo enable FlashAttention-2 on the Windows platform, please use the script from [flash-attention-windows-wheel](https:\u002F\u002Fhuggingface.co\u002Flldacing\u002Fflash-attention-windows-wheel) to compile and install it by yourself.\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>For Ascend NPU users\u003C\u002Fsummary>\n\nTo install LLaMA Factory on Ascend NPU devices, please upgrade Python to version 3.10 or higher: `pip install -r requirements\u002Fnpu.txt`. Additionally, you need to install the **Ascend CANN Toolkit and Kernels**. Please follow the [installation tutorial](https:\u002F\u002Fllamafactory.readthedocs.io\u002Fen\u002Flatest\u002Fadvanced\u002Fnpu_installation.html).\n\n\nYou can also download the pre-built Docker images:\n\n```bash\n# Docker Hub\ndocker pull hiyouga\u002Fllamafactory:latest-npu-a2\ndocker pull hiyouga\u002Fllamafactory:latest-npu-a3\n\n# quay.io\ndocker pull quay.io\u002Fascend\u002Fllamafactory:latest-npu-a2\ndocker pull quay.io\u002Fascend\u002Fllamafactory:latest-npu-a3\n```\n\n#### Install BitsAndBytes\n\nTo use QLoRA based on bitsandbytes on Ascend NPU, please follow these 3 steps:\n\n1. Manually compile bitsandbytes: Refer to [the installation documentation](https:\u002F\u002Fhuggingface.co\u002Fdocs\u002Fbitsandbytes\u002Finstallation?backend=Ascend+NPU&platform=Ascend+NPU) for the NPU version of bitsandbytes to complete the compilation and installation. The compilation requires a cmake version of at least 3.22.1 and a g++ version of at least 12.x.\n\n```bash\n# Install bitsandbytes from source\n# Clone bitsandbytes repo, Ascend NPU backend is currently enabled on multi-backend-refactor branch\ngit clone -b multi-backend-refactor https:\u002F\u002Fgithub.com\u002Fbitsandbytes-foundation\u002Fbitsandbytes.git\ncd bitsandbytes\u002F\n\n# Install dependencies\npip install -r requirements-dev.txt\n\n# Install the dependencies for the compilation tools. Note that the commands for this step may vary depending on the operating system. The following are provided for reference\napt-get install -y build-essential cmake\n\n# Compile & install  \ncmake -DCOMPUTE_BACKEND=npu -S .\nmake\npip install .\n```\n\n2. Install transformers from the main branch.\n\n```bash\ngit clone -b main https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Ftransformers.git\ncd transformers\npip install .\n```\n\n3. Set `double_quantization: false` in the configuration. You can refer to the [example](examples\u002Ftrain_qlora\u002Fqwen3_lora_sft_bnb_npu.yaml).\n\n\u003C\u002Fdetails>\n\n### Data Preparation\n\nPlease refer to [data\u002FREADME.md](data\u002FREADME.md) for checking the details about the format of dataset files. You can use datasets on HuggingFace \u002F ModelScope \u002F Modelers hub, load the dataset in local disk, or specify a path to s3\u002Fgcs cloud storage.\n\n> [!NOTE]\n> Please update `data\u002Fdataset_info.json` to use your custom dataset.\n\nYou can also use **[Easy Dataset](https:\u002F\u002Fgithub.com\u002FConardLi\u002Feasy-dataset)**, **[DataFlow](https:\u002F\u002Fgithub.com\u002FOpenDCAI\u002FDataFlow)** and **[GraphGen](https:\u002F\u002Fgithub.com\u002Fopen-sciencelab\u002FGraphGen)** to create synthetic data for fine-tuning.\n\n### Quickstart\n\nUse the following 3 commands to run LoRA **fine-tuning**, **inference** and **merging** of the Qwen3-4B-Instruct model, respectively.\n\n```bash\nllamafactory-cli train examples\u002Ftrain_lora\u002Fqwen3_lora_sft.yaml\nllamafactory-cli chat examples\u002Finference\u002Fqwen3_lora_sft.yaml\nllamafactory-cli export examples\u002Fmerge_lora\u002Fqwen3_lora_sft.yaml\n```\n\nSee [examples\u002FREADME.md](examples\u002FREADME.md) for advanced usage (including distributed training).\n\n> [!TIP]\n> Use `llamafactory-cli help` to show help information.\n>\n> Read [FAQs](https:\u002F\u002Fgithub.com\u002Fhiyouga\u002FLLaMA-Factory\u002Fissues\u002F4614) first if you encounter any problems.\n\n### Fine-Tuning with LLaMA Board GUI (powered by [Gradio](https:\u002F\u002Fgithub.com\u002Fgradio-app\u002Fgradio))\n\n```bash\nllamafactory-cli webui\n```\n\n### LLaMA Factory Online\n\nRead our [documentation](https:\u002F\u002Fdocs.llamafactory.com.cn\u002Fdocs\u002Fdocuments\u002Fquickstart\u002Fgetstarted\u002F?utm_source=LLaMA-Factory).\n\n### Build Docker\n\nFor CUDA users:\n\n```bash\ncd docker\u002Fdocker-cuda\u002F\ndocker compose up -d\ndocker compose exec llamafactory bash\n```\n\nFor Ascend NPU users:\n\n```bash\ncd docker\u002Fdocker-npu\u002F\ndocker compose up -d\ndocker compose exec llamafactory bash\n```\n\nFor AMD ROCm users:\n\n```bash\ncd docker\u002Fdocker-rocm\u002F\ndocker compose up -d\ndocker compose exec llamafactory bash\n```\n\n\u003Cdetails>\u003Csummary>Build without Docker Compose\u003C\u002Fsummary>\n\nFor CUDA users:\n\n```bash\ndocker build -f .\u002Fdocker\u002Fdocker-cuda\u002FDockerfile \\\n    --build-arg PIP_INDEX=https:\u002F\u002Fpypi.org\u002Fsimple \\\n    -t llamafactory:latest .\n\ndocker run -dit --ipc=host --gpus=all \\\n    -p 7860:7860 \\\n    -p 8000:8000 \\\n    --name llamafactory \\\n    llamafactory:latest\n\ndocker exec -it llamafactory bash\n```\n\nFor Ascend NPU users:\n\n```bash\ndocker build -f .\u002Fdocker\u002Fdocker-npu\u002FDockerfile \\\n    --build-arg PIP_INDEX=https:\u002F\u002Fpypi.org\u002Fsimple \\\n    -t llamafactory:latest .\n\ndocker run -dit --ipc=host \\\n    -v \u002Fusr\u002Flocal\u002Fdcmi:\u002Fusr\u002Flocal\u002Fdcmi \\\n    -v \u002Fusr\u002Flocal\u002Fbin\u002Fnpu-smi:\u002Fusr\u002Flocal\u002Fbin\u002Fnpu-smi \\\n    -v \u002Fusr\u002Flocal\u002FAscend\u002Fdriver:\u002Fusr\u002Flocal\u002FAscend\u002Fdriver \\\n    -v \u002Fetc\u002Fascend_install.info:\u002Fetc\u002Fascend_install.info \\\n    -p 7860:7860 \\\n    -p 8000:8000 \\\n    --device \u002Fdev\u002Fdavinci0 \\\n    --device \u002Fdev\u002Fdavinci_manager \\\n    --device \u002Fdev\u002Fdevmm_svm \\\n    --device \u002Fdev\u002Fhisi_hdc \\\n    --name llamafactory \\\n    llamafactory:latest\n\ndocker exec -it llamafactory bash\n```\n\nFor AMD ROCm users:\n\n```bash\ndocker build -f .\u002Fdocker\u002Fdocker-rocm\u002FDockerfile \\\n    --build-arg PIP_INDEX=https:\u002F\u002Fpypi.org\u002Fsimple \\\n    -t llamafactory:latest .\n\ndocker run -dit --ipc=host \\\n    -p 7860:7860 \\\n    -p 8000:8000 \\\n    --device \u002Fdev\u002Fkfd \\\n    --device \u002Fdev\u002Fdri \\\n    --name llamafactory \\\n    llamafactory:latest\n\ndocker exec -it llamafactory bash\n```\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>Use Docker volumes\u003C\u002Fsummary>\n\nYou can uncomment `VOLUME [ \"\u002Froot\u002F.cache\u002Fhuggingface\", \"\u002Fapp\u002Fshared_data\", \"\u002Fapp\u002Foutput\" ]` in the Dockerfile to use data volumes.\n\nWhen building the Docker image, use `-v .\u002Fhf_cache:\u002Froot\u002F.cache\u002Fhuggingface` argument to mount the local directory to the container. The following data volumes are available.\n\n- `hf_cache`: Utilize Hugging Face cache on the host machine.\n- `shared_data`: The directionary to store datasets on the host machine.\n- `output`: Set export dir to this location so that the merged result can be accessed directly on the host machine.\n\n\u003C\u002Fdetails>\n\n### Deploy with OpenAI-style API and vLLM\n\n```bash\nAPI_PORT=8000 llamafactory-cli api examples\u002Finference\u002Fqwen3.yaml infer_backend=vllm vllm_enforce_eager=true\n```\n\n> [!TIP]\n> Visit [this page](https:\u002F\u002Fplatform.openai.com\u002Fdocs\u002Fapi-reference\u002Fchat\u002Fcreate) for API document.\n>\n> Examples: [Image understanding](scripts\u002Fapi_example\u002Ftest_image.py) | [Function calling](scripts\u002Fapi_example\u002Ftest_toolcall.py)\n\n### Download from ModelScope Hub\n\nIf you have trouble with downloading models and datasets from Hugging Face, you can use ModelScope.\n\n```bash\nexport USE_MODELSCOPE_HUB=1 # `set USE_MODELSCOPE_HUB=1` for Windows\n```\n\nTrain the model by specifying a model ID of the ModelScope Hub as the `model_name_or_path`. You can find a full list of model IDs at [ModelScope Hub](https:\u002F\u002Fmodelscope.cn\u002Fmodels), e.g., `LLM-Research\u002FMeta-Llama-3-8B-Instruct`.\n\n### Download from Modelers Hub\n\nYou can also use Modelers Hub to download models and datasets.\n\n```bash\nexport USE_OPENMIND_HUB=1 # `set USE_OPENMIND_HUB=1` for Windows\n```\n\nTrain the model by specifying a model ID of the Modelers Hub as the `model_name_or_path`. You can find a full list of model IDs at [Modelers Hub](https:\u002F\u002Fmodelers.cn\u002Fmodels), e.g., `TeleAI\u002FTeleChat-7B-pt`.\n\n### Use W&B Logger\n\nTo use [Weights & Biases](https:\u002F\u002Fwandb.ai) for logging experimental results, you need to add the following arguments to yaml files.\n\n```yaml\nreport_to: wandb\nrun_name: test_run # optional\n```\n\nSet `WANDB_API_KEY` to [your key](https:\u002F\u002Fwandb.ai\u002Fauthorize) when launching training tasks to log in with your W&B account.\n\n### Use SwanLab Logger\n\nTo use [SwanLab](https:\u002F\u002Fgithub.com\u002FSwanHubX\u002FSwanLab) for logging experimental results, you need to add the following arguments to yaml files.\n\n```yaml\nuse_swanlab: true\nswanlab_run_name: test_run # optional\n```\n\nWhen launching training tasks, you can log in to SwanLab in three ways:\n\n1. Add `swanlab_api_key=\u003Cyour_api_key>` to the yaml file, and set it to your [API key](https:\u002F\u002Fswanlab.cn\u002Fsettings).\n2. Set the environment variable `SWANLAB_API_KEY` to your [API key](https:\u002F\u002Fswanlab.cn\u002Fsettings).\n3. Use the `swanlab login` command to complete the login.\n\n## Projects using LLaMA Factory\n\nIf you have a project that should be incorporated, please contact via email or create a pull request.\n\n\u003Cdetails>\u003Csummary>Click to show\u003C\u002Fsummary>\n\n1. Wang et al. ESRL: Efficient Sampling-based Reinforcement Learning for Sequence Generation. 2023. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2308.02223)\n1. Yu et al. Open, Closed, or Small Language Models for Text Classification? 2023. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2308.10092)\n1. Wang et al. UbiPhysio: Support Daily Functioning, Fitness, and Rehabilitation with Action Understanding and Feedback in Natural Language. 2023. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2308.10526)\n1. Luceri et al. Leveraging Large Language Models to Detect Influence Campaigns in Social Media. 2023. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2311.07816)\n1. Zhang et al. Alleviating Hallucinations of Large Language Models through Induced Hallucinations. 2023. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2312.15710)\n1. Wang et al. Know Your Needs Better: Towards Structured Understanding of Marketer Demands with Analogical Reasoning Augmented LLMs. KDD 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2401.04319)\n1. Wang et al. CANDLE: Iterative Conceptualization and Instantiation Distillation from Large Language Models for Commonsense Reasoning. ACL 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2401.07286)\n1. Choi et al. FACT-GPT: Fact-Checking Augmentation via Claim Matching with LLMs. 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2402.05904)\n1. Zhang et al. AutoMathText: Autonomous Data Selection with Language Models for Mathematical Texts. 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2402.07625)\n1. Lyu et al. KnowTuning: Knowledge-aware Fine-tuning for Large Language Models. 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2402.11176)\n1. Yang et al. LaCo: Large Language Model Pruning via Layer Collaps. 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2402.11187)\n1. Bhardwaj et al. Language Models are Homer Simpson! Safety Re-Alignment of Fine-tuned Language Models through Task Arithmetic. 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2402.11746)\n1. Yang et al. Enhancing Empathetic Response Generation by Augmenting LLMs with Small-scale Empathetic Models. 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2402.11801)\n1. Yi et al. Generation Meets Verification: Accelerating Large Language Model Inference with Smart Parallel Auto-Correct Decoding. ACL 2024 Findings. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2402.11809)\n1. Cao et al. Head-wise Shareable Attention for Large Language Models. 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2402.11819)\n1. Zhang et al. Enhancing Multilingual Capabilities of Large Language Models through Self-Distillation from Resource-Rich Languages. 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2402.12204)\n1. Kim et al. Efficient and Effective Vocabulary Expansion Towards Multilingual Large Language Models. 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2402.14714)\n1. Yu et al. KIEval: A Knowledge-grounded Interactive Evaluation Framework for Large Language Models. ACL 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2402.15043)\n1. Huang et al. Key-Point-Driven Data Synthesis with its Enhancement on Mathematical Reasoning. 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2403.02333)\n1. Duan et al. Negating Negatives: Alignment without Human Positive Samples via Distributional Dispreference Optimization. 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2403.03419)\n1. Xie and Schwertfeger. Empowering Robotics with Large Language Models: osmAG Map Comprehension with LLMs. 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2403.08228)\n1. Wu et al. Large Language Models are Parallel Multilingual Learners. 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2403.09073)\n1. Zhang et al. EDT: Improving Large Language Models' Generation by Entropy-based Dynamic Temperature Sampling. 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2403.14541)\n1. Weller et al. FollowIR: Evaluating and Teaching Information Retrieval Models to Follow Instructions. 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2403.15246)\n1. Hongbin Na. CBT-LLM: A Chinese Large Language Model for Cognitive Behavioral Therapy-based Mental Health Question Answering. COLING 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2403.16008)\n1. Zan et al. CodeS: Natural Language to Code Repository via Multi-Layer Sketch. 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2403.16443)\n1. Liu et al. Extensive Self-Contrast Enables Feedback-Free Language Model Alignment. 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2404.00604)\n1. Luo et al. BAdam: A Memory Efficient Full Parameter Training Method for Large Language Models. 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2404.02827)\n1. Du et al. Chinese Tiny LLM: Pretraining a Chinese-Centric Large Language Model. 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2404.04167)\n1. Ma et al. Parameter Efficient Quasi-Orthogonal Fine-Tuning via Givens Rotation. ICML 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2404.04316)\n1. Liu et al. Dynamic Generation of Personalities with Large Language Models. 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2404.07084)\n1. Shang et al. How Far Have We Gone in Stripped Binary Code Understanding Using Large Language Models. 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2404.09836)\n1. Huang et al. LLMTune: Accelerate Database Knob Tuning with Large Language Models. 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2404.11581)\n1. Deng et al. Text-Tuple-Table: Towards Information Integration in Text-to-Table Generation via Global Tuple Extraction. 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2404.14215)\n1. Acikgoz et al. Hippocrates: An Open-Source Framework for Advancing Large Language Models in Healthcare. 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2404.16621)\n1. Zhang et al. Small Language Models Need Strong Verifiers to Self-Correct Reasoning. ACL 2024 Findings. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2404.17140)\n1. Zhou et al. FREB-TQA: A Fine-Grained Robustness Evaluation Benchmark for Table Question Answering. NAACL 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2404.18585)\n1. Xu et al. Large Language Models for Cyber Security: A Systematic Literature Review. 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2405.04760)\n1. Dammu et al. \"They are uncultured\": Unveiling Covert Harms and Social Threats in LLM Generated Conversations. 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2405.05378)\n1. Yi et al. A safety realignment framework via subspace-oriented model fusion for large language models. 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2405.09055)\n1. Lou et al. SPO: Multi-Dimensional Preference Sequential Alignment With Implicit Reward Modeling. 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2405.12739)\n1. Zhang et al. Getting More from Less: Large Language Models are Good Spontaneous Multilingual Learners. 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2405.13816)\n1. Zhang et al. TS-Align: A Teacher-Student Collaborative Framework for Scalable Iterative Finetuning of Large Language Models. 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2405.20215)\n1. Zihong Chen. Sentence Segmentation and Sentence Punctuation Based on XunziALLM. 2024. [[paper]](https:\u002F\u002Faclanthology.org\u002F2024.lt4hala-1.30)\n1. Gao et al. The Best of Both Worlds: Toward an Honest and Helpful Large Language Model. 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2406.00380)\n1. Wang and Song. MARS: Benchmarking the Metaphysical Reasoning Abilities of Language Models with a Multi-task Evaluation Dataset. 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2406.02106)\n1. Hu et al. Computational Limits of Low-Rank Adaptation (LoRA) for Transformer-Based Models. 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2406.03136)\n1. Ge et al. Time Sensitive Knowledge Editing through Efficient Finetuning. ACL 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2406.04496)\n1. Tan et al. Peer Review as A Multi-Turn and Long-Context Dialogue with Role-Based Interactions. 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2406.05688)\n1. Song et al. Turbo Sparse: Achieving LLM SOTA Performance with Minimal Activated Parameters. 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2406.05955)\n1. Gu et al. RWKV-CLIP: A Robust Vision-Language Representation Learner. 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2406.06973)\n1. Chen et al. Advancing Tool-Augmented Large Language Models: Integrating Insights from Errors in Inference Trees. 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2406.07115)\n1. Zhu et al. Are Large Language Models Good Statisticians?. 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2406.07815)\n1. Li et al. Know the Unknown: An Uncertainty-Sensitive Method for LLM Instruction Tuning. 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2406.10099)\n1. Ding et al. IntentionQA: A Benchmark for Evaluating Purchase Intention Comprehension Abilities of Language Models in E-commerce. 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2406.10173)\n1. He et al. COMMUNITY-CROSS-INSTRUCT: Unsupervised Instruction Generation for Aligning Large Language Models to Online Communities. 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2406.12074)\n1. Lin et al. FVEL: Interactive Formal Verification Environment with Large Language Models via Theorem Proving. 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2406.14408)\n1. Treutlein et al. Connecting the Dots: LLMs can Infer and Verbalize Latent Structure from Disparate Training Data. 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2406.14546)\n1. Feng et al. SS-Bench: A Benchmark for Social Story Generation and Evaluation. 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2406.15695)\n1. Feng et al. Self-Constructed Context Decompilation with Fined-grained Alignment Enhancement. 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2406.17233)\n1. Liu et al. Large Language Models for Cuffless Blood Pressure Measurement From Wearable Biosignals. 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2406.18069)\n1. Iyer et al. Exploring Very Low-Resource Translation with LLMs: The University of Edinburgh's Submission to AmericasNLP 2024 Translation Task. AmericasNLP 2024. [[paper]](https:\u002F\u002Faclanthology.org\u002F2024.americasnlp-1.25)\n1. Li et al. Calibrating LLMs with Preference Optimization on Thought Trees for Generating Rationale in Science Question Scoring. 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2406.19949)\n1. Yang et al. Financial Knowledge Large Language Model. 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2407.00365)\n1. Lin et al. DogeRM: Equipping Reward Models with Domain Knowledge through Model Merging. 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2407.01470)\n1. Bako et al. Evaluating the Semantic Profiling Abilities of LLMs for Natural Language Utterances in Data Visualization. 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2407.06129)\n1. Huang et al. RoLoRA: Fine-tuning Rotated Outlier-free LLMs for Effective Weight-Activation Quantization. 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2407.08044)\n1. Jiang et al. LLM-Collaboration on Automatic Science Journalism for the General Audience. 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2407.09756)\n1. Inouye et al. Applied Auto-tuning on LoRA Hyperparameters. 2024. [[paper]](https:\u002F\u002Fscholarcommons.scu.edu\u002Fcseng_senior\u002F272\u002F)\n1. Qi et al. Research on Tibetan Tourism Viewpoints information generation system based on LLM. 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2407.13561)\n1. Xu et al. Course-Correction: Safety Alignment Using Synthetic Preferences. 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2407.16637)\n1. Sun et al. LAMBDA: A Large Model Based Data Agent. 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2407.17535)\n1. Zhu et al. CollectiveSFT: Scaling Large Language Models for Chinese Medical Benchmark with Collective Instructions in Healthcare. 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2407.19705)\n1. Yu et al. Correcting Negative Bias in Large Language Models through Negative Attention Score Alignment. 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2408.00137)\n1. Xie et al. The Power of Personalized Datasets: Advancing Chinese Composition Writing for Elementary School through Targeted Model Fine-Tuning. IALP 2024. [[paper]](https:\u002F\u002Fwww.asianlp.sg\u002Fconferences\u002Fialp2024\u002Fproceedings\u002Fpapers\u002FIALP2024_P055.pdf)\n1. Liu et al. Instruct-Code-Llama: Improving Capabilities of Language Model in Competition Level Code Generation by Online Judge Feedback. ICIC 2024. [[paper]](https:\u002F\u002Flink.springer.com\u002Fchapter\u002F10.1007\u002F978-981-97-5669-8_11)\n1. Wang et al. Cybernetic Sentinels: Unveiling the Impact of Safety Data Selection on Model Security in Supervised Fine-Tuning. ICIC 2024. [[paper]](https:\u002F\u002Flink.springer.com\u002Fchapter\u002F10.1007\u002F978-981-97-5669-8_23)\n1. Xia et al. Understanding the Performance and Estimating the Cost of LLM Fine-Tuning. 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2408.04693)\n1. Zeng et al. Perceive, Reflect, and Plan: Designing LLM Agent for Goal-Directed City Navigation without Instructions. 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2408.04168)\n1. Xia et al. Using Pre-trained Language Model for Accurate ESG Prediction. FinNLP 2024. [[paper]](https:\u002F\u002Faclanthology.org\u002F2024.finnlp-2.1\u002F)\n1. Liang et al. I-SHEEP: Self-Alignment of LLM from Scratch through an Iterative Self-Enhancement Paradigm. 2024. [[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2408.08072)\n1. Bai et al. Aligning Large Language Model with Direct Multi-Preference Optimization for Recommendation. CIKM 2024. [[paper]](https:\u002F\u002Fdl.acm.org\u002Fdoi\u002F10.1145\u002F3627673.3679611)\n1. Zhang et al. CPsyCoun: A Report-based Multi-turn Dialogue Reconstruction and Evaluation Framework for Chinese Psychological Counseling. ACL 2024. [[paper]](https:\u002F\u002Faclanthology.org\u002F2024.findings-acl.830.pdf)\n1. **[StarWhisper](https:\u002F\u002Fgithub.com\u002FYu-Yang-Li\u002FStarWhisper)**: A large language model for Astronomy, based on ChatGLM2-6B and Qwen-14B.\n1. **[DISC-LawLLM](https:\u002F\u002Fgithub.com\u002FFudanDISC\u002FDISC-LawLLM)**: A large language model specialized in Chinese legal domain, based on Baichuan-13B, is capable of retrieving and reasoning on legal knowledge.\n1. **[Sunsimiao](https:\u002F\u002Fgithub.com\u002FX-D-Lab\u002FSunsimiao)**: A large language model specialized in Chinese medical domain, based on Baichuan-7B and ChatGLM-6B.\n1. **[CareGPT](https:\u002F\u002Fgithub.com\u002FWangRongsheng\u002FCareGPT)**: A series of large language models for Chinese medical domain, based on LLaMA2-7B and Baichuan-13B.\n1. **[MachineMindset](https:\u002F\u002Fgithub.com\u002FPKU-YuanGroup\u002FMachine-Mindset\u002F)**: A series of MBTI Personality large language models, capable of giving any LLM 16 different personality types based on different datasets and training methods.\n1. **[Luminia-13B-v3](https:\u002F\u002Fhuggingface.co\u002FNekochu\u002FLuminia-13B-v3)**: A large language model specialized in generate metadata for stable diffusion. [[demo]](https:\u002F\u002Fhuggingface.co\u002Fspaces\u002FNekochu\u002FLuminia-13B_SD_Prompt)\n1. **[Chinese-LLaVA-Med](https:\u002F\u002Fgithub.com\u002FBUAADreamer\u002FChinese-LLaVA-Med)**: A multimodal large language model specialized in Chinese medical domain, based on LLaVA-1.5-7B.\n1. **[AutoRE](https:\u002F\u002Fgithub.com\u002FTHUDM\u002FAutoRE)**: A document-level relation extraction system based on large language models.\n1. **[NVIDIA RTX AI Toolkit](https:\u002F\u002Fgithub.com\u002FNVIDIA\u002FRTX-AI-Toolkit)**: SDKs for fine-tuning LLMs on Windows PC for NVIDIA RTX.\n1. **[LazyLLM](https:\u002F\u002Fgithub.com\u002FLazyAGI\u002FLazyLLM)**: An easy and lazy way for building multi-agent LLMs applications and supports model fine-tuning via LLaMA Factory.\n1. **[RAG-Retrieval](https:\u002F\u002Fgithub.com\u002FNLPJCL\u002FRAG-Retrieval)**: A full pipeline for RAG retrieval model fine-tuning, inference, and distillation. [[blog]](https:\u002F\u002Fzhuanlan.zhihu.com\u002Fp\u002F987727357)\n1. **[360-LLaMA-Factory](https:\u002F\u002Fgithub.com\u002FQihoo360\u002F360-LLaMA-Factory)**: A modified library that supports long sequence SFT & DPO using ring attention.\n1. **[Sky-T1](https:\u002F\u002Fnovasky-ai.github.io\u002Fposts\u002Fsky-t1\u002F)**: An o1-like model fine-tuned by NovaSky AI with very small cost.\n1. **[WeClone](https:\u002F\u002Fgithub.com\u002Fxming521\u002FWeClone)**: One-stop solution for creating your digital avatar from chat logs.\n1. **[EmoLLM](https:\u002F\u002Fgithub.com\u002FSmartFlowAI\u002FEmoLLM)**: A project about large language models (LLMs) and mental health.\n\u003C\u002Fdetails>\n\n## License\n\nThis repository is licensed under the [Apache-2.0 License](LICENSE).\n\nPlease follow the model licenses to use the corresponding model weights: [BLOOM](https:\u002F\u002Fhuggingface.co\u002Fspaces\u002Fbigscience\u002Flicense) \u002F [DeepSeek](https:\u002F\u002Fgithub.com\u002Fdeepseek-ai\u002FDeepSeek-LLM\u002Fblob\u002Fmain\u002FLICENSE-MODEL) \u002F [Falcon](https:\u002F\u002Fhuggingface.co\u002Ftiiuae\u002Ffalcon-180B\u002Fblob\u002Fmain\u002FLICENSE.txt) \u002F [Gemma](https:\u002F\u002Fai.google.dev\u002Fgemma\u002Fterms) \u002F [GLM-4](https:\u002F\u002Fhuggingface.co\u002FTHUDM\u002Fglm-4-9b\u002Fblob\u002Fmain\u002FLICENSE) \u002F [GPT-2](https:\u002F\u002Fgithub.com\u002Fopenai\u002Fgpt-2\u002Fblob\u002Fmaster\u002FLICENSE) \u002F [Granite](LICENSE) \u002F [InternLM](https:\u002F\u002Fgithub.com\u002FInternLM\u002FInternLM#license) \u002F [Llama](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002Fllama\u002Fblob\u002Fmain\u002FMODEL_CARD.md) \u002F [Llama 2](https:\u002F\u002Fai.meta.com\u002Fllama\u002Flicense\u002F) \u002F [Llama 3](https:\u002F\u002Fllama.meta.com\u002Fllama3\u002Flicense\u002F) \u002F [Llama 4](https:\u002F\u002Fgithub.com\u002Fmeta-llama\u002Fllama-models\u002Fblob\u002Fmain\u002Fmodels\u002Fllama4\u002FLICENSE) \u002F [MiniCPM](https:\u002F\u002Fgithub.com\u002FOpenBMB\u002FMiniCPM\u002Fblob\u002Fmain\u002FMiniCPM%20Model%20License.md) \u002F [Mistral\u002FMixtral\u002FPixtral](LICENSE) \u002F [Phi-3\u002FPhi-4](https:\u002F\u002Fhuggingface.co\u002Fmicrosoft\u002FPhi-3-mini-4k-instruct\u002Fblob\u002Fmain\u002FLICENSE) \u002F [Qwen](https:\u002F\u002Fgithub.com\u002FQwenLM\u002FQwen\u002Fblob\u002Fmain\u002FTongyi%20Qianwen%20LICENSE%20AGREEMENT) \u002F [StarCoder 2](https:\u002F\u002Fhuggingface.co\u002Fspaces\u002Fbigcode\u002Fbigcode-model-license-agreement) \u002F [TeleChat2](https:\u002F\u002Fhuggingface.co\u002FTele-AI\u002Ftelechat-7B\u002Fblob\u002Fmain\u002FTeleChat%E6%A8%A1%E5%9E%8B%E7%A4%BE%E5%8C%BA%E8%AE%B8%E5%8F%AF%E5%8D%8F%E8%AE%AE.pdf) \u002F [Yuan 2](https:\u002F\u002Fgithub.com\u002FIEIT-Yuan\u002FYuan-2.0\u002Fblob\u002Fmain\u002FLICENSE-Yuan)\n\n## Citation\n\nIf this work is helpful, please kindly cite as:\n\n```bibtex\n@inproceedings{zheng2024llamafactory,\n  title={LlamaFactory: Unified Efficient Fine-Tuning of 100+ Language Models},\n  author={Yaowei Zheng and Richong Zhang and Junhao Zhang and Yanhan Ye and Zheyan Luo and Zhangchi Feng and Yongqiang Ma},\n  booktitle={Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 3: System Demonstrations)},\n  address={Bangkok, Thailand},\n  publisher={Association for Computational Linguistics},\n  year={2024},\n  url={http:\u002F\u002Farxiv.org\u002Fabs\u002F2403.13372}\n}\n```\n\n## Acknowledgement\n\nThis repo benefits from [PEFT](https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Fpeft), [TRL](https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Ftrl), [QLoRA](https:\u002F\u002Fgithub.com\u002Fartidoro\u002Fqlora) and [FastChat](https:\u002F\u002Fgithub.com\u002Flm-sys\u002FFastChat). Thanks for their wonderful works.\n\n## Star History\n\n![Star History Chart](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fhiyouga_LlamaFactory_readme_eb1701c90259.png)\n","![# LLaMA Factory](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fhiyouga_LlamaFactory_readme_4fc78d1daa24.png)\n\n[![GitHub 仓库星级](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fstars\u002Fhiyouga\u002FLLaMA-Factory?style=social)](https:\u002F\u002Fgithub.com\u002Fhiyouga\u002FLLaMA-Factory\u002Fstargazers)\n[![GitHub 最近一次提交](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Flast-commit\u002Fhiyouga\u002FLLaMA-Factory)](https:\u002F\u002Fgithub.com\u002Fhiyouga\u002FLLaMA-Factory\u002Fcommits\u002Fmain)\n[![GitHub 贡献者](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fcontributors\u002Fhiyouga\u002FLLaMA-Factory?color=orange)](https:\u002F\u002Fgithub.com\u002Fhiyouga\u002FLLaMA-Factory\u002Fgraphs\u002Fcontributors)\n[![GitHub 工作流](https:\u002F\u002Fgithub.com\u002Fhiyouga\u002FLLaMA-Factory\u002Factions\u002Fworkflows\u002Ftests.yml\u002Fbadge.svg)](https:\u002F\u002Fgithub.com\u002Fhiyouga\u002FLLaMA-Factory\u002Factions\u002Fworkflows\u002Ftests.yml)\n[![PyPI](https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fv\u002Fllamafactory)](https:\u002F\u002Fpypi.org\u002Fproject\u002Fllamafactory\u002F)\n[![引用](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fcitation-1000+-green)](https:\u002F\u002Fscholar.google.com\u002Fscholar?cites=12620864006390196564)\n[![Docker 拉取次数](https:\u002F\u002Fimg.shields.io\u002Fdocker\u002Fpulls\u002Fhiyouga\u002Fllamafactory)](https:\u002F\u002Fhub.docker.com\u002Fr\u002Fhiyouga\u002Fllamafactory\u002Ftags)\n\n[![Twitter](https:\u002F\u002Fimg.shields.io\u002Ftwitter\u002Ffollow\u002Fllamafactory_ai)](https:\u002F\u002Ftwitter.com\u002Fllamafactory_ai)\n[![Discord](assets\u002Fthirdparty\u002Fdiscord.svg)](https:\u002F\u002Fdiscord.gg\u002FrKfvV9r9FK)\n[![WeChat](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FWeChat-User%20Group-blue?logo=wechat)](https:\u002F\u002Fgithub.com\u002Fhiyouga\u002Fllamafactory-community)\n[![博客](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FHugo-Official%20Blog-blue?logo=hugo)](https:\u002F\u002Fblog.llamafactory.net\u002Fen\u002F)\n\n[![在 Colab 中打开](assets\u002Fthirdparty\u002Fcolab.svg)](https:\u002F\u002Fcolab.research.google.com\u002Fdrive\u002F1eRTPn37ltBbYsISy9Aw2NuI2Aq5CQrD9?usp=sharing)\n[![在 DSW 中打开](assets\u002Fthirdparty\u002Fdsw.svg)](https:\u002F\u002Fgallery.pai-ml.com\u002F#\u002Fpreview\u002FdeepLearning\u002Fnlp\u002Fllama_factory)\n[![在 Lab4ai 中打开](assets\u002Fthirdparty\u002Flab4ai.svg)](https:\u002F\u002Fwww.lab4ai.cn\u002Fcourse\u002Fdetail?id=7c13e60f6137474eb40f6fd3983c0f46&utm_source=LLaMA-Factory)\n[![在 Online 中打开](assets\u002Fthirdparty\u002Fonline.svg)](https:\u002F\u002Fwww.llamafactory.com.cn\u002F?utm_source=LLaMA-Factory)\n[![在 Spaces 中打开](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002F🤗-Open%20in%20Spaces-blue)](https:\u002F\u002Fhuggingface.co\u002Fspaces\u002Fhiyouga\u002FLLaMA-Board)\n[![在 Studios 中打开](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FModelScope-Open%20in%20Studios-blue)](https:\u002F\u002Fmodelscope.cn\u002Fstudios\u002Fhiyouga\u002FLLaMA-Board)\n[![在 Novita 中打开](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FNovita-Deploy%20Template-blue)](https:\u002F\u002Fnovita.ai\u002Ftemplates-library\u002F105981?sharer=88115474-394e-4bda-968e-b88e123d0c47)\n\n### 已被 [Amazon](https:\u002F\u002Faws.amazon.com\u002Fcn\u002Fblogs\u002Fmachine-learning\u002Fhow-apoidea-group-enhances-visual-information-extraction-from-banking-documents-with-multimodal-models-using-llama-factory-on-amazon-sagemaker-hyperpod\u002F)、[NVIDIA](https:\u002F\u002Fdeveloper.nvidia.com\u002Frtx\u002Fai-toolkit)、[阿里云](https:\u002F\u002Fhelp.aliyun.com\u002Fzh\u002Fpai\u002Fuse-cases\u002Ffine-tune-a-llama-3-model-with-llama-factory)等采用。\n\n\u003Cdiv align=\"center\" markdown=\"1\">\n\n### 支持者 ❤️\n\n| \u003Cdiv style=\"text-align: center;\">\u003Ca href=\"https:\u002F\u002Fwarp.dev\u002Fllama-factory\">\u003Cimg alt=\"Warp 赞助\" width=\"400\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fhiyouga_LlamaFactory_readme_39ad7a71b3f4.jpg\">\u003C\u002Fa>\u003Cbr>\u003Ca href=\"https:\u002F\u002Fwarp.dev\u002Fllama-factory\" style=\"font-size:larger;\">Warp，开发者的智能终端\u003C\u002Fa>\u003Cbr>\u003Ca href=\"https:\u002F\u002Fwarp.dev\u002Fllama-factory\">适用于 MacOS、Linux 和 Windows\u003C\u002Fa> | \u003Ca href=\"https:\u002F\u002Fserpapi.com\">\u003Cimg alt=\"SerpAPI 赞助\" width=\"250\" src=\"assets\u002Fsponsors\u002Fserpapi.svg\"> \u003C\u002Fa> |\n| ---- | ---- |\n\n----\n\n### 无需代码即可轻松微调 100 多种大型语言模型 [CLI](#quickstart) 和 [Web UI](#fine-tuning-with-llama-board-gui-powered-by-gradio)\n\n![GitHub 趋势](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fhiyouga_LlamaFactory_readme_4a68feb902da.png)\n\n\u003C\u002Fdiv>\n\n👋 加入我们的 [WeChat](https:\u002F\u002Fgithub.com\u002Fhiyouga\u002Fllamafactory-community\u002Fblob\u002Fmain\u002Fwechat\u002Fmain.jpg)、[NPU](https:\u002F\u002Fgithub.com\u002Fhiyouga\u002Fllamafactory-community\u002Fblob\u002Fmain\u002Fwechat\u002Fnpu.jpg)、[Lab4AI](https:\u002F\u002Fgithub.com\u002Fhiyouga\u002Fllamafactory-community\u002Fblob\u002Fmain\u002Fwechat\u002Flab4ai.jpg)、[LLaMA Factory Online](https:\u002F\u002Fgithub.com\u002Fhiyouga\u002Fllamafactory-community\u002Fblob\u002Fmain\u002Fwechat\u002Fonline.jpg) 用户群。\n\n\\[ 英文 | [中文](README_zh.md) \\]\n\n**微调大型语言模型可以像…一样简单**\n\nhttps:\u002F\u002Fgithub.com\u002Fuser-attachments\u002Fassets\u002F3991a3a8-4276-4d30-9cab-4cb0c4b9b99e\n\n开始本地训练：\n- 请参考 [使用方法](#getting-started)\n\n开始云端训练：\n- **Colab（免费）**：https:\u002F\u002Fcolab.research.google.com\u002Fdrive\u002F1eRTPn37ltBbYsISy9Aw2NuI2Aq5CQrD9?usp=sharing\n- **PAI-DSW（免费试用）**：https:\u002F\u002Fgallery.pai-ml.com\u002F#\u002Fpreview\u002FdeepLearning\u002Fnlp\u002Fllama_factory\n- **LLaMA Factory Online**：https:\u002F\u002Fwww.llamafactory.com.cn\u002F?utm_source=LLaMA-Factory\n- **Alaya NeW（云 GPU 优惠）**：https:\u002F\u002Fdocs.alayanew.com\u002Fdocs\u002Fdocuments\u002FuseGuide\u002FLLaMAFactory\u002Fmutiple\u002F?utm_source=LLaMA-Factory\n\n阅读技术文档：\n- **文档（持续更新中）**：https:\u002F\u002Fllamafactory.readthedocs.io\u002Fen\u002Flatest\u002F\n- **AMD GPU 文档**：https:\u002F\u002Frocm.docs.amd.com\u002Fprojects\u002Fai-developer-hub\u002Fen\u002Flatest\u002Fnotebooks\u002Ffine_tune\u002Fllama_factory_llama3.html\n- **官方博客**：https:\u002F\u002Fblog.llamafactory.net\u002Fen\u002F\n- **官方课程**：https:\u002F\u002Fwww.lab4ai.cn\u002Fcourse\u002Fdetail?id=7c13e60f6137474eb40f6fd3983c0f46&utm_source=LLaMA-Factory\n\n> [!注意]\n> 除上述链接外，其他所有网站均为未经授权的第三方网站，请谨慎使用。\n\n## 目录\n\n- [功能](#features)\n- [博客](#blogs)\n- [变更日志](#changelog)\n- [支持的模型](#supported-models)\n- [支持的训练方法](#supported-training-approaches)\n- [提供的数据集](#provided-datasets)\n- [要求](#requirement)\n- [开始使用](#getting-started)\n  - [安装](#installation)\n  - [数据准备](#data-preparation)\n  - [快速入门](#quickstart)\n  - [使用 LLaMA Board GUI 进行微调](#fine-tuning-with-llama-board-gui-powered-by-gradio)\n  - [LLaMA Factory Online](#llama-factory-online)\n  - [构建 Docker 镜像](#build-docker)\n  - [通过 OpenAI 风格 API 和 vLLM 部署](#deploy-with-openai-style-api-and-vllm)\n  - [从 ModelScope Hub 下载](#download-from-modelscope-hub)\n  - [从 Modelers Hub 下载](#download-from-modelers-hub)\n  - [使用 W&B 日志记录器](#use-wb-logger)\n  - [使用 SwanLab 日志记录器](#use-swanlab-logger)\n- [使用 LLaMA Factory 的项目](#projects-using-llama-factory)\n- [许可证](#license)\n- [引用](#citation)\n- [致谢](#acknowledgement)\n\n## 特性\n\n- **多种模型**：LLaMA、LLaVA、Mistral、Mixtral-MoE、Qwen3、Qwen3-VL、DeepSeek、Gemma、GLM、Phi 等。\n- **集成方法**：（连续）预训练、（多模态）监督微调、奖励建模、PPO、DPO、KTO、ORPO 等。\n- **可扩展资源**：通过 AQLM\u002FAWQ\u002FGPTQ\u002FLLM.int8\u002FHQQ\u002FEETQ 实现 16 位全量微调、冻结微调、LoRA 以及 2\u002F3\u002F4\u002F5\u002F6\u002F8 位 QLoRA。\n- **先进算法**：[GaLore](https:\u002F\u002Fgithub.com\u002Fjiaweizzhao\u002FGaLore)、[BAdam](https:\u002F\u002Fgithub.com\u002FLedzy\u002FBAdam)、[APOLLO](https:\u002F\u002Fgithub.com\u002Fzhuhanqing\u002FAPOLLO)、[Adam-mini](https:\u002F\u002Fgithub.com\u002Fzyushun\u002FAdam-mini)、[Muon](https:\u002F\u002Fgithub.com\u002FKellerJordan\u002FMuon)、[OFT](https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Fpeft\u002Ftree\u002Fmain\u002Fsrc\u002Fpeft\u002Ftuners\u002Foft)、DoRA、LongLoRA、LLaMA Pro、Mixture-of-Depths、LoRA+、LoftQ 和 PiSSA。\n- **实用技巧**：[FlashAttention-2](https:\u002F\u002Fgithub.com\u002FDao-AILab\u002Fflash-attention)、[Unsloth](https:\u002F\u002Fgithub.com\u002Funslothai\u002Funsloth)、[Liger Kernel](https:\u002F\u002Fgithub.com\u002Flinkedin\u002FLiger-Kernel)、[KTransformers](https:\u002F\u002Fgithub.com\u002Fkvcache-ai\u002Fktransformers\u002F)、RoPE 缩放、NEFTune 和 rsLoRA。\n- **广泛任务**：多轮对话、工具使用、图像理解、视觉定位、视频识别、音频理解等。\n- **实验监控工具**：LlamaBoard、TensorBoard、Wandb、MLflow、[SwanLab](https:\u002F\u002Fgithub.com\u002FSwanHubX\u002FSwanLab) 等。\n- **更快推理**：OpenAI 风格的 API、Gradio UI 和 CLI，搭配 [vLLM worker](https:\u002F\u002Fgithub.com\u002Fvllm-project\u002Fvllm) 或 [SGLang worker](https:\u002F\u002Fgithub.com\u002Fsgl-project\u002Fsglang)。\n\n### Day-N 对前沿模型微调的支持\n\n| 支持日期 | 模型名称                                                           |\n| ---------- | -------------------------------------------------------------------- |\n| 第 0 天    | Qwen3 \u002F Qwen2.5-VL \u002F Gemma 3 \u002F GLM-4.1V \u002F InternLM 3 \u002F MiniCPM-o-2.6 |\n| 第 1 天    | Llama 3 \u002F GLM-4 \u002F Mistral Small \u002F PaliGemma2 \u002F Llama 4               |\n\n## 博客\n\n> [!TIP]\n> 我们现在为 LLaMA Factory 设立了专属博客！\n>\n> 网站：https:\u002F\u002Fblog.llamafactory.net\u002Fen\u002F\n\n- 💡 [KTransformers 微调 × LLaMA Factory：用 2 块 4090 显卡 + CPU 微调 10000 亿参数模型](https:\u002F\u002Fblog.llamafactory.net\u002Fen\u002Fposts\u002Fktransformers\u002F)（英文）\n- 💡 [Easy Dataset × LLaMA Factory：让大模型高效学习领域知识](https:\u002F\u002Fbuaa-act.feishu.cn\u002Fwiki\u002FGVzlwYcRFiR8OLkHbL6cQpYin7g)（英文）\n- [使用 LLaMA-Factory 微调心理健康领域的 LLM](https:\u002F\u002Fwww.lab4ai.cn\u002Fproject\u002Fdetail?id=25cce32ec131497b9e06a93336a0817f&type=project&utm_source=LLaMA-Factory)（中文）\n- [使用 LLaMA-Factory 微调 GPT-OSS 以用于角色扮演](https:\u002F\u002Fdocs.llamafactory.com.cn\u002Fdocs\u002Fdocuments\u002Fbest-practice\u002Fgptroleplay\u002F?utm_source=LLaMA-Factory)（中文）\n- [基于 LLaMA-Factory 和 EasyR1 的一站式无代码模型强化学习与部署平台](https:\u002F\u002Faws.amazon.com\u002Fcn\u002Fblogs\u002Fchina\u002Fbuilding-llm-model-hub-based-on-llamafactory-and-easyr1\u002F)（中文）\n- [Apoidea Group 如何利用 LLaMA-Factory 在 Amazon SageMaker HyperPod 上，通过多模态模型增强银行文档的视觉信息提取](https:\u002F\u002Faws.amazon.com\u002Fcn\u002Fblogs\u002Fmachine-learning\u002Fhow-apoidea-group-enhances-visual-information-extraction-from-banking-documents-with-multimodal-models-using-llama-factory-on-amazon-sagemaker-hyperpod\u002F)（英文）\n\n\u003Cdetails>\u003Csummary>所有博客\u003C\u002Fsummary>\n\n- [使用 LLaMA-Factory 微调 Llama3.1-70B 以用于医学诊断](https:\u002F\u002Fdocs.alayanew.com\u002Fdocs\u002Fdocuments\u002FbestPractice\u002FbigModel\u002Fllama70B\u002F?utm_source=LLaMA-Factory)（中文）\n- [使用 LLaMA-Factory 微调 Qwen2.5-VL 以用于自动驾驶](https:\u002F\u002Fdocs.alayanew.com\u002Fdocs\u002Fdocuments\u002FuseGuide\u002FLLaMAFactory\u002Fmutiple\u002F?utm_source=LLaMA-Factory)（中文）\n- [LLaMA Factory：微调 DeepSeek-R1-Distill-Qwen-7B 模型以用于新闻分类](https:\u002F\u002Fgallery.pai-ml.com\u002F#\u002Fpreview\u002FdeepLearning\u002Fnlp\u002Fllama_factory_deepseek_r1_distill_7b)（中文）\n- [基于 SageMaker 和 LLaMA-Factory 的一站式无代码模型微调与部署平台](https:\u002F\u002Faws.amazon.com\u002Fcn\u002Fblogs\u002Fchina\u002Fa-one-stop-code-free-model-fine-tuning-deployment-platform-based-on-sagemaker-and-llama-factory\u002F)（中文）\n- [LLaMA Factory 多模态微调实践：微调 Qwen2-VL 以用于个人旅游指南](https:\u002F\u002Fgallery.pai-ml.com\u002F#\u002Fpreview\u002FdeepLearning\u002Fnlp\u002Fllama_factory_qwen2vl)（中文）\n- [LLaMA Factory：微调 Llama3 以用于角色扮演](https:\u002F\u002Fgallery.pai-ml.com\u002F#\u002Fpreview\u002FdeepLearning\u002Fnlp\u002Fllama_factory)（中文）\n\n\u003C\u002Fdetails>\n\n## 更改日志\n\n[25\u002F10\u002F26] 我们支持 Megatron-core 训练后端，使用 [**mcore_adapter**](https:\u002F\u002Fgithub.com\u002Falibaba\u002FROLL\u002Ftree\u002Fmain\u002Fmcore_adapter)。请参阅 [PR #9237](https:\u002F\u002Fgithub.com\u002Fhiyouga\u002FLLaMA-Factory\u002Fpull\u002F9237) 以开始使用。\n\n[25\u002F08\u002F22] 我们新增支持 **[OFT](https:\u002F\u002Farxiv.org\u002Fabs\u002F2306.07280)** 和 **[OFTv2](https:\u002F\u002Farxiv.org\u002Fabs\u002F2506.19847)**。使用方法请参阅 [示例](examples\u002FREADME.md)。\n\n[25\u002F08\u002F20] 我们新增支持微调 **[Intern-S1-mini](https:\u002F\u002Fhuggingface.co\u002Finternlm\u002FIntern-S1-mini)** 模型。请参阅 [PR #8976](https:\u002F\u002Fgithub.com\u002Fhiyouga\u002FLLaMA-Factory\u002Fpull\u002F8976) 以开始使用。\n\n[25\u002F08\u002F06] 我们新增支持微调 **[GPT-OSS](https:\u002F\u002Fgithub.com\u002Fopenai\u002Fgpt-oss)** 模型。请参阅 [PR #8826](https:\u002F\u002Fgithub.com\u002Fhiyouga\u002FLLaMA-Factory\u002Fpull\u002F8826) 以开始使用。\n\n\u003Cdetails>\u003Csummary>完整更改日志\u003C\u002Fsummary>\n\n[25\u002F07\u002F02] 我们新增支持微调 **[GLM-4.1V-9B-Thinking](https:\u002F\u002Fgithub.com\u002FTHUDM\u002FGLM-4.1V-Thinking)** 模型。\n\n[25\u002F04\u002F28] 我们新增支持微调 **[Qwen3](https:\u002F\u002Fqwenlm.github.io\u002Fblog\u002Fqwen3\u002F)** 系列模型。\n\n[25\u002F04\u002F21] 我们新增支持 **[Muon](https:\u002F\u002Fgithub.com\u002FKellerJordan\u002FMuon)** 优化器。使用方法请参阅 [示例](examples\u002FREADME.md)。感谢 [@tianshijing](https:\u002F\u002Fgithub.com\u002Ftianshijing) 的 PR。\n\n[25\u002F04\u002F16] 我们新增支持微调 **[InternVL3](https:\u002F\u002Fhuggingface.co\u002FOpenGVLab\u002FInternVL3-8B)** 模型。请参阅 [PR #7258](https:\u002F\u002Fgithub.com\u002Fhiyouga\u002FLLaMA-Factory\u002Fpull\u002F7258) 以开始使用。\n\n[25\u002F04\u002F14] 我们新增支持微调 **[GLM-Z1](https:\u002F\u002Fhuggingface.co\u002FTHUDM\u002FGLM-Z1-9B-0414)** 和 **[Kimi-VL](https:\u002F\u002Fhuggingface.co\u002Fmoonshotai\u002FKimi-VL-A3B-Instruct)** 模型。\n\n[25\u002F04\u002F06] 我们新增支持微调 **[Llama 4](https:\u002F\u002Fai.meta.com\u002Fblog\u002Fllama-4-multimodal-intelligence\u002F)** 模型。请参阅 [PR #7611](https:\u002F\u002Fgithub.com\u002Fhiyouga\u002FLLaMA-Factory\u002Fpull\u002F7611) 以开始使用。\n\n[25\u002F03\u002F31] 我们新增支持微调 **[Qwen2.5 Omni](https:\u002F\u002Fqwenlm.github.io\u002Fblog\u002Fqwen2.5-omni\u002F)** 模型。请参阅 [PR #7537](https:\u002F\u002Fgithub.com\u002Fhiyouga\u002FLLaMA-Factory\u002Fpull\u002F7537) 以开始使用。\n\n[25\u002F03\u002F15] 我们新增支持 **[SGLang](https:\u002F\u002Fgithub.com\u002Fsgl-project\u002Fsglang)** 作为推理后端。尝试设置 `infer_backend: sglang` 以加速推理。\n\n[25\u002F03\u002F12] 我们新增支持微调 **[Gemma 3](https:\u002F\u002Fhuggingface.co\u002Fblog\u002Fgemma3)** 模型。\n\n[25\u002F02\u002F24] 宣布推出 **[EasyR1](https:\u002F\u002Fgithub.com\u002Fhiyouga\u002FEasyR1)**，这是一个高效、可扩展且支持多模态的 RL 训练框架，专为高效的 GRPO 训练而设计。\n\n[25\u002F02\u002F11] 我们支持在导出模型检查点时保存 **[Ollama](https:\u002F\u002Fgithub.com\u002Follama\u002Follama)** 的 modelfile。使用方法请参阅 [示例](examples\u002FREADME.md)。\n\n[25\u002F02\u002F05] 我们支持在音频理解任务上对 **[Qwen2-Audio](Qwen\u002FQwen2-Audio-7B-Instruct)** 和 **[MiniCPM-o-2.6](https:\u002F\u002Fhuggingface.co\u002Fopenbmb\u002FMiniCPM-o-2_6)** 进行微调。\n\n[25\u002F01\u002F31] 我们支持对 **[DeepSeek-R1](https:\u002F\u002Fhuggingface.co\u002Fdeepseek-ai\u002FDeepSeek-R1)** 和 **[Qwen2.5-VL](https:\u002F\u002Fhuggingface.co\u002FQwen\u002FQwen2.5-VL-7B-Instruct)** 模型进行微调。\n\n[25\u002F01\u002F15] 我们支持 **[APOLLO](https:\u002F\u002Farxiv.org\u002Fabs\u002F2412.05270)** 优化器。使用方法请参阅 [示例](examples\u002FREADME.md)。\n\n[25\u002F01\u002F14] 我们支持对 **[MiniCPM-o-2.6](https:\u002F\u002Fhuggingface.co\u002Fopenbmb\u002FMiniCPM-o-2_6)** 和 **[MiniCPM-V-2.6](https:\u002F\u002Fhuggingface.co\u002Fopenbmb\u002FMiniCPM-V-2_6)** 模型进行微调。感谢 [@BUAADreamer](https:\u002F\u002Fgithub.com\u002FBUAADreamer) 的 PR。\n\n[25\u002F01\u002F14] 我们支持对 **[InternLM 3](https:\u002F\u002Fhuggingface.co\u002Fcollections\u002Finternlm\u002F)** 模型进行微调。感谢 [@hhaAndroid](https:\u002F\u002Fgithub.com\u002FhhaAndroid) 的 PR。\n\n[25\u002F01\u002F10] 我们支持对 **[Phi-4](https:\u002F\u002Fhuggingface.co\u002Fmicrosoft\u002Fphi-4)** 模型进行微调。\n\n[24\u002F12\u002F21] 我们支持使用 **[SwanLab](https:\u002F\u002Fgithub.com\u002FSwanHubX\u002FSwanLab)** 进行实验跟踪和可视化。详情请参阅 [本节](#use-swanlab-logger)。\n\n[24\u002F11\u002F27] 我们支持对 **[Skywork-o1](https:\u002F\u002Fhuggingface.co\u002FSkywork\u002FSkywork-o1-Open-Llama-3.1-8B)** 模型以及 **[OpenO1](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FO1-OPEN\u002FOpenO1-SFT)** 数据集进行微调。\n\n[24\u002F10\u002F09] 我们支持从 **[Modelers Hub](https:\u002F\u002Fmodelers.cn\u002Fmodels)** 下载预训练模型和数据集。使用方法请参阅 [本教程](#download-from-modelers-hub)。\n\n[24\u002F09\u002F19] 我们支持对 **[Qwen2.5](https:\u002F\u002Fqwenlm.github.io\u002Fblog\u002Fqwen2.5\u002F)** 模型进行微调。\n\n[24\u002F08\u002F30] 我们支持对 **[Qwen2-VL](https:\u002F\u002Fqwenlm.github.io\u002Fblog\u002Fqwen2-vl\u002F)** 模型进行微调。感谢 [@simonJJJ](https:\u002F\u002Fgithub.com\u002FsimonJJJ) 的 PR。\n\n[24\u002F08\u002F27] 我们支持 **[Liger Kernel](https:\u002F\u002Fgithub.com\u002Flinkedin\u002FLiger-Kernel)**。尝试设置 `enable_liger_kernel: true` 以实现高效训练。\n\n[24\u002F08\u002F09] 我们支持 **[Adam-mini](https:\u002F\u002Fgithub.com\u002Fzyushun\u002FAdam-mini)** 优化器。使用方法请参阅 [示例](examples\u002FREADME.md)。感谢 [@relic-yuexi](https:\u002F\u002Fgithub.com\u002Frelic-yuexi) 的 PR。\n\n[24\u002F07\u002F04] 我们支持 [无污染的打包训练](https:\u002F\u002Fgithub.com\u002FMeetKai\u002Ffunctionary\u002Ftree\u002Fmain\u002Ffunctionary\u002Ftrain\u002Fpacking)。使用 `neat_packing: true` 可启用此功能。感谢 [@chuan298](https:\u002F\u002Fgithub.com\u002Fchuan298) 的 PR。\n\n[24\u002F06\u002F16] 我们支持 **[PiSSA](https:\u002F\u002Farxiv.org\u002Fabs\u002F2404.02948)** 算法。使用方法请参阅 [示例](examples\u002FREADME.md)。\n\n[24\u002F06\u002F07] 我们支持对 **[Qwen2](https:\u002F\u002Fqwenlm.github.io\u002Fblog\u002Fqwen2\u002F)** 和 **[GLM-4](https:\u002F\u002Fgithub.com\u002FTHUDM\u002FGLM-4)** 模型进行微调。\n\n[24\u002F05\u002F26] 我们支持用于偏好学习的 **[SimPO](https:\u002F\u002Farxiv.org\u002Fabs\u002F2405.14734)** 算法。使用方法请参阅 [示例](examples\u002FREADME.md)。\n\n[24\u002F05\u002F20] 我们支持对 **PaliGemma** 系列模型进行微调。请注意，PaliGemma 模型是预训练模型，您需要使用 `paligemma` 模板对其进行微调以完成对话生成。\n\n[24\u002F05\u002F18] 我们支持用于偏好学习的 **[KTO](https:\u002F\u002Farxiv.org\u002Fabs\u002F2402.01306)** 算法。使用方法请参阅 [示例](examples\u002FREADME.md)。\n\n[24\u002F05\u002F14] 我们支持在 Ascend NPU 设备上进行训练和推理。详情请参阅 [安装](#installation) 部分。\n\n[24\u002F04\u002F26] 我们支持对 **LLaVA-1.5** 多模态大语言模型进行微调。使用方法请参阅 [示例](examples\u002FREADME.md)。\n\n[24\u002F04\u002F22] 我们提供了一个 **[Colab 笔记本](https:\u002F\u002Fcolab.research.google.com\u002Fdrive\u002F1eRTPn37ltBbYsISy9Aw2NuI2Aq5CQrD9?usp=sharing)**，用于在免费的 T4 GPU 上对 Llama-3 模型进行微调。使用 LLaMA Factory 微调的两款 Llama-3 衍生模型已在 Hugging Face 上发布，请查看 [Llama3-8B-Chinese-Chat](https:\u002F\u002Fhuggingface.co\u002Fshenzhi-wang\u002FLlama3-8B-Chinese-Chat) 和 [Llama3-Chinese](https:\u002F\u002Fhuggingface.co\u002Fzhichen\u002FLlama3-Chinese) 以获取详细信息。\n\n[24\u002F04\u002F21] 我们支持根据 **[AstraMindAI 的实现](https:\u002F\u002Fgithub.com\u002Fastramind-ai\u002FMixture-of-depths)** 使用 **[Mixture-of-Depths](https:\u002F\u002Farxiv.org\u002Fabs\u002F2404.02258)**。使用方法请参阅 [示例](examples\u002FREADME.md)。\n\n[24\u002F04\u002F16] 我们支持 **[BAdam](https:\u002F\u002Farxiv.org\u002Fabs\u002F2404.02827)** 优化器。使用方法请参阅 [示例](examples\u002FREADME.md)。\n\n[24\u002F04\u002F16] 我们支持 **[unsloth](https:\u002F\u002Fgithub.com\u002Funslothai\u002Funsloth)** 的长序列训练（在 24GB 显存下运行 Llama-2-7B-56k）。与 FlashAttention-2 相比，其速度提升了 **117%**，显存占用减少了 **50%**。更多基准测试结果可在 [此页面](https:\u002F\u002Fgithub.com\u002Fhiyouga\u002FLLaMA-Factory\u002Fwiki\u002FPerformance-comparison) 查看。\n\n[24\u002F03\u002F31] 我们支持 **[ORPO](https:\u002F\u002Farxiv.org\u002Fabs\u002F2403.07691)**。使用方法请参阅 [示例](examples\u002FREADME.md)。\n\n[24\u002F03\u002F21] 我们的论文 “[LlamaFactory：统一高效的 100+ 语言模型微调]” 已在 arXiv 上发表！\n\n[24\u002F03\u002F20] 我们支持 FSDP+QLoRA，可在两块 24GB 显存的 GPU 上对 70B 参数的模型进行微调。使用方法请参阅 [示例](examples\u002FREADME.md)。\n\n[24\u002F03\u002F13] 我们支持 **[LoRA+](https:\u002F\u002Farxiv.org\u002Fabs\u002F2402.12354)**。使用方法请参阅 [示例](examples\u002FREADME.md)。\n\n[24\u002F03\u002F07] 我们支持 **[GaLore](https:\u002F\u002Farxiv.org\u002Fabs\u002F2403.03507)** 优化器。使用方法请参阅 [示例](examples\u002FREADME.md)。\n\n[24\u002F03\u002F07] 我们集成了 **[vLLM](https:\u002F\u002Fgithub.com\u002Fvllm-project\u002Fvllm)**，以实现更快、更高效的并发推理。尝试设置 `infer_backend: vllm`，即可享受 **270%** 的推理速度提升。\n\n[24\u002F02\u002F28] 我们支持权重分解的 LoRA (**[DoRA](https:\u002F\u002Farxiv.org\u002Fabs\u002F2402.09353)**)。尝试设置 `use_dora: true` 以启用 DoRA 训练。\n\n[24\u002F02\u002F15] 我们支持由 **[LLaMA Pro](https:\u002F\u002Fgithub.com\u002FTencentARC\u002FLLaMA-Pro)** 提出的 **块扩展**。使用方法请参阅 [示例](examples\u002FREADME.md)。\n\n[24\u002F02\u002F05] Qwen1.5（Qwen2 测试版）系列模型现已在 LLaMA-Factory 中得到支持。详情请参阅这篇 [博客文章](https:\u002F\u002Fqwenlm.github.io\u002Fblog\u002Fqwen1.5\u002F)。\n\n[24\u002F01\u002F18] 我们支持对大多数模型进行 **代理微调**，通过使用 `dataset: glaive_toolcall_en` 进行微调，为模型赋予工具使用能力。\n\n[23\u002F12\u002F23] 我们支持 **[unsloth](https:\u002F\u002Fgithub.com\u002Funslothai\u002Funsloth)** 的实现，以加速 LLaMA、Mistral 和 Yi 模型的 LoRA 微调。尝试设置 `use_unsloth: true` 参数以激活 unsloth 补丁。在我们的基准测试中，其速度提升了 **170%**，详情请参阅 [此页面](https:\u002F\u002Fgithub.com\u002Fhiyouga\u002FLLaMA-Factory\u002Fwiki\u002FPerformance-comparison)。\n\n[23\u002F12\u002F12] 我们支持在我们的框架中对最新的 MoE 模型 **[Mixtral 8x7B](https:\u002F\u002Fhuggingface.co\u002Fmistralai\u002FMixtral-8x7B-v0.1)** 进行微调。硬件要求请参阅 [此处](#hardware-requirement)。\n\n[23\u002F12\u002F01] 我们支持从 **[ModelScope Hub](https:\u002F\u002Fmodelscope.cn\u002Fmodels)** 下载预训练模型和数据集。使用方法请参阅 [本教程](#download-from-modelscope-hub)。\n\n[23\u002F10\u002F21] 我们支持了用于微调的 **[NEFTune](https:\u002F\u002Farxiv.org\u002Fabs\u002F2310.05914)** 技巧。尝试使用 `neftune_noise_alpha: 5` 参数来激活 NEFTune。\n\n[23\u002F09\u002F27] 我们为 LLaMA 模型支持了由 [LongLoRA](https:\u002F\u002Fgithub.com\u002Fdvlab-research\u002FLongLoRA) 提出的 **$S^2$-Attn**。尝试使用 `shift_attn: true` 参数来启用移位短注意力机制。\n\n[23\u002F09\u002F23] 我们在这个仓库中集成了 MMLU、C-Eval 和 CMMLU 基准测试。使用方法请参阅 [示例](examples\u002FREADME.md)。\n\n[23\u002F09\u002F10] 我们支持了 **[FlashAttention-2](https:\u002F\u002Fgithub.com\u002FDao-AILab\u002Fflash-attention)**。如果你使用的是 RTX4090、A100 或 H100 显卡，可以尝试使用 `flash_attn: fa2` 参数来启用 FlashAttention-2。\n\n[23\u002F08\u002F12] 我们支持了 **RoPE 缩放**，以扩展 LLaMA 模型的上下文长度。在训练时尝试使用 `rope_scaling: linear` 参数，在推理时使用 `rope_scaling: dynamic` 参数，以实现位置嵌入的外推。\n\n[23\u002F08\u002F11] 我们支持了针对指令微调模型的 **[DPO 训练](https:\u002F\u002Farxiv.org\u002Fabs\u002F2305.18290)**。使用方法请参阅 [示例](examples\u002FREADME.md)。\n\n[23\u002F07\u002F31] 我们支持了 **数据流式加载**。尝试使用 `streaming: true` 和 `max_steps: 10000` 参数，以流式方式加载你的数据集。\n\n[23\u002F07\u002F29] 我们在 Hugging Face 上发布了两款经过指令微调的 13B 参数模型。详情请见这些 Hugging Face 仓库（[LLaMA-2](https:\u002F\u002Fhuggingface.co\u002Fhiyouga\u002FLlama-2-Chinese-13b-chat) \u002F [Baichuan](https:\u002F\u002Fhuggingface.co\u002Fhiyouga\u002FBaichuan-13B-sft))。\n\n[23\u002F07\u002F18] 我们开发了一个用于训练、评估和推理的 **一体化 Web 界面**。尝试运行 `train_web.py`，即可在你的浏览器中对模型进行微调。感谢 [@KanadeSiina](https:\u002F\u002Fgithub.com\u002FKanadeSiina) 和 [@codemayq](https:\u002F\u002Fgithub.com\u002Fcodemayq) 在开发过程中所做的努力。\n\n[23\u002F07\u002F09] 我们发布了 **[FastEdit](https:\u002F\u002Fgithub.com\u002Fhiyouga\u002FFastEdit)** ⚡🩹，这是一个易于使用的工具包，可高效地编辑大型语言模型的事实性知识。如果你对此感兴趣，请关注 [FastEdit](https:\u002F\u002Fgithub.com\u002Fhiyouga\u002FFastEdit)。\n\n[23\u002F06\u002F29] 我们提供了一个使用指令遵循数据集训练聊天模型的 **可复现示例**，详情请参阅 [Baichuan-7B-sft](https:\u002F\u002Fhuggingface.co\u002Fhiyouga\u002FBaichuan-7B-sft)。\n\n[23\u002F06\u002F22] 我们的演示 API（src\u002Fapi_demo.py）已与 OpenAI 的格式（[OpenAI 官网](https:\u002F\u002Fplatform.openai.com\u002Fdocs\u002Fapi-reference\u002Fchat)）对齐，你可以在任何基于 ChatGPT 的应用程序中插入经过微调的模型。\n\n[23\u002F06\u002F03] 我们支持量化训练和推理（即 **[QLoRA](https:\u002F\u002Fgithub.com\u002Fartidoro\u002Fqlora)**）。使用方法请参阅 [示例](examples\u002FREADME.md)。\n\n\u003C\u002Fdetails>\n\n> [!TIP]\n> 如果你无法使用最新功能，请拉取最新代码并重新安装 LLaMA-Factory。\n\n\n\n## 支持的模型\n\n| Model                                                             | Model size                       | Template             |\n| ----------------------------------------------------------------- | -------------------------------- | -------------------- |\n| [BLOOM\u002FBLOOMZ](https:\u002F\u002Fhuggingface.co\u002Fbigscience)                 | 560M\u002F1.1B\u002F1.7B\u002F3B\u002F7.1B\u002F176B      | -                    |\n| [DeepSeek (LLM\u002FCode\u002FMoE)](https:\u002F\u002Fhuggingface.co\u002Fdeepseek-ai)     | 7B\u002F16B\u002F67B\u002F236B                  | deepseek             |\n| [DeepSeek 3-3.2](https:\u002F\u002Fhuggingface.co\u002Fdeepseek-ai)              | 236B\u002F671B                        | deepseek3            |\n| [DeepSeek R1 (Distill)](https:\u002F\u002Fhuggingface.co\u002Fdeepseek-ai)       | 1.5B\u002F7B\u002F8B\u002F14B\u002F32B\u002F70B\u002F671B      | deepseekr1           |\n| [ERNIE-4.5](https:\u002F\u002Fhuggingface.co\u002Fbaidu)                         | 0.3B\u002F21B\u002F300B                    | ernie_nothink        |\n| [Falcon\u002FFalcon H1](https:\u002F\u002Fhuggingface.co\u002Ftiiuae)                 | 0.5B\u002F1.5B\u002F3B\u002F7B\u002F11B\u002F34B\u002F40B\u002F180B | falcon\u002Ffalcon_h1     |\n| [Gemma\u002FGemma 2\u002FCodeGemma](https:\u002F\u002Fhuggingface.co\u002Fgoogle)          | 2B\u002F7B\u002F9B\u002F27B                     | gemma\u002Fgemma2         |\n| [Gemma 3\u002FGemma 3n](https:\u002F\u002Fhuggingface.co\u002Fgoogle)                 | 270M\u002F1B\u002F4B\u002F6B\u002F8B\u002F12B\u002F27B         | gemma3\u002Fgemma3n       |\n| [GLM-4\u002FGLM-4-0414\u002FGLM-Z1](https:\u002F\u002Fhuggingface.co\u002Fzai-org)         | 9B\u002F32B                           | glm4\u002Fglmz1           |\n| [GLM-4.5\u002FGLM-4.5(6)V](https:\u002F\u002Fhuggingface.co\u002Fzai-org)             | 9B\u002F106B\u002F355B                     | glm4_moe\u002Fglm4_5v     |\n| [GPT-2](https:\u002F\u002Fhuggingface.co\u002Fopenai-community)                  | 0.1B\u002F0.4B\u002F0.8B\u002F1.5B              | -                    |\n| [GPT-OSS](https:\u002F\u002Fhuggingface.co\u002Fopenai)                          | 20B\u002F120B                         | gpt_oss              |\n| [Granite 3-4](https:\u002F\u002Fhuggingface.co\u002Fibm-granite)                 | 1B\u002F2B\u002F3B\u002F7B\u002F8B                   | granite3\u002Fgranite4    |\n| [Hunyuan\u002FHunyuan1.5 (MT)](https:\u002F\u002Fhuggingface.co\u002Ftencent\u002F)        | 0.5B\u002F1.8B\u002F4B\u002F7B\u002F13B              | hunyuan\u002Fhunyuan_small|\n| [InternLM 2-3](https:\u002F\u002Fhuggingface.co\u002Finternlm)                   | 7B\u002F8B\u002F20B                        | intern2              |\n| [InternVL 2.5-3.5](https:\u002F\u002Fhuggingface.co\u002FOpenGVLab)              | 1B\u002F2B\u002F4B\u002F8B\u002F14B\u002F30B\u002F38B\u002F78B\u002F241B | intern_vl            |\n| [Intern-S1-mini](https:\u002F\u002Fhuggingface.co\u002Finternlm\u002F)                | 8B                               | intern_s1            |\n| [Kimi-VL](https:\u002F\u002Fhuggingface.co\u002Fmoonshotai)                      | 16B                              | kimi_vl              |\n| [Ling 2.0 (mini\u002Fflash)](https:\u002F\u002Fhuggingface.co\u002FinclusionAI)       | 16B\u002F100B                         | bailing_v2           |\n| [LFM 2.5 (VL)](https:\u002F\u002Fhuggingface.co\u002FLiquidAI)                   | 1.2B\u002F1.6B                        | lfm2\u002Flfm2_vl         |\n| [Llama](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002Fllama)                | 7B\u002F13B\u002F33B\u002F65B                   | -                    |\n| [Llama 2](https:\u002F\u002Fhuggingface.co\u002Fmeta-llama)                      | 7B\u002F13B\u002F70B                       | llama2               |\n| [Llama 3-3.3](https:\u002F\u002Fhuggingface.co\u002Fmeta-llama)                  | 1B\u002F3B\u002F8B\u002F70B                     | llama3               |\n| [Llama 4](https:\u002F\u002Fhuggingface.co\u002Fmeta-llama)                      | 109B\u002F402B                        | llama4               |\n| [Llama 3.2 Vision](https:\u002F\u002Fhuggingface.co\u002Fmeta-llama)             | 11B\u002F90B                          | mllama               |\n| [LLaVA-1.5](https:\u002F\u002Fhuggingface.co\u002Fllava-hf)                      | 7B\u002F13B                           | llava                |\n| [LLaVA-NeXT](https:\u002F\u002Fhuggingface.co\u002Fllava-hf)                     | 7B\u002F8B\u002F13B\u002F34B\u002F72B\u002F110B           | llava_next           |\n| [LLaVA-NeXT-Video](https:\u002F\u002Fhuggingface.co\u002Fllava-hf)               | 7B\u002F34B                           | llava_next_video     |\n| [MiMo](https:\u002F\u002Fhuggingface.co\u002FXiaomiMiMo)                         | 7B\u002F309B                          | mimo\u002Fmimo_v2         |\n| [MiniCPM 4](https:\u002F\u002Fhuggingface.co\u002Fopenbmb)                       | 0.5B\u002F8B                          | cpm4                 |\n| [MiniCPM-o\u002FMiniCPM-V 4.5](https:\u002F\u002Fhuggingface.co\u002Fopenbmb)         | 8B\u002F9B                            | minicpm_o\u002Fminicpm_v  |\n| [MiniMax-M1\u002FMiniMax-M2](https:\u002F\u002Fhuggingface.co\u002FMiniMaxAI\u002Fmodels)  | 229B\u002F456B                        | minimax1\u002Fminimax2    |\n| [Ministral 3](https:\u002F\u002Fhuggingface.co\u002Fmistralai)                   | 3B\u002F8B\u002F14B                        | ministral3           |\n| [Mistral\u002FMixtral](https:\u002F\u002Fhuggingface.co\u002Fmistralai)               | 7B\u002F8x7B\u002F8x22B                    | mistral              |\n| [PaliGemma\u002FPaliGemma2](https:\u002F\u002Fhuggingface.co\u002Fgoogle)             | 3B\u002F10B\u002F28B                       | paligemma            |\n| [Phi-3\u002FPhi-3.5](https:\u002F\u002Fhuggingface.co\u002Fmicrosoft)                 | 4B\u002F14B                           | phi                  |\n| [Phi-3-small](https:\u002F\u002Fhuggingface.co\u002Fmicrosoft)                   | 7B                               | phi_small            |\n| [Phi-4-mini\u002FPhi-4](https:\u002F\u002Fhuggingface.co\u002Fmicrosoft)              | 3.8B\u002F14B                         | phi4_mini\u002Fphi4       |\n| [Pixtral](https:\u002F\u002Fhuggingface.co\u002Fmistralai)                       | 12B                              | pixtral              |\n| [Qwen2 (Code\u002FMath\u002FMoE\u002FQwQ)](https:\u002F\u002Fhuggingface.co\u002FQwen)          | 0.5B\u002F1.5B\u002F3B\u002F7B\u002F14B\u002F32B\u002F72B\u002F110B | qwen                 |\n| [Qwen3 (MoE\u002FInstruct\u002FThinking\u002FNext)](https:\u002F\u002Fhuggingface.co\u002FQwen) | 0.6B\u002F1.7B\u002F4B\u002F8B\u002F14B\u002F32B\u002F80B\u002F235B | qwen3\u002Fqwen3_nothink  |\n| [Qwen3.5](https:\u002F\u002Fhuggingface.co\u002FQwen)                            | 0.8B\u002F2B\u002F4B\u002F9B\u002F27B\u002F35B\u002F122B\u002F397B  | qwen3_5              |\n| [Qwen2-Audio](https:\u002F\u002Fhuggingface.co\u002FQwen)                        | 7B                               | qwen2_audio          |\n| [Qwen2.5-Omni](https:\u002F\u002Fhuggingface.co\u002FQwen)                       | 3B\u002F7B                            | qwen2_omni           |\n| [Qwen3-Omni](https:\u002F\u002Fhuggingface.co\u002FQwen)                         | 30B                              | qwen3_omni           |\n| [Qwen2-VL\u002FQwen2.5-VL\u002FQVQ](https:\u002F\u002Fhuggingface.co\u002FQwen)            | 2B\u002F3B\u002F7B\u002F32B\u002F72B                 | qwen2_vl             |\n| [Qwen3-VL](https:\u002F\u002Fhuggingface.co\u002FQwen)                           | 2B\u002F4B\u002F8B\u002F30B\u002F32B\u002F235B            | qwen3_vl             |\n| [Seed (OSS\u002FCoder)](https:\u002F\u002Fhuggingface.co\u002FByteDance-Seed)         | 8B\u002F36B                           | seed_oss\u002Fseed_coder  |\n| [StarCoder 2](https:\u002F\u002Fhuggingface.co\u002Fbigcode)                     | 3B\u002F7B\u002F15B                        | -                    |\n| [TeleChat 2-2.5](https:\u002F\u002Fhuggingface.co\u002FTele-AI)                  | 3B\u002F7B\u002F35B\u002F115B                   | telechat2            |\n| [Yuan 2](https:\u002F\u002Fhuggingface.co\u002FIEITYuan)                         | 2B\u002F51B\u002F102B                      | yuan                 |\n\n> [!NOTE]\n> For the \"base\" models, the `template` argument can be chosen from `default`, `alpaca`, `vicuna` etc. But make sure to use the **corresponding template** for the \"instruct\u002Fchat\" models.\n>\n> If the model has both reasoning and non-reasoning versions, please use the `_nothink` suffix to distinguish between them. For example, `qwen3` and `qwen3_nothink`.\n>\n> Remember to use the **SAME** template in training and inference.\n>\n> \\*: You should install the `transformers` from main branch and use `DISABLE_VERSION_CHECK=1` to skip version check.\n>\n> \\*\\*: You need to install a specific version of `transformers` to use the corresponding model.\n\nPlease refer to [constants.py](src\u002Fllamafactory\u002Fextras\u002Fconstants.py) for a full list of models we supported.\n\nYou also can add a custom chat template to [template.py](src\u002Fllamafactory\u002Fdata\u002Ftemplate.py).\n\n\n\n## Supported Training Approaches\n\n| Approach               |     Full-tuning    |    Freeze-tuning   |       LoRA         |       QLoRA        |        OFT         |        QOFT        |\n| ---------------------- | ------------------ | ------------------ | ------------------ | ------------------ | ------------------ | ------------------ |\n| Pre-Training           | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |\n| Supervised Fine-Tuning | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |\n| Reward Modeling        | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |\n| PPO Training           | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |\n| DPO Training           | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |\n| KTO Training           | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |\n| ORPO Training          | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |\n| SimPO Training         | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |\n\n> [!TIP]\n> The implementation details of PPO can be found in [this blog](https:\u002F\u002Fnewfacade.github.io\u002Fnotes-on-reinforcement-learning\u002F17-ppo-trl.html).\n\n## Provided Datasets\n\n\u003Cdetails>\u003Csummary>Pre-training datasets\u003C\u002Fsummary>\n\n- [Wiki Demo (en)](data\u002Fwiki_demo.txt)\n- [RefinedWeb (en)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Ftiiuae\u002Ffalcon-refinedweb)\n- [RedPajama V2 (en)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Ftogethercomputer\u002FRedPajama-Data-V2)\n- [Wikipedia (en)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Folm\u002Folm-wikipedia-20221220)\n- [Wikipedia (zh)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fpleisto\u002Fwikipedia-cn-20230720-filtered)\n- [Pile (en)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FEleutherAI\u002Fpile)\n- [SkyPile (zh)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FSkywork\u002FSkyPile-150B)\n- [FineWeb (en)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FHuggingFaceFW\u002Ffineweb)\n- [FineWeb-Edu (en)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FHuggingFaceFW\u002Ffineweb-edu)\n- [CCI3-HQ (zh)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FBAAI\u002FCCI3-HQ)\n- [CCI3-Data (zh)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FBAAI\u002FCCI3-Data)\n- [CCI4.0-M2-Base-v1 (en&zh)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FBAAI\u002FCCI4.0-M2-Base-v1)\n- [CCI4.0-M2-CoT-v1 (en&zh)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FBAAI\u002FCCI4.0-M2-CoT-v1)\n- [CCI4.0-M2-Extra-v1 (en&zh)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FBAAI\u002FCCI4.0-M2-Extra-v1)\n- [The Stack (en)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fbigcode\u002Fthe-stack)\n- [StarCoder (en)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fbigcode\u002Fstarcoderdata)\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>Supervised fine-tuning datasets\u003C\u002Fsummary>\n\n- [身份信息 (英&中)](data\u002Fidentity.json)\n- [斯坦福Alpaca (英)](https:\u002F\u002Fgithub.com\u002Ftatsu-lab\u002Fstanford_alpaca)\n- [斯坦福Alpaca (中)](https:\u002F\u002Fgithub.com\u002Fymcui\u002FChinese-LLaMA-Alpaca-3)\n- [Alpaca GPT4 (英&中)](https:\u002F\u002Fgithub.com\u002FInstruction-Tuning-with-GPT-4\u002FGPT-4-LLM)\n- [Glaive函数调用V2 (英&中)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fglaiveai\u002Fglaive-function-calling-v2)\n- [LIMA (英)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FGAIR\u002Flima)\n- [Guanaco数据集 (多语言)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FJosephusCheung\u002FGuanacoDataset)\n- [BELLE 2M (中)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FBelleGroup\u002Ftrain_2M_CN)\n- [BELLE 1M (中)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FBelleGroup\u002Ftrain_1M_CN)\n- [BELLE 0.5M (中)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FBelleGroup\u002Ftrain_0.5M_CN)\n- [BELLE对话0.4M (中)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FBelleGroup\u002Fgenerated_chat_0.4M)\n- [BELLE学校数学0.25M (中)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FBelleGroup\u002Fschool_math_0.25M)\n- [BELLE多轮对话0.8M (中)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FBelleGroup\u002Fmultiturn_chat_0.8M)\n- [UltraChat (英)](https:\u002F\u002Fgithub.com\u002Fthunlp\u002FUltraChat)\n- [OpenPlatypus (英)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fgarage-bAInd\u002FOpen-Platypus)\n- [CodeAlpaca 20k (英)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fsahil2801\u002FCodeAlpaca-20k)\n- [Alpaca CoT (多语言)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FQingyiSi\u002FAlpaca-CoT)\n- [OpenOrca (英)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FOpen-Orca\u002FOpenOrca)\n- [SlimOrca (英)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FOpen-Orca\u002FSlimOrca)\n- [MathInstruct (英)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FTIGER-Lab\u002FMathInstruct)\n- [Firefly 1.1M (中)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FYeungNLP\u002Ffirefly-train-1.1M)\n- [Wiki QA (英)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fwiki_qa)\n- [Web QA (中)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fsuolyer\u002Fwebqa)\n- [WebNovel (中)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fzxbsmk\u002Fwebnovel_cn)\n- [Nectar (英)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fberkeley-nest\u002FNectar)\n- [deepctrl (英&中)](https:\u002F\u002Fwww.modelscope.cn\u002Fdatasets\u002Fdeepctrl\u002Fdeepctrl-sft-data)\n- [广告生成 (中)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FHasturOfficial\u002Fadgen)\n- [ShareGPT超滤版 (英)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Ftotally-not-an-llm\u002Fsharegpt-hyperfiltered-3k)\n- [ShareGPT4 (英&中)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fshibing624\u002Fsharegpt_gpt4)\n- [UltraChat 200k (英)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FHuggingFaceH4\u002Fultrachat_200k)\n- [Infinity Instruct (中)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FBAAI\u002FInfinity-Instruct)\n- [AgentInstruct (英)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FTHUDM\u002FAgentInstruct)\n- [LMSYS聊天1M (英)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Flmsys\u002Flmsys-chat-1m)\n- [Evol Instruct V2 (英)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FWizardLM\u002FWizardLM_evol_instruct_V2_196k)\n- [Cosmopedia (英)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FHuggingFaceTB\u002Fcosmopedia)\n- [STEM (中)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fhfl\u002Fstem_zh_instruction)\n- [Ruozhiba (中)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fhfl\u002Fruozhiba_gpt4_turbo)\n- [Neo-sft (中)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fm-a-p\u002Fneo_sft_phase2)\n- [Magpie-Pro-300K-Filtered (英)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FMagpie-Align\u002FMagpie-Pro-300K-Filtered)\n- [Magpie-ultra-v0.1 (英)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fargilla\u002Fmagpie-ultra-v0.1)\n- [WebInstructSub (英)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FTIGER-Lab\u002FWebInstructSub)\n- [OpenO1-SFT (英&中)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FO1-OPEN\u002FOpenO1-SFT)\n- [Open-Thoughts (英)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fopen-thoughts\u002FOpenThoughts-114k)\n- [Open-R1-Math (英)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fopen-r1\u002FOpenR1-Math-220k)\n- [中文-DeepSeek-R1-Distill (中)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FCongliu\u002FChinese-DeepSeek-R1-Distill-data-110k-SFT)\n- [LLaVA混合版 (英&中)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FBUAADreamer\u002Fllava-en-zh-300k)\n- [宝可梦-gpt4o-字幕 (英&中)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fjugg1024\u002Fpokemon-gpt4o-captions)\n- [DLR-Web (英)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FAttention1115\u002FDLR-Web)\n- [开放助手 (德)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fmayflowergmbh\u002Foasst_de)\n- [Dolly 15k (德)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fmayflowergmbh\u002Fdolly-15k_de)\n- [Alpaca GPT4 (德)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fmayflowergmbh\u002Falpaca-gpt4_de)\n- [OpenSchnabeltier (德)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fmayflowergmbh\u002Fopenschnabeltier_de)\n- [Evol Instruct (德)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fmayflowergmbh\u002Fevol-instruct_de)\n- [Dolphin (德)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fmayflowergmbh\u002Fdolphin_de)\n- [Booksum (德)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fmayflowergmbh\u002Fbooksum_de)\n- [Airoboros (德)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fmayflowergmbh\u002Fairoboros-3.0_de)\n- [Ultrachat (德)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fmayflowergmbh\u002Fultra-chat_de)\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>偏好数据集\u003C\u002Fsummary>\n\n- [DPO混合版 (英&中)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fhiyouga\u002FDPO-En-Zh-20k)\n- [UltraFeedback (英)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FHuggingFaceH4\u002Fultrafeedback_binarized)\n- [COIG-P (中)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fm-a-p\u002FCOIG-P)\n- [RLHF-V (英)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fopenbmb\u002FRLHF-V-Dataset)\n- [VLFeedback (英)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FZhihui\u002FVLFeedback)\n- [RLAIF-V (英)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fopenbmb\u002FRLAIF-V-Dataset)\n- [Orca DPO配对 (英)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FIntel\u002Forca_dpo_pairs)\n- [HH-RLHF (英)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FAnthropic\u002Fhh-rlhf)\n- [Nectar (英)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fberkeley-nest\u002FNectar)\n- [Orca DPO (德)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fmayflowergmbh\u002Fintel_orca_dpo_pairs_de)\n- [KTO混合版 (英)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fargilla\u002Fkto-mix-15k)\n\n\u003C\u002Fdetails>\n\n部分数据集在使用前需要确认，因此建议您使用以下命令登录Hugging Face账号。\n\n```bash\npip install \"huggingface_hub\u003C1.0.0\"\nhuggingface-cli login\n```\n\n\n\n## 要求\n\n| 必需    | 最低 | 推荐 |\n| -------- | ---- | ---- |\n| python   | 3.11 | >=3.11 |\n| torch    | 2.0.0 | 2.6.0 |\n| torchvision | 0.15.0 | 0.21.0 |\n| transformers | 4.49.0 | 4.50.0 |\n| datasets   | 2.16.0 | 3.2.0 |\n| accelerate | 0.34.0 | 1.2.1 |\n| peft       | 0.14.0 | 0.15.1 |\n| trl        | 0.8.6 | 0.9.6 |\n\n| 可选     | 最低 | 推荐 |\n| -------- | ---- | ---- |\n| CUDA     | 11.6 | 12.2 |\n| deepspeed | 0.10.0 | 0.16.4 |\n| bitsandbytes | 0.39.0 | 0.43.1 |\n| vllm       | 0.4.3 | 0.8.2 |\n| flash-attn | 2.5.6 | 2.7.2 |\n\n### 硬件需求\n\n\\* *估算*\n\n| 方法                              | 位数 |   7B  |  14B  |  30B  |   70B  |   `x`B  |\n| ----------------------------------- | ---- | ----- | ----- | ----- | ------ | ------- |\n| 完整模型 (`bf16` 或 `fp16`)             |  32  | 120GB | 240GB | 600GB | 1200GB | `18x`GB |\n| 完整模型 (`pure_bf16`)                  |  16  |  60GB | 120GB | 300GB |  600GB |  `8x`GB |\n| 冻结\u002FLoRA\u002FGaLore\u002FAPOLLO\u002FBAdam\u002FOFT |  16  |  16GB |  32GB |  64GB |  160GB |  `2x`GB |\n| QLoRA \u002F QOFT                        |   8  |  10GB |  20GB |  40GB |   80GB |   `x`GB |\n| QLoRA \u002F QOFT                        |   4  |   6GB |  12GB |  24GB |   48GB | `x\u002F2`GB |\n| QLoRA \u002F QOFT                        |   2  |   4GB |   8GB |  16GB |   24GB | `x\u002F4`GB |\n\n## 入门指南\n\n### 安装\n\n> [!重要]\n> 安装是必须的。\n\n#### 从源码安装\n\n```bash\ngit clone --depth 1 https:\u002F\u002Fgithub.com\u002Fhiyouga\u002FLlamaFactory.git\ncd LlamaFactory\npip install -e .\npip install -r requirements\u002Fmetrics.txt\n```\n\n可选依赖项包括：`metrics`、`deepspeed`。可通过以下命令安装：`pip install -e . && pip install -r requirements\u002Fmetrics.txt -r requirements\u002Fdeepspeed.txt`\n\n特定功能所需的额外依赖项可在 `examples\u002Frequirements\u002F` 中找到。\n\n#### 使用 Docker 镜像安装\n\n```bash\ndocker run -it --rm --gpus=all --ipc=host hiyouga\u002Fllamafactory:latest\n```\n\n该镜像基于 Ubuntu 22.04 (x86\\_64)、CUDA 12.4、Python 3.11、PyTorch 2.6.0 和 Flash-attn 2.7.4 构建。\n\n预构建镜像请访问：https:\u002F\u002Fhub.docker.com\u002Fr\u002Fhiyouga\u002Fllamafactory\u002Ftags\n\n如需自行构建镜像，请参阅 [构建 Docker](#build-docker)。\n\n\u003Cdetails>\u003Csummary>使用 \u003Cb>uv\u003C\u002Fb> 设置虚拟环境\u003C\u002Fsummary>\n\n使用 [uv](https:\u002F\u002Fgithub.com\u002Fastral-sh\u002Fuv) 创建隔离的 Python 环境：\n\n```bash\nuv run llamafactory-cli webui\n```\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>Windows 用户须知\u003C\u002Fsummary>\n\n#### 安装 PyTorch\n\n在 Windows 平台上，您需要手动安装支持 GPU 的 PyTorch 版本。请参考 [官方文档](https:\u002F\u002Fpytorch.org\u002Fget-started\u002Flocally\u002F) 和以下命令以安装支持 CUDA 的 PyTorch：\n\n```bash\npip uninstall torch torchvision torchaudio\npip install torch torchvision torchaudio --index-url https:\u002F\u002Fdownload.pytorch.org\u002Fwhl\u002Fcu126\npython -c \"import torch; print(torch.cuda.is_available())\"\n```\n\n如果输出为 `True`，则表示您已成功安装支持 CUDA 的 PyTorch。\n\n若遇到 `Can't pickle local object` 错误，请尝试将 `dataloader_num_workers: 0`。\n\n#### 安装 BitsAndBytes\n\n如果您希望在 Windows 平台上启用量化 LoRA (QLoRA)，则需要安装预先编译好的 `bitsandbytes` 库，该库支持 CUDA 11.1 至 12.2。请根据您的 CUDA 版本选择合适的 [发布版本](https:\u002F\u002Fgithub.com\u002Fjllllll\u002Fbitsandbytes-windows-webui\u002Freleases\u002Ftag\u002Fwheels)。\n\n```bash\npip install https:\u002F\u002Fgithub.com\u002Fjllllll\u002Fbitsandbytes-windows-webui\u002Freleases\u002Fdownload\u002Fwheels\u002Fbitsandbytes-0.41.2.post2-py3-none-win_amd64.whl\n```\n\n#### 安装 Flash Attention-2\n\n要在 Windows 平台上启用 FlashAttention-2，您需要使用来自 [flash-attention-windows-wheel](https:\u002F\u002Fhuggingface.co\u002Flldacing\u002Fflash-attention-windows-wheel) 的脚本自行编译并安装。\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>Ascend NPU 用户须知\u003C\u002Fsummary>\n\n要在 Ascend NPU 设备上安装 LLaMA Factory，请将 Python 升级至 3.10 或更高版本：`pip install -r requirements\u002Fnpu.txt`。此外，您还需要安装 **Ascend CANN 工具包和内核**。请按照 [安装教程](https:\u002F\u002Fllamafactory.readthedocs.io\u002Fen\u002Flatest\u002Fadvanced\u002Fnpu_installation.html) 进行操作。\n\n\n您也可以下载预构建的 Docker 镜像：\n\n```bash\n# Docker Hub\ndocker pull hiyouga\u002Fllamafactory:latest-npu-a2\ndocker pull hiyouga\u002Fllamafactory:latest-npu-a3\n\n# quay.io\ndocker pull quay.io\u002Fascend\u002Fllamafactory:latest-npu-a2\ndocker pull quay.io\u002Fascend\u002Fllamafactory:latest-npu-a3\n```\n\n#### 安装 BitsAndBytes\n\n要在 Ascend NPU 上使用基于 bitsandbytes 的 QLoRA，请遵循以下 3 步骤：\n\n1. 手动编译 bitsandbytes：请参考 [安装文档](https:\u002F\u002Fhuggingface.co\u002Fdocs\u002Fbitsandbytes\u002Finstallation?backend=Ascend+NPU&platform=Ascend+NPU) 中关于 NPU 版本的说明，完成编译和安装。编译过程需要至少 3.22.1 版本的 cmake 和至少 12.x 版本的 g++。\n\n```bash\n# 从源码安装 bitsandbytes\n# 克隆 bitsandbytes 仓库，目前多后端重构分支已支持 Ascend NPU 后端\ngit clone -b multi-backend-refactor https:\u002F\u002Fgithub.com\u002Fbitsandbytes-foundation\u002Fbitsandbytes.git\ncd bitsandbytes\u002F\n\n# 安装依赖\npip install -r requirements-dev.txt\n\n# 安装编译工具的依赖。请注意，此步骤的具体命令可能因操作系统而异，以下供参考\napt-get install -y build-essential cmake\n\n# 编译 & 安装  \ncmake -DCOMPUTE_BACKEND=npu -S .\nmake\npip install .\n```\n\n2. 从主分支安装 transformers。\n\n```bash\ngit clone -b main https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Ftransformers.git\ncd transformers\npip install .\n```\n\n3. 在配置中设置 `double_quantization: false`。您可以参考 [示例](examples\u002Ftrain_qlora\u002Fqwen3_lora_sft_bnb_npu.yaml)。\n\n\u003C\u002Fdetails>\n\n### 数据准备\n\n有关数据集文件格式的详细信息，请参阅 [data\u002FREADME.md](data\u002FREADME.md)。您可以使用 HuggingFace \u002F ModelScope \u002F Modelers hub 上的数据集，也可以加载本地磁盘中的数据集，或指定指向 s3\u002Fgcs 云存储的路径。\n\n> [!注]\n> 请更新 `data\u002Fdataset_info.json` 以使用您自定义的数据集。\n\n您还可以使用 **[Easy Dataset](https:\u002F\u002Fgithub.com\u002FConardLi\u002Feasy-dataset)**、**[DataFlow](https:\u002F\u002Fgithub.com\u002FOpenDCAI\u002FDataFlow)** 和 **[GraphGen](https:\u002F\u002Fgithub.com\u002Fopen-sciencelab\u002FGraphGen)** 来创建用于微调的合成数据。\n\n### 快速入门\n\n使用以下 3 条命令分别运行 Qwen3-4B-Instruct 模型的 LoRA **微调**、**推理** 和 **合并**。\n\n```bash\nllamafactory-cli train examples\u002Ftrain_lora\u002Fqwen3_lora_sft.yaml\nllamafactory-cli chat examples\u002Finference\u002Fqwen3_lora_sft.yaml\nllamafactory-cli export examples\u002Fmerge_lora\u002Fqwen3_lora_sft.yaml\n```\n\n更多高级用法（包括分布式训练）请参阅 [examples\u002FREADME.md](examples\u002FREADME.md)。\n\n> [!提示]\n> 使用 `llamafactory-cli help` 查看帮助信息。\n>\n> 如遇问题，请先阅读 [常见问题解答](https:\u002F\u002Fgithub.com\u002Fhiyouga\u002FLLaMA-Factory\u002Fissues\u002F4614)。\n\n### 使用 LLaMA Board GUI 进行微调（由 [Gradio](https:\u002F\u002Fgithub.com\u002Fgradio-app\u002Fgradio) 提供支持）\n\n```bash\nllamafactory-cli webui\n```\n\n### LLaMA Factory 在线\n\n请阅读我们的 [文档](https:\u002F\u002Fdocs.llamafactory.com.cn\u002Fdocs\u002Fdocuments\u002Fquickstart\u002Fgetstarted\u002F?utm_source=LLaMA-Factory)。\n\n### 构建 Docker\n\n对于 CUDA 用户：\n\n```bash\ncd docker\u002Fdocker-cuda\u002F\ndocker compose up -d\ndocker compose exec llamafactory bash\n```\n\n对于 Ascend NPU 用户：\n\n```bash\ncd docker\u002Fdocker-npu\u002F\ndocker compose up -d\ndocker compose exec llamafactory bash\n```\n\n对于 AMD ROCm 用户：\n\n```bash\ncd docker\u002Fdocker-rocm\u002F\ndocker compose up -d\ndocker compose exec llamafactory bash\n```\n\n\u003Cdetails>\u003Csummary>不使用 Docker Compose 构建\u003C\u002Fsummary>\n\n对于 CUDA 用户：\n\n```bash\ndocker build -f .\u002Fdocker\u002Fdocker-cuda\u002FDockerfile \\\n    --build-arg PIP_INDEX=https:\u002F\u002Fpypi.org\u002Fsimple \\\n    -t llamafactory:latest .\n\ndocker run -dit --ipc=host --gpus=all \\\n    -p 7860:7860 \\\n    -p 8000:8000 \\\n    --name llamafactory \\\n    llamafactory:latest\n\ndocker exec -it llamafactory bash\n```\n\n对于 Ascend NPU 用户：\n\n```bash\ndocker build -f .\u002Fdocker\u002Fdocker-npu\u002FDockerfile \\\n    --build-arg PIP_INDEX=https:\u002F\u002Fpypi.org\u002Fsimple \\\n    -t llamafactory:latest .\n\ndocker run -dit --ipc=host \\\n    -v \u002Fusr\u002Flocal\u002Fdcmi:\u002Fusr\u002Flocal\u002Fdcmi \\\n    -v \u002Fusr\u002Flocal\u002Fbin\u002Fnpu-smi:\u002Fusr\u002Flocal\u002Fbin\u002Fnpu-smi \\\n    -v \u002Fusr\u002Flocal\u002FAscend\u002Fdriver:\u002Fusr\u002Flocal\u002FAscend\u002Fdriver \\\n    -v \u002Fetc\u002Fascend_install.info:\u002Fetc\u002Fascend_install.info \\\n    -p 7860:7860 \\\n    -p 8000:8000 \\\n    --device \u002Fdev\u002Fdavinci0 \\\n    --device \u002Fdev\u002Fdavinci_manager \\\n    --device \u002Fdev\u002Fdevmm_svm \\\n    --device \u002Fdev\u002Fhisi_hdc \\\n    --name llamafactory \\\n    llamafactory:latest\n\ndocker exec -it llamafactory bash\n```\n\n对于 AMD ROCm 用户：\n\n```bash\ndocker build -f .\u002Fdocker\u002Fdocker-rocm\u002FDockerfile \\\n    --build-arg PIP_INDEX=https:\u002F\u002Fpypi.org\u002Fsimple \\\n    -t llamafactory:latest .\n\ndocker run -dit --ipc=host \\\n    -p 7860:7860 \\\n    -p 8000:8000 \\\n    --device \u002Fdev\u002Fkfd \\\n    --device \u002Fdev\u002Fdri \\\n    --name llamafactory \\\n    llamafactory:latest\n\ndocker exec -it llamafactory bash\n```\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>使用 Docker 卷\u003C\u002Fsummary>\n\n您可以在 Dockerfile 中取消注释 `VOLUME [ \"\u002Froot\u002F.cache\u002Fhuggingface\", \"\u002Fapp\u002Fshared_data\", \"\u002Fapp\u002Foutput\" ]` 来使用数据卷。\n\n在构建 Docker 镜像时，使用 `-v .\u002Fhf_cache:\u002Froot\u002F.cache\u002Fhuggingface` 参数将本地目录挂载到容器中。以下数据卷可用。\n\n- `hf_cache`: 在宿主机上利用 Hugging Face 缓存。\n- `shared_data`: 宿主机上用于存储数据集的目录。\n- `output`: 将导出目录设置为此位置，以便可以直接在宿主机上访问合并结果。\n\n\u003C\u002Fdetails>\n\n### 使用 OpenAI 风格 API 和 vLLM 部署\n\n```bash\nAPI_PORT=8000 llamafactory-cli api examples\u002Finference\u002Fqwen3.yaml infer_backend=vllm vllm_enforce_eager=true\n```\n\n> [!TIP]\n> 请访问 [此页面](https:\u002F\u002Fplatform.openai.com\u002Fdocs\u002Fapi-reference\u002Fchat\u002Fcreate) 查阅 API 文档。\n>\n> 示例：[图像理解](scripts\u002Fapi_example\u002Ftest_image.py) | [函数调用](scripts\u002Fapi_example\u002Ftest_toolcall.py)\n\n### 从 ModelScope Hub 下载\n\n如果您在从 Hugging Face 下载模型和数据集时遇到困难，可以使用 ModelScope。\n\n```bash\nexport USE_MODELSCOPE_HUB=1 # Windows 系统使用 `set USE_MODELSCOPE_HUB=1`\n```\n\n通过将 ModelScope Hub 的模型 ID 指定为 `model_name_or_path` 来训练模型。您可以在 [ModelScope Hub](https:\u002F\u002Fmodelscope.cn\u002Fmodels) 上找到完整的模型 ID 列表，例如 `LLM-Research\u002FMeta-Llama-3-8B-Instruct`。\n\n### 从 Modelers Hub 下载\n\n您也可以使用 Modelers Hub 下载模型和数据集。\n\n```bash\nexport USE_OPENMIND_HUB=1 # Windows 系统使用 `set USE_OPENMIND_HUB=1`\n```\n\n通过将 Modelers Hub 的模型 ID 指定为 `model_name_or_path` 来训练模型。您可以在 [Modelers Hub](https:\u002F\u002Fmodelers.cn\u002Fmodels) 上找到完整的模型 ID 列表，例如 `TeleAI\u002FTeleChat-7B-pt`。\n\n### 使用 W&B 日志记录器\n\n要使用 [Weights & Biases](https:\u002F\u002Fwandb.ai) 记录实验结果，您需要在 YAML 文件中添加以下参数。\n\n```yaml\nreport_to: wandb\nrun_name: test_run # 可选\n```\n\n在启动训练任务时，将 `WANDB_API_KEY` 设置为您的 [API 密钥](https:\u002F\u002Fwandb.ai\u002Fauthorize)，以登录您的 W&B 账户。\n\n### 使用 SwanLab 日志记录器\n\n要使用 [SwanLab](https:\u002F\u002Fgithub.com\u002FSwanHubX\u002FSwanLab) 记录实验结果，您需要在 YAML 文件中添加以下参数。\n\n```yaml\nuse_swanlab: true\nswanlab_run_name: test_run # 可选\n```\n\n在启动训练任务时，您可以通过三种方式登录 SwanLab：\n\n1. 在 YAML 文件中添加 `swanlab_api_key=\u003Cyour_api_key>`，并将其设置为您的 [API 密钥](https:\u002F\u002Fswanlab.cn\u002Fsettings)。\n2. 将环境变量 `SWANLAB_API_KEY` 设置为您的 [API 密钥](https:\u002F\u002Fswanlab.cn\u002Fsettings)。\n3. 使用 `swanlab login` 命令完成登录。\n\n## 使用 LLaMA Factory 的项目\n\n如果您有希望纳入的项目，请通过电子邮件联系我们或创建拉取请求。\n\n\u003Cdetails>\u003Csummary>点击展开\u003C\u002Fsummary>\n\n1. Wang 等人。ESRL：用于序列生成的高效采样强化学习。2023年。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2308.02223)\n1. Yu 等人。文本分类中使用开放、封闭还是小型语言模型？2023年。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2308.10092)\n1. Wang 等人。UbiPhysio：通过自然语言中的动作理解和反馈支持日常功能、健身和康复。2023年。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2308.10526)\n1. Luceri 等人。利用大型语言模型检测社交媒体中的影响力活动。2023年。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2311.07816)\n1. Zhang 等人。通过诱导幻觉缓解大型语言模型的幻觉问题。2023年。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2312.15710)\n1. Wang 等人。更了解您的需求：借助类比推理增强的大型语言模型，实现对营销人员需求的结构化理解。KDD 2024。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2401.04319)\n1. Wang 等人。CANDLE：从大型语言模型中迭代提炼概念化与实例化知识，用于常识推理。ACL 2024。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2401.07286)\n1. Choi 等人。FACT-GPT：基于大型语言模型进行主张匹配的事实核查增强。2024年。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2402.05904)\n1. Zhang 等人。AutoMathText：利用语言模型对数学文本进行自主数据选择。2024年。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2402.07625)\n1. Lyu 等人。KnowTuning：面向大型语言模型的知识感知微调。2024年。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2402.11176)\n1. Yang 等人。LaCo：通过层融合对大型语言模型进行剪枝。2024年。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2402.11187)\n1. Bhardwaj 等人。语言模型就是荷马·辛普森！通过任务算术重新对齐微调后的语言模型以提高安全性。2024年。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2402.11746)\n1. Yang 等人。通过小型共情模型增强大型语言模型，提升共情回复生成能力。2024年。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2402.11801)\n1. Yi 等人。生成与验证结合：利用智能并行自动纠错解码加速大型语言模型推理。ACL 2024成果。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2402.11809)\n1. Cao 等人。面向大型语言模型的头级可共享注意力机制。2024年。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2402.11819)\n1. Zhang 等人。通过从资源丰富的语言中自我蒸馏，提升大型语言模型的多语言能力。2024年。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2402.12204)\n1. Kim 等人。高效且有效的词汇扩展，助力多语种大型语言模型发展。2024年。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2402.14714)\n1. Yu 等人。KIEval：面向大型语言模型的知识驱动型交互式评估框架。ACL 2024。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2402.15043)\n1. Huang 等人。基于关键点的数据合成及其在数学推理中的增强作用。2024年。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2403.02333)\n1. Duan 等人。否定之否定：通过分布差异优化实现无需人类正面样本的对齐。2024年。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2403.03419)\n1. Xie 和 Schwertfeger。用大型语言模型赋能机器人技术：利用大型语言模型理解osmAG地图。2024年。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2403.08228)\n1. Wu 等人。大型语言模型是并行的多语种学习者。2024年。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2403.09073)\n1. Zhang 等人。EDT：基于熵的动态温度采样提升大型语言模型生成质量。2024年。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2403.14541)\n1. Weller 等人。FollowIR：评估并训练信息检索模型遵循指令的能力。2024年。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2403.15246)\n1. Hongbin Na。CBT-LLM：一款用于基于认知行为疗法的心理健康问答的中文大型语言模型。COLING 2024。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2403.16008)\n1. Zan 等人。CodeS：通过多层草图实现自然语言到代码仓库的转换。2024年。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2403.16443)\n1. Liu 等人。广泛的自我对比使语言模型无需反馈即可实现对齐。2024年。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2404.00604)\n1. Luo 等人。BAdam：一种面向大型语言模型的内存高效的全参数训练方法。2024年。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2404.02827)\n1. Du 等人。Chinese Tiny LLM：预训练一个以中文为中心的大型语言模型。2024年。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2404.04167)\n1. Ma 等人。利用Givens旋转实现参数高效的准正交微调。ICML 2024。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2404.04316)\n1. Liu 等人。利用大型语言模型动态生成个性。2024年。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2404.07084)\n1. Shang 等人。我们利用大型语言模型理解剥离二进制代码已经走到了哪一步。2024年。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2404.09836)\n1. Huang 等人。LLMTune：利用大型语言模型加速数据库参数调优。2024年。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2404.11581)\n1. Deng 等人。文本-元组-表格：通过全局元组提取，迈向文本到表格生成的信息集成。2024年。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2404.14215)\n1. Acikgoz 等人。Hippocrates：一个用于推动大型语言模型在医疗领域发展的开源框架。2024年。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2404.16621)\n1. Zhang 等人。小型语言模型需要强大的验证器来自我纠正推理。ACL 2024成果。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2404.17140)\n1. Zhou 等人。FREB-TQA：一个针对表格问答的细粒度鲁棒性评估基准。NAACL 2024。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2404.18585)\n1. Xu 等人。大型语言模型在网络安全中的应用：系统性文献综述。2024年。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2405.04760)\n1. Dammu 等人。“他们没有教养”：揭示大型语言模型生成对话中的隐蔽危害和社会威胁。2024年。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2405.05378)\n1. Yi 等人。一种基于子空间导向的模型融合安全对齐框架，适用于大型语言模型。2024年。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2405.09055)\n1. Lou 等人。SPO：基于隐式奖励建模的多维偏好顺序对齐。2024年。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2405.12739)\n1. Zhang 等人。事半功倍：大型语言模型是优秀的自发性多语种学习者。2024年。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2405.13816)\n1. Zhang 等人。TS-Align：一个师生协作框架，用于大规模迭代微调大型语言模型。2024年。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2405.20215)\n1. Zihong Chen。基于XunziALLM的句子分割和标点符号添加。2024年。[[论文]](https:\u002F\u002Faclanthology.org\u002F2024.lt4hala-1.30)\n1. Gao 等人。兼得两者之长：迈向诚实且有用的大型语言模型。2024年。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2406.00380)\n1. Wang 和 Song。MARS：利用多任务评估数据集衡量语言模型的形而上学推理能力。2024年。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2406.02106)\n1. Hu 等人。基于Transformer模型的低秩适应（LoRA）的计算限制。2024年。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2406.03136)\n1. Ge 等人。通过高效微调进行时间敏感的知识编辑。ACL 2024。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2406.04496)\n1. Tan 等人。同行评审作为一种多轮且长上下文的对话，具有角色互动的特点。2024年。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2406.05688)\n1. Song 等人。Turbo Sparse：仅用最少激活参数就达到大型语言模型的最先进水平。2024年。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2406.05955)\n1. Gu 等人。RWKV-CLIP：一种鲁棒的视觉-语言表征学习器。2024年。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2406.06973)\n1. Chen 等人。推进工具增强型大型语言模型：整合推理树中错误的见解。2024年。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2406.07115)\n1. Zhu 等人。大型语言模型是优秀的统计学家吗？2024年。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2406.07815)\n1. Li 等人。知晓未知：一种针对大型语言模型指令微调的不确定性敏感方法。2024年。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2406.10099)\n1. Ding 等人。IntentionQA：一个用于评估语言模型在电子商务中理解购买意图能力的基准。2024年。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2406.10173)\n1. He 等人。COMMUNITY-CROSS-INSTRUCT：无监督指令生成，用于将大型语言模型对齐到在线社区。2024年。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2406.12074)\n1. Lin 等人。FVEL：通过定理证明，利用大型语言模型构建交互式形式化验证环境。2024年。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2406.14408)\n1. Treutlein 等人。串联线索：大型语言模型可以从分散的训练数据中推断并表达潜在结构。2024年。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2406.14546)\n1. Feng 等人。SS-Bench：一个用于社交故事生成与评估的基准。2024年。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2406.15695)\n1. Feng 等人。自建上下文分解，并辅以细粒度对齐增强。2024年。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2406.17233)\n1. Liu 等人。利用可穿戴生物信号，通过大型语言模型进行无袖血压测量。2024年。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2406.18069)\n1. Iyer 等人。探索利用大型语言模型进行极低资源翻译：爱丁堡大学提交给美洲NLP 2024翻译任务的作品。美洲NLP 2024。[[论文]](https:\u002F\u002Faclanthology.org\u002F2024.americasnlp-1.25)\n1. Li 等人。通过在科学问题评分中生成论证过程，利用思维树上的偏好优化校准大型语言模型。2024年。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2406.19949)\n1. Yang 等人。金融知识大型语言模型。2024年。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2407.00365)\n1. Lin 等人。DogeRM：通过模型合并为奖励模型配备领域知识。2024年。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2407.01470)\n1. Bako 等人。评估大型语言模型对数据可视化中自然语言话语的语义剖析能力。2024年。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2407.06129)\n1. Huang 等人。RoLoRA：对经过旋转处理且无异常值的大型语言模型进行微调，以实现有效的权重-激活量化。2024年。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2407.08044)\n1. Jiang 等人。大型语言模型合作开展面向大众的自动科学新闻报道。2024年。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2407.09756)\n1. Inouye 等人。LoRA超参数的自动化调优。2024年。[[论文]](https:\u002F\u002Fscholarcommons.scu.edu\u002Fcseng_senior\u002F272\u002F)\n1. Qi 等人。基于大型语言模型的西藏旅游景点信息生成系统研究。2024年。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2407.13561)\n1. Xu 等人。方向修正：利用合成偏好进行安全对齐。2024年。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2407.16637)\n1. Sun 等人。LAMBDA：一个基于大型模型的数据代理。2024年。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2407.17535)\n1. Zhu 等人。CollectiveSFT：通过医疗领域的集体指令，将大型语言模型扩展至中国医学基准。2024年。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2407.19705)\n1. Yu 等人。通过负注意力分数对齐纠正大型语言模型中的负面偏见。2024年。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2408.00137)\n1. Xie 等人。个性化数据集的力量：通过针对性的模型微调，提升小学阶段的中文作文写作水平。IALP 2024。[[论文]](https:\u002F\u002Fwww.asianlp.sg\u002Fconferences\u002Fialp2024\u002Fproceedings\u002Fpapers\u002FIALP2024_P055.pdf)\n1. Liu 等人。Instruct-Code-Llama：通过在线评测反馈，提升语言模型在竞赛级别代码生成方面的能力。ICIC 2024。[[论文]](https:\u002F\u002Flink.springer.com\u002Fchapter\u002F10.1007\u002F978-981-97-5669-8_11)\n1. Wang 等人。网络卫士：揭示监督式微调中安全数据选择对模型安全性的影响。ICIC 2024。[[论文]](https:\u002F\u002Flink.springer.com\u002Fchapter\u002F10.1007\u002F978-981-97-5669-8_23)\n1. Xia 等人。理解大型语言模型微调的性能并估算成本。2024年。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2408.04693)\n1. Zeng 等人。感知、反思和计划：设计无需指令的目标导向城市导航大型语言模型代理。2024年。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2408.04168)\n1. Xia 等人。利用预训练语言模型进行精准的ESG预测。FinNLP 2024。[[论文]](https:\u002F\u002Faclanthology.org\u002F2024.finnlp-2.1\u002F)\n1. Liang 等人。I-SHEEP：通过迭代自我增强范式，从零开始实现大型语言模型的自我对齐。2024年。[[arxiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2408.08072)\n1. Bai 等人。通过直接多偏好优化对大型语言模型进行推荐对齐。CIKM 2024。[[论文]](https:\u002F\u002Fdl.acm.org\u002Fdoi\u002F10.1145\u002F3627673.3679611)\n1. Zhang 等人。CPsyCoun：一个基于报告的多轮对话重建与评估框架，用于中国心理咨询。ACL 2024。[[论文]](https:\u002F\u002Faclanthology.org\u002F2024.findings-acl.830.pdf)\n1. **[StarWhisper](https:\u002F\u002Fgithub.com\u002FYu-Yang-Li\u002FStarWhisper)**：一款基于ChatGLM2-6B和Qwen-14B的天文学专用大型语言模型。\n1. **[DISC-LawLLM](https:\u002F\u002Fgithub.com\u002FFudanDISC\u002FDISC-LawLLM)**：一款专注于中国法律领域的大型语言模型，基于Baichuan-13B，能够检索和推理法律知识。\n1. **[Sunsimiao](https:\u002F\u002Fgithub.com\u002FX-D-Lab\u002FSunsimiao)**：一款专注于中国医学领域的大型语言模型，基于Baichuan-7B和ChatGLM-6B。\n1. **[CareGPT](https:\u002F\u002Fgithub.com\u002FWangRongsheng\u002FCareGPT)**：一系列专注于中国医学领域的大型语言模型，基于LLaMA2-7B和Baichuan-13B。\n1. **[MachineMindset](https:\u002F\u002Fgithub.com\u002FPKU-YuanGroup\u002FMachine-Mindset\u002F)**：一系列基于MBTI性格类型的大型语言模型，能够根据不同的数据集和训练方法为任何大型语言模型赋予16种不同的人格类型。\n1. **[Luminia-13B-v3](https:\u002F\u002Fhuggingface.co\u002FNekochu\u002FLuminia-13B-v3)**：一款专门用于生成稳定扩散元数据的大型语言模型。[[演示]](https:\u002F\u002Fhuggingface.co\u002Fspaces\u002FNekochu\u002FLuminia-13B_SD_Prompt)\n1. **[Chinese-LLaVA-Med](https:\u002F\u002Fgithub.com\u002FBUAADreamer\u002FChinese-LLaVA-Med)**：一款基于LLaVA-1.5-7B的多模态大型语言模型，专注于中国医学领域。\n1. **[AutoRE](https:\u002F\u002Fgithub.com\u002FTHUDM\u002FAutoRE)**：一个基于大型语言模型的文档级关系抽取系统。\n1. **[NVIDIA RTX AI Toolkit](https:\u002F\u002Fgithub.com\u002FNVIDIA\u002FRTX-AI-Toolkit)**：用于在Windows PC上使用NVIDIA RTX微调大型语言模型的SDK。\n1. **[LazyLLM](https:\u002F\u002Fgithub.com\u002FLazyAGI\u002FLazyLLM)**：一种简单便捷的方式来构建多智能体大型语言模型应用，并支持通过LLaMA Factory进行模型微调。\n1. **[RAG-Retrieval](https:\u002F\u002Fgithub.com\u002FNLPJCL\u002FRAG-Retrieval)**：一个完整的RAG检索模型微调、推理和蒸馏流程。[[博客]](https:\u002F\u002Fzhuanlan.zhihu.com\u002Fp\u002F987727357)\n1. **[360-LLaMA-Factory](https:\u002F\u002Fgithub.com\u002FQihoo360\u002F360-LLaMA-Factory)**：一个修改过的库，支持使用环形注意力进行长序列SFT和DPO。\n1. **[Sky-T1](https:\u002F\u002Fnovasky-ai.github.io\u002Fposts\u002Fsky-t1\u002F)**：由NovaSky AI微调的一款类似o1的模型，成本非常低廉。\n1. **[WeClone](https:\u002F\u002Fgithub.com\u002Fxming521\u002FWeClone)**：一个一站式解决方案，可根据聊天记录创建您的数字化身。\n1. **[EmoLLM](https:\u002F\u002Fgithub.com\u002FSmartFlowAI\u002FEmoLLM)**：一个关于大型语言模型（LLMs）与心理健康的合作项目。\n\u003C\u002Fdetails>\n\n## 许可证\n\n本仓库采用 [Apache-2.0 许可证](LICENSE) 许可。\n\n请遵守各模型的许可证条款以使用相应的模型权重：[BLOOM](https:\u002F\u002Fhuggingface.co\u002Fspaces\u002Fbigscience\u002Flicense) \u002F [DeepSeek](https:\u002F\u002Fgithub.com\u002Fdeepseek-ai\u002FDeepSeek-LLM\u002Fblob\u002Fmain\u002FLICENSE-MODEL) \u002F [Falcon](https:\u002F\u002Fhuggingface.co\u002Ftiiuae\u002Ffalcon-180B\u002Fblob\u002Fmain\u002FLICENSE.txt) \u002F [Gemma](https:\u002F\u002Fai.google.dev\u002Fgemma\u002Fterms) \u002F [GLM-4](https:\u002F\u002Fhuggingface.co\u002FTHUDM\u002Fglm-4-9b\u002Fblob\u002Fmain\u002FLICENSE) \u002F [GPT-2](https:\u002F\u002Fgithub.com\u002Fopenai\u002Fgpt-2\u002Fblob\u002Fmaster\u002FLICENSE) \u002F [Granite](LICENSE) \u002F [InternLM](https:\u002F\u002Fgithub.com\u002FInternLM\u002FInternLM#license) \u002F [Llama](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002Fllama\u002Fblob\u002Fmain\u002FMODEL_CARD.md) \u002F [Llama 2](https:\u002F\u002Fai.meta.com\u002Fllama\u002Flicense\u002F) \u002F [Llama 3](https:\u002F\u002Fllama.meta.com\u002Fllama3\u002Flicense\u002F) \u002F [Llama 4](https:\u002F\u002Fgithub.com\u002Fmeta-llama\u002Fllama-models\u002Fblob\u002Fmain\u002Fmodels\u002Fllama4\u002FLICENSE) \u002F [MiniCPM](https:\u002F\u002Fgithub.com\u002FOpenBMB\u002FMiniCPM\u002Fblob\u002Fmain\u002FMiniCPM%20Model%20License.md) \u002F [Mistral\u002FMixtral\u002FPixtral](LICENSE) \u002F [Phi-3\u002FPhi-4](https:\u002F\u002Fhuggingface.co\u002Fmicrosoft\u002FPhi-3-mini-4k-instruct\u002Fblob\u002Fmain\u002FLICENSE) \u002F [Qwen](https:\u002F\u002Fgithub.com\u002FQwenLM\u002FQwen\u002Fblob\u002Fmain\u002FTongyi%20Qianwen%20LICENSE%20AGREEMENT) \u002F [StarCoder 2](https:\u002F\u002Fhuggingface.co\u002Fspaces\u002Fbigcode\u002Fbigcode-model-license-agreement) \u002F [TeleChat2](https:\u002F\u002Fhuggingface.co\u002FTele-AI\u002Ftelechat-7B\u002Fblob\u002Fmain\u002FTeleChat%E6%A8%A1%E5%9E%8B%E7%A4%BE%E5%8C%BA%E8%AE%B8%E5%8F%AF%E5%8D%8F%E8%AE%AE.pdf) \u002F [Yuan 2](https:\u002F\u002Fgithub.com\u002FIEIT-Yuan\u002FYuan-2.0\u002Fblob\u002Fmain\u002FLICENSE-Yuan)\n\n## 引用\n\n如果本工作对您有所帮助，请引用如下：\n\n```bibtex\n@inproceedings{zheng2024llamafactory,\n  title={LlamaFactory: Unified Efficient Fine-Tuning of 100+ Language Models},\n  author={Yaowei Zheng and Richong Zhang and Junhao Zhang and Yanhan Ye and Zheyan Luo and Zhangchi Feng and Yongqiang Ma},\n  booktitle={Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 3: System Demonstrations)},\n  address={曼谷, 泰国},\n  publisher={Association for Computational Linguistics},\n  year={2024},\n  url={http:\u002F\u002Farxiv.org\u002Fabs\u002F2403.13372}\n}\n```\n\n## 致谢\n\n本项目受益于 [PEFT](https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Fpeft)、[TRL](https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Ftrl)、[QLoRA](https:\u002F\u002Fgithub.com\u002Fartidoro\u002Fqlora) 和 [FastChat](https:\u002F\u002Fgithub.com\u002Flm-sys\u002FFastChat)。感谢他们的杰出工作。\n\n## 星标历史\n\n![星标历史图](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fhiyouga_LlamaFactory_readme_eb1701c90259.png)","# LLaMA Factory 快速上手指南\n\nLLaMA Factory 是一个一站式大语言模型微调框架，支持通过命令行（CLI）或 Web 界面（LLaMA Board）对 100+ 种主流大模型（如 Llama 3, Qwen2.5, DeepSeek, GLM-4 等）进行全量微调、LoRA、QLoRA 及多模态训练。\n\n## 1. 环境准备\n\n### 系统要求\n- **操作系统**: Linux (推荐), macOS, Windows\n- **Python**: 3.8 - 3.12\n- **GPU**: NVIDIA GPU (推荐显存 ≥ 16GB)，支持 CUDA 11.1+；也支持 AMD ROCm 及华为昇腾 NPU。\n- **磁盘空间**: 根据模型大小预留足够空间（建议至少 50GB）。\n\n### 前置依赖\n确保已安装以下基础工具：\n- Git\n- CUDA Toolkit (如需 GPU 加速)\n- PyTorch (通常由安装脚本自动处理)\n\n> **国内开发者提示**：推荐使用国内镜像源加速依赖下载，后续安装步骤中已包含相关配置。\n\n## 2. 安装步骤\n\n### 方法一：源码安装（推荐）\n\n克隆仓库并进入目录：\n```bash\ngit clone --depth 1 https:\u002F\u002Fgithub.com\u002Fhiyouga\u002FLLaMA-Factory.git\ncd LLaMA-Factory\n```\n\n#### 基础安装（CPU\u002F通用 GPU）\n```bash\npip install -e \".[torch,metrics]\" -i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple\n```\n\n#### 进阶安装（开启 FlashAttention-2 加速）\n若你的显卡支持 Ampere 架构及以上（如 RTX 3090, A100, H100），强烈建议安装此版本以大幅提升训练速度：\n```bash\npip install -e \".[torch,flash-attn,metrics]\" -i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple\n```\n\n#### 量化训练支持 (QLoRA)\n如需进行 4-bit\u002F8-bit 量化微调，需额外安装 bitsandbytes：\n```bash\npip install -e \".[torch,quantization,metrics]\" -i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple\n```\n\n### 方法二：Docker 安装（最简环境隔离）\n\n拉取官方镜像并启动容器（自动挂载当前目录）：\n```bash\ndocker run --gpus all -it --rm \\\n  -v $(pwd)\u002Fdata:\u002Fapp\u002Fdata \\\n  -v $(pwd)\u002Foutput:\u002Fapp\u002Foutput \\\n  -v $(pwd)\u002Fmodels:\u002Fapp\u002Fmodels \\\n  hiyouga\u002Fllamafactory:latest\n```\n*注：Windows PowerShell 用户请将 `-v $(pwd)` 替换为 `-v ${PWD}`。*\n\n## 3. 基本使用\n\nLLaMA Factory 提供两种主要使用方式：**Web UI (零代码)** 和 **命令行 (CLI)**。\n\n### 方式一：使用 LLaMA Board Web UI（推荐新手）\n\n启动可视化界面，无需编写代码即可完成数据配置、训练参数调整和监控。\n\n```bash\nllamafactory-web\n```\n\n启动后在浏览器访问 `http:\u002F\u002Flocalhost:7860`。\n1. **选择模型**: 在下拉菜单中选择预训练模型（如 `Qwen2.5-7B-Instruct`）。\n2. **准备数据**: 上传或使用内置数据集（支持 JSON\u002FAlpaca 格式）。\n3. **配置参数**: 选择微调方法（如 `lora`）、学习率、Batch Size 等。\n4. **开始训练**: 点击 \"Start\" 按钮，实时查看 Loss 曲线。\n\n### 方式二：使用命令行 CLI（适合自动化\u002F服务器）\n\n#### 1. 数据准备\n将数据集整理为 JSONL 格式，例如 `data\u002Fmy_data.json`：\n```json\n{\"messages\": [{\"role\": \"user\", \"content\": \"你好\"}, {\"role\": \"assistant\", \"content\": \"你好！有什么可以帮你的吗？\"}]}\n{\"messages\": [{\"role\": \"user\", \"content\": \"介绍下北京\"}, {\"role\": \"assistant\", \"content\": \"北京是中国的首都...\"}]}\n```\n在 `dataset_info.json` 中注册该数据集（或直接使用内置数据集名称）。\n\n#### 2. 执行微调命令\n以下是一个使用 LoRA 微调 Qwen2.5-7B 的最小化示例：\n\n```bash\nllamafactory-cli train \\\n    --stage sft \\\n    --do_train \\\n    --model_name_or_path Qwen\u002FQwen2.5-7B-Instruct \\\n    --dataset alpaca_en_demo \\\n    --template qwen \\\n    --finetuning_type lora \\\n    --lora_target q_proj,v_proj \\\n    --output_dir output\u002Fqwen2.5-lora \\\n    --overwrite_cache \\\n    --per_device_train_batch_size 4 \\\n    --gradient_accumulation_steps 4 \\\n    --lr_scheduler_type cosine \\\n    --logging_steps 10 \\\n    --warmup_ratio 0.1 \\\n    --save_steps 1000 \\\n    --learning_rate 5e-5 \\\n    --num_train_epochs 3.0 \\\n    --plot_loss \\\n    --fp16\n```\n\n**关键参数说明：**\n- `--model_name_or_path`: 模型名称（自动从 HuggingFace\u002FModelScope 下载）或本地路径。\n- `--dataset`: 数据集名称（需在 `dataset_info.json` 中定义，内置数据集可直接用）。\n- `--template`: 对话模板，必须与模型匹配（如 `qwen`, `llama3`, `chatglm` 等）。\n- `--finetuning_type`: 微调类型 (`full`, `freeze`, `lora`, `qlora`)。\n- `--output_dir`: 模型保存路径。\n\n#### 3. 导出与推理\n训练完成后，合并 LoRA 权重并启动推理：\n\n```bash\n# 导出合并后的模型\nllamafactory-cli export \\\n    --model_name_or_path Qwen\u002FQwen2.5-7B-Instruct \\\n    --adapter_name_or_path output\u002Fqwen2.5-lora \\\n    --template qwen \\\n    --export_dir output\u002Fqwen2.5-merged \\\n    --export_size 2 \\\n    --export_legacy_format False\n\n# 启动 OpenAI 风格 API 服务\nllamafactory-cli api \\\n    --model_name_or_path output\u002Fqwen2.5-merged \\\n    --template qwen \\\n    --api_port 8000\n```\n\n### 国内加速提示\n若从 HuggingFace 下载模型缓慢，可设置环境变量使用 ModelScope 镜像：\n```bash\nexport USE_MODELSCOPE_HUB=1\n```\n然后在命令中将 `--model_name_or_path` 替换为 ModelScope 上的模型 ID（如 `qwen\u002FQwen2.5-7B-Instruct`）。","某金融科技公司需要快速将通用的 Qwen2.5 大模型定制为精通内部合规文档的“风控助手”，以辅助分析师处理海量非结构化报告。\n\n### 没有 LlamaFactory 时\n- **环境配置繁琐**：团队需手动编写复杂的 DeepSpeed 配置文件，针对不同显卡型号反复调试依赖库，耗费数天搭建训练环境。\n- **多模型适配困难**：若想对比 Llama 3 与 ChatGLM 的效果，必须重写数据预处理脚本和训练入口代码，切换成本极高。\n- **资源利用率低**：缺乏对 LoRA、QLoRA 等高效微调技术的统一封装，显存占用过大，导致只能在少量高端卡上运行，排队等待时间长。\n- **过程监控黑盒**：训练过程中难以直观查看损失曲线或即时测试模型输出，往往等到训练结束才发现效果不佳，需推倒重来。\n\n### 使用 LlamaFactory 后\n- **一键启动训练**：通过简单的 YAML 配置文件或 Web UI 界面，仅需几分钟即可加载预置模板，自动完成环境适配并启动任务。\n- **无缝切换模型**：支持 100+ 种主流模型架构，只需修改配置中的模型名称参数，即可在同一套流程下快速验证不同基座的表现。\n- **极致显存优化**：内置优化的量化与并行策略，让单张消费级显卡也能流畅运行 7B 甚至更大参数模型的微调，大幅降低硬件门槛。\n- **可视化全流程**：集成 LLaMA Board 可视化面板，实时监测训练指标并支持在线对话测试，让迭代调优过程透明可控。\n\nLlamaFactory 将原本需要资深算法工程师耗时数周的模型定制工作，转化为普通开发者几天内即可完成的标准化流程，极大加速了垂直领域 AI 应用的落地。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fhiyouga_LlamaFactory_4fc78d1d.png","hiyouga","Yaowei Zheng","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Fhiyouga_646130a8.jpg","No code All live","Millennium Science School","Beijing, China","hiyouga@buaa.edu.cn","llamafactory_ai",null,"https:\u002F\u002Fgithub.com\u002Fhiyouga",[84,88,92],{"name":85,"color":86,"percentage":87},"Python","#3572A5",99.7,{"name":89,"color":90,"percentage":91},"Dockerfile","#384d54",0.3,{"name":93,"color":94,"percentage":95},"Makefile","#427819",0,69758,8503,"2026-04-08T17:50:10","Apache-2.0","Linux, macOS, Windows","NVIDIA GPU 必需（支持多卡），显存需求视模型大小而定（QLoRA 最低约 6-8GB，全量微调需更大），支持 CUDA；同时支持 AMD GPU (ROCm) 和华为 NPU","未说明（建议 16GB+ 以处理大型数据集和模型）",{"notes":104,"python":105,"dependencies":106},"支持多种量化格式（AWQ, GPTQ, AQLM 等）以降低显存需求；提供 Docker 镜像简化部署；支持通过 FlashAttention-2 和 Unsloth 加速训练；可使用 Conda 或 Docker 搭建环境。","未说明（通常建议 3.9+ 以兼容最新 PyTorch 版本）",[107,108,109,110,111,112,113,114,115],"torch","transformers","accelerate","peft","trl","datasets","gradio","vllm","bitsandbytes",[13,35,15,14],[118,119,120,110,108,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135],"fine-tuning","llama","llm","rlhf","qlora","quantization","qwen","instruction-tuning","gpt","lora","large-language-models","agent","ai","moe","llama3","deepseek","gemma","nlp",22,"2026-03-27T02:49:30.150509","2026-04-09T09:33:20.164517",[140,145,150,155,160,165],{"id":141,"question_zh":142,"answer_zh":143,"source_url":144},25980,"使用 DeepSpeed 微调 Mixtral 模型时出现报错或训练卡死怎么办？","这通常是因为 `num_experts_per_token` 参数配置不正确。对于 Mixtral 模型，该值应设置为 8（而不是默认的 4）。请检查您的配置文件，确保将 `num_experts_per_token` 显式设置为 8，修改后通常可解决挂起或报错问题。","https:\u002F\u002Fgithub.com\u002Fhiyouga\u002FLlamaFactory\u002Fissues\u002F1845",{"id":146,"question_zh":147,"answer_zh":148,"source_url":149},25981,"训练 Qwen3-VL (8B\u002F4B) 等多模态模型时 GPU 利用率低下但不报错，如何解决？","该问题通常由 PyTorch 版本过高或缺少 cuDNN 库引起。解决方案如下：\n1. 降级 PyTorch 版本：尝试将 torch 从 2.9.x 降级至 2.7.1 或 2.8.0。\n2. 更换基础镜像：在 Dockerfile 中使用包含 cuDNN 的镜像，例如 `cuda:12.9.1-cudnn-devel-ubuntu24.04`。\n3. 重新安装依赖：执行 `pip install torch==2.8.0 torchvision==0.23.0 torchaudio==2.8.0 --index-url https:\u002F\u002Fdownload.pytorch.org\u002Fwhl\u002Fcu129`，确保 `pip list` 中能看见 `nvidia-cudnn-cu12` 库。","https:\u002F\u002Fgithub.com\u002Fhiyouga\u002FLlamaFactory\u002Fissues\u002F9282",{"id":151,"question_zh":152,"answer_zh":153,"source_url":154},25982,"百川 (Baichuan) 模型的 template 中 stop_words 配置是否正确？导出模型后推理异常如何处理？","如果在使用百川模板训练后导出的模型推理效果异常（如无法正确停止生成），请执行以下步骤：\n1. 更新 LLaMA-Factory 代码到最新版本。\n2. 重新使用 `--template baichuan` 参数进行训练。\n更新代码并重新训练后，无论是使用官方 `cli_demo.py` 还是 FastChat 进行推理，均应恢复正常。","https:\u002F\u002Fgithub.com\u002Fhiyouga\u002FLlamaFactory\u002Fissues\u002F481",{"id":156,"question_zh":157,"answer_zh":158,"source_url":159},25983,"如何使用 vLLM 部署经过 LLaMA-Factory 微调后的 InternVL3-HF 系列模型？","微调后的 `-HF` 版本模型不能直接用于 vLLM 服务，需要转换为 `-Chat` 版本。具体步骤如下：\n1. 使用项目提供的脚本将保存的检查点转换为 InternVL-Chat 格式（脚本会处理权重重排和配置）。\n2. 将转换生成的 `model.safetensors` 文件替换到原始模型目录（即包含正确 `config.json` 的目录）中。\n3. 使用该目录启动 vLLM 服务，例如：`vllm serve .\u002FInternVL3-2B`。\n注意：此流程已在 InternVL3-2B-hf (lm_type: qwen2) 上验证，其他型号可能需要额外测试。","https:\u002F\u002Fgithub.com\u002Fhiyouga\u002FLlamaFactory\u002Fissues\u002F8086",{"id":161,"question_zh":162,"answer_zh":163,"source_url":164},25984,"使用 DeepSpeed ZeRO-3 微调 Baichuan-13b-chat 系列模型后效果失效（回答不准确），但单卡训练正常，原因是什么？","这是一个已知问题，在使用 DeepSpeed ZeRO-3 对 Baichuan-13b-chat 和 Baichuan2-13b-chat 进行微调时，可能会导致模型权重聚合错误或效果失效。如果必须使用多卡训练，建议暂时避免使用 ZeRO-3 策略，或者尝试改用单卡训练、DeepSpeed ZeRO-2 或其他并行策略，直到该特定架构的多卡适配问题被修复。","https:\u002F\u002Fgithub.com\u002Fhiyouga\u002FLlamaFactory\u002Fissues\u002F837",{"id":166,"question_zh":167,"answer_zh":168,"source_url":159},25985,"量化后的 InternVL 模型在 vLLM 中运行时提示 'vocab_size' 属性错误怎么办？","当量化后的 InternVL 模型（如 W8A8-FP8KV 版本）在 vLLM 中报错 `AttributeError: 'InternVLConfig' object has no attribute 'vocab_size'` 时，说明配置文件不完整。解决方法是将量化后的模型权重转换回标准的 InternVL-Chat 模型格式，并确保使用原始未量化模型的 `config.json` 配置文件，或者手动在配置文件中补充缺失的 `vocab_size` 等关键属性。",[170,175,180,185,190,195,200,205,210,215,220,225,230,235,240,245,250,255,260,265],{"id":171,"version":172,"summary_zh":173,"released_at":174},163352,"v0.9.4","### 2025年告别。感谢所有贡献者和支持者。我们将在2026年继续为社区提供简单高效的LLM微调框架。敬请期待。\n\n### 重要更新\n\n- 仓库名称已更新：LLaMA-Factory → **LlamaFactory**\n- Python 3.9–3.10 已被弃用；LlamaFactory 现在需要 **Python 3.11–3.13**\n- 从 pip 迁移到 **[uv](https:\u002F\u002Fgithub.com\u002Fastral-sh\u002Fuv)**；请使用 `uv pip install llamafactory`\n- LlamaFactory 官方 **博客**现已上线：https:\u002F\u002Fblog.llamafactory.net\u002Fen\u002F\n\n### 新特性\n\n- 🔥 在 #8623 中，@zqiu24 支持了 **[正交微调 (OFT)](https:\u002F\u002Farxiv.org\u002Fabs\u002F2506.19847)**\n- 🔥 在 #9267 中，@ximinng 为新增令牌支持了 **语义初始化**\n- 🔥 在 #9237 中，@Kuangdd01 通过 [MCoreAdapter](https:\u002F\u002Fgithub.com\u002Falibaba\u002FROLL\u002Ftree\u002Fmain\u002Fmcore_adapter) 支持了 **Megatron-LM** 训练\n- 🔥 在 #9400 中，@JimmyPeilinLi 支持了 **[KTransformers](https:\u002F\u002Fgithub.com\u002Fkvcache-ai\u002Fktransformers)** 后端\n- 🔥 在 #8930 中，@Kuangdd01 支持了 [MPO](https:\u002F\u002Farxiv.org\u002Fabs\u002F2403.19443) 算法\n- 在 #8960 中，@penfever 支持了 FP8 训练\n- 在 #9569 中，@tangefly 支持了 [Transformers v5](https:\u002F\u002Fhuggingface.co\u002Fblog\u002Ftransformers-v5)\n- 在 #9610 中，@tangefly 支持了函数调用消息中的推理和明文\n- 在 #9602 中，@sunyi0505 支持了 DeepSpeed AutoTP\n- 在 #9520 中，@frozenleaves 支持了高效的 NPU 融合算子\n- 在 #9617 中，@UsernameFull 支持了 TRL 0.24\n\n### 模型\n\n- 在 #8403 中，@dhiaEddineRhaiem 提供了 Falcon H1\n- 在 #8462 中，@Kuangdd01 提供了 Kimi-VL 和 GLM-4.5V\n- 在 #8509 中，@Kuangdd01 提供了 Gemma3n\n- 在 #8680 中，@Tuyohai 提供了 Granite4\n- 在 #8750 中，@hiyouga 提供了 Qwen3-2507\n- 在 #8813 中，@ZMXJJ 提供了 MiniCPM-V 4.0\n- 在 #8976 中，@hhaAndroid 提供了 Intern-S1-mini\n- 在 #8992 中，@Kuangdd01 提供了 Seed-OSS\n- 在 #9022 中，@tc-mb 提供了 MiniCPM-V 4.5\n- 在 #9028 中，@Kuangdd01 提供了 InternVL-3.5\n- 在 #9165 中，@isLinXu 提供了 ERNIE-4.5-Text 和 ERNIE-4.5-VL\n- 在 #9188 中，@wangsff 提供了 Ling-V2\n- 在 #9196 中，@xvxuopop 和 @Kuangdd01 共同提供了 Qwen3-VL 和 Qwen3-Omni\n- 在 #9284 中，@wyfdgg 提供了 Hunyuan-mt\n- 在 #9586 中，@isLinXu 提供了 GLM-4.6V\n- 在 #9582 中，@tangefly 提供了 Ministral 3\n- 在 #9616 中，@isLinXu 提供了 VibeThinker\n- 在 #9637 中，@isLinXu 提供了 MiMo-V2-Flash\n- 在 #9680 中，@isLinXu 提供了 MiniMax-M1 和 MiniMax-M2\n\n### 感谢2025年与LlamaFactory合作的团队\n\n- NPU团队：@jiaqiw09 @frozenleaves @xvxuopop @UsernameFull @codemayq\n- KTransformers团队：@JimmyPeilinLi @poryfly @mrhaoxx\n- ROLL团队\n\n### 以及作出重大贡献的个人\n\n- @Kuangdd01 @isLinXu @tangefly\n- [@Copilot](https:\u002F\u002Fgithub.com\u002Fapps\u002Fcopilot-swe-agent)\n\n**完整变更日志**：https:\u002F\u002Fgithub.com\u002Fhiyouga\u002FLLaMA-Factory\u002Fcompare\u002Fv0.9.3...v0.9.4","2025-12-31T15:00:14",{"id":176,"version":177,"summary_zh":178,"released_at":179},163353,"v0.9.3","### 我们将于6月20日参加**AWS峰会上海2025**！上海见👋\n\n- 活动信息：https:\u002F\u002Faws.amazon.com\u002Fcn\u002Fevents\u002Fsummits\u002Fshanghai\u002F\n\n### 新功能\n\n- 🔥 @Kuangdd01 在#7258 中推出的 InternVL2.5\u002FInternVL3 模型\n- 🔥 @Kuangdd01 在#7537 中推出的 Qwen2.5-Omni 模型\n- 🔥 @hiyouga 在#7273 和 #7611 中推出的 Llama 4 和 Gemma 3 多模态模型\n- 🔥 @yzoaim 在#8181 中发布的[官方 GPU Docker 镜像](https:\u002F\u002Fhub.docker.com\u002Fr\u002Fhiyouga\u002Fllamafactory\u002Ftags)\n- 🔥 @Qiaolin-Yu 和 @jhinpan 在#7278 中实现的 SGLang 推理\n- @zRzRzRzRzRzRzR 在#7695 中推出的 GLM-4-0414 和 GLM-Z1 模型\n- @Kuangdd01 在#7719 中推出的 Kimi-VL 模型\n- @hiyouga 在#7885 中推出的 Qwen3 模型\n- @Kuangdd01 在#7946 和 #8249 中推出的 MiMo 和 MiMo-VL 模型\n- @akshatsehgal 在#8050 和 #8220 中推出的 SmolLM\u002FSmolLM2 模型\n- @LDLINGLINGLING 在#8314 中推出的 MiniCPM4 模型\n- @Kuangdd01 在#8335 中推出的 Mistral-Small-3.1 模型\n- @SnowFox4004 在#7419 中添加的 `scripts\u002Feval_bleu_rouge.py`\n- @tianshijing 在#7749 中添加的 Muon 优化器\n- @hiyouga 在#7566 中支持的 vLLM 视频\u002F音频推理\n- @erictang000 在#7567 中支持的 S3\u002FGCS 云端数据\n- @leo-pony 在#7739 中支持的 vLLM-ascend\n- @hiyouga 在#7793 中支持的 OmegaConf\n- @hiyouga 在#7797 中支持的早停机制\n- @hiyouga 在#7928 中为推理模型添加的 `enable_thinking` 参数\n- @hubutui 在#8286 中实现的 PyTorch-elastic 容错启动\n- @amangup 在#8362 中提出的长度去敏感化 DPO（[LD-DPO](https:\u002F\u002Farxiv.org\u002Fabs\u002F2409.06411)）\n\n### 新模型\n\n- 基础模型\n  - SmolLM\u002FSmolLM2（135M\u002F360M\u002F1.7B）📄\n  - Qwen3 Base（0.6B\u002F1.7B\u002F4B\u002F8B\u002F14B\u002F30B）📄\n  - Gemma 3（1B\u002F4B\u002F12B\u002F27B）📄🖼️\n  - MedGemma（4B）📄🩺\n  - MiMo Base（7B）📄\n  - Seed-Coder Base（8B）📄⌨️\n  - Mistral-Small-3.1 Base（24B）📄🖼️\n  - GLM-4-0414 Base（32B）📄\n  - Llama 4（109B\u002F492B）📄🖼️\n- 指令\u002F聊天模型\n  - SmolLM\u002FSmolLM2 Instruct（135M\u002F360M\u002F1.7B）📄🤖\n  - MiniCPM4（0.5B\u002F8B）📄🤖\n  - Qwen3（0.6B\u002F1.7B\u002F4B\u002F8B\u002F14B\u002F32B\u002F30B\u002F235B）📄🤖🧠\n  - Gemma 3 Instruct（1B\u002F4B\u002F12B\u002F27B）📄🤖🖼️\n  - InternVL2.5\u002F3 Instruct\u002FMPO（1B\u002F2B\u002F8B\u002F14B\u002F38B\u002F78B）📄🤖🖼️\n  - Qwen2.5-Omni（3B\u002F7B）📄🤖🖼️🔈\n  - MedGemma Instruct（4B\u002F27B）📄🤖🩺\n  - MiMo SFT\u002FRL（7B）📄🤖\n  - MiMo-VL SFT\u002FRL（7B）📄🤖🖼️\n  - Hunyuan Instruct（7B）📄🤖\n  - Seed-Coder Instruct\u002FReasoning（8B）📄🤖🧠⌨️\n  - GLM-4-0414\u002FGLM-Z1 Instruct（9B\u002F32B）📄🤖🧠\n  - DeepSeek-R1-0528（8B\u002F671B）📄🤖🧠\n  - Kimi-VL Instruct\u002FThinking（17B）📄🤖🧠🖼️\n  - Mistral-Small-3.1 Instruct（24B）📄🤖🖼️\n  - Qwen2.5-VL Instruct（32B）📄🤖🖼️\n  - Llama 4 Instruct（109B\u002F492B）📄🤖🖼️\n\n### 新数据集\n\n- 偏好数据集\n  - COIG-P（中文）📄\n\n### Bug 修复\n\n- @flashJd 在#7253 中修复了新增 token 的问题\n- @felladrin 在#7259 中修复了 ultrachat_200k 数据集的问题\n- @BlackWingedKing 在#7272 中为整齐打包添加了高效的 4D 注意力掩码\n- @x22x22 在#7304 中修复了 WSD 学习率调度器的问题\n- @BlackWingedKing 在#7318 中修复了整齐打包中的位置 ID 问题\n- @taoharry 在#7332 中修复了 WebUI 中的代理设置问题\n- @ENg-122 在#7345 中改进了入口点\n- @","2025-06-16T17:21:46",{"id":181,"version":182,"summary_zh":183,"released_at":184},163354,"v0.9.2","### 我们将于3月16日参加**vLLM北京 meetup**！北京见哦 👋\n\n- 活动信息：https:\u002F\u002Fmp.weixin.qq.com\u002Fs\u002FviPRDlhnzS3qO9-96fMeeA\n\n### 新功能\n\n- 🔥 @zhuhanqing 在#6617 中引入的**[APOLLO优化器](https:\u002F\u002Farxiv.org\u002Fabs\u002F2412.05270)**\n- 🔥 @Zeyi-Lin 在#6401 中添加的实验跟踪工具**[SwanLab](https:\u002F\u002Fgithub.com\u002FSwanHubX\u002FSwanLab)**\n- 🔥 @erictang000 在#6542 中集成的**[Ray Trainer](https:\u002F\u002Fdocs.ray.io\u002Fen\u002Flatest\u002Ftrain\u002Ftrain.html)**\n- @JieShenAI 在#6190 中实现的使用**vLLM TP**进行批量推理\n- @codemayq 在#6601 中支持的Ascend NPU上的QLoRA\n- @hiyouga 在#6693 中实现的Yarn和Llama3的rope缩放\n- @erictang000 在#6907 中添加的对`uv run`的支持\n- @codemayq 在#4686 中实现的Ollama modelfile自动生成\n- @AlongWY 在#5473 中提出的Mistral工具提示\n- @hiyouga 在#6367 和 #6369 中提出的Llama3和Qwen2的工具提示\n\n### 新模型\n\n- 基础模型\n  - GPT2 (0.1B\u002F0.4B\u002F0.8B\u002F1.5B) 📄\n  - Granite 3.0-3.1 (1B\u002F2B\u002F3B\u002F8B) 📄\n  - PaliGemma2 (3B\u002F10B\u002F28B) 📄🖼️\n  - Moonlight (16B) 📄\n  - DeepSeek V2-V2.5 Base (236B) 📄\n  - DeepSeek V3 Base (671B) 📄\n- 指令\u002F聊天模型\n  - Granite 3.0-3.1 (1B\u002F2B\u002F3B\u002F8B) by @Tuyohai 在#5922 中 📄🤖\n  - DeepSeek R1 (1.5B\u002F7B\u002F8B\u002F14B\u002F32B\u002F70B\u002F671B) by @Qwtdgh 在#6767 中 📄🤖\n  - TeleChat2 (3B\u002F7B\u002F12B\u002F35B\u002F115B) @ge-xing 在#6313 中 📄🤖\n  - Qwen2.5-VL (3B\u002F7B\u002F72B) by @hiyouga 在#6779 中 📄🤖🖼️\n  - PaliGemma2-mix (3B\u002F10B\u002F28B) by @Kuangdd01 在#7060 中 📄🤖🖼️\n  - Qwen2 Audio (7B) by @BUAADreamer 在#6701 中 📄🤖🔈\n  - MiniCPM-V\u002FMiniCPM-o (8B) by @BUAADreamer 在#6598 和 #6631 中 📄🤖🖼️🔈\n  - InternLM3-Instruct (8B) by @hhaAndroid 在#6640 中 📄🤖\n  - Marco-o1 (8B) 📄🤖\n  - Skywork-o1 (8B) 📄🤖\n  - Phi-4 (14B) 📄🤖\n  - Moonlight Instruct (16B) 📄\n  - Mistral Small (24B) 📄🤖\n  - QwQ (32B) 📄🤖\n  - Llama-3.3-Instruct (70B) 📄🤖\n  - QvQ (72B) 📄🤖🖼️\n  - DeepSeek V2-V2.5 (236B) 📄🤖\n  - DeepSeek V3 (671B) 📄🤖\n\n### 新数据集\n\n- 监督微调数据集\n  - OpenO1 (en) 📄\n  - Open Thoughts (en) 📄\n  - Open-R1-Math (en) 📄\n  - Chinese-DeepSeek-R1-Distill (zh) 📄\n\n### 变更\n\n- @hiyouga 在#6600 中重构了VLM注册机制\n- @hiyouga 在#6895 中重构了多模态插件\n- @hiyouga 在#6896 中重构了模板\n- @hiyouga 在#6901 中重构了数据流水线\n- @hiyouga 在#6976 中更新了VLM参数\n- 我们使用[BFG Repo-Cleaner](https:\u002F\u002Fgithub.com\u002Frtyley\u002Fbfg-repo-cleaner)清理了Git历史中的大文件，备份仓库请见[这里](https:\u002F\u002Fgithub.com\u002Fhiyouga\u002FLLaMA-Factory-backup)\n\n### Bug修复\n\n- @yafshar 在#5819 中添加了`trust_remote_code`选项\n- @hiyouga 在#6137 和 #6140 中修复了mllama配置\n- @hiyouga 在#6151 和 #6874 中修复了mllama填充问题\n- @hiyouga 在#6157 中固定了tokenizers版本\n- @village-way 在#6160 中修复了分词后数据加载问题\n- @hykilpikonna 在#6170 中在WebUI中显示主机名\n- @hiyouga 在#6233 中修复了VLMs zero3训练问题\n- @hiyouga 在#6363 中添加了`skip_special_tokens`\n- @hiyouga 在#6364 中支持非可重入GC\n- @hiyouga 在#6388 中添加了`disable_shuffling`选项\n- @hiyouga 在#6395 中修复了生成参数kwargs的问题\n- 启用","2025-03-11T13:47:35",{"id":186,"version":187,"summary_zh":188,"released_at":189},163355,"v0.9.1","### 新功能\n\n- 🔥支持 **Llama-3.2** 和 **Llama-3.2-Vision**，由 @marko1616 在 #5547 和 #5555 中实现\n- 🔥支持 **LLaVA-NeXT**、**LLaVA-NeXT-Video** 和 **Video-LLaVA**，由 @BUAADreamer 在 #5574 中实现\n- 🔥支持 **Pixtral** 模型，由 @Kuangdd01 在 #5581 中实现\n- 支持 EXAONE3.0，由 @shing100 在 #5585 中实现\n- 支持 Index 系列模型，由 @Cuiyn 在 #5910 中实现\n- 支持 Qwen2-VL 的 Liger-Kernel，由 @aliencaocao 在 #5438 中实现\n- 支持从 ModelHub 下载模型，由 @huniu20 在 #5642 中实现\n- 修复 transformers 4.46 中的异常损失值，由 @hiyouga 在 #5852 和 #5871 中实现\n- 支持多图像推理，由 @hiyouga 在 #5895 中实现\n- 支持计算 SFT 和 DPO 的有效 token 数量，由 @wtmlon 在 #6078 中实现\n\n注意：现在您可以安装 `transformers>=4.46.0,\u003C=4.46.1` 来启用 [梯度累积修复](https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Ftransformers\u002Fpull\u002F34191)。\n\n### 新模型\n\n- 基础模型\n  - Qwen2.5 (0.5B\u002F1.5B\u002F3B\u002F7B\u002F14B\u002F32B\u002F72B) 📄\n  - Qwen2.5-Coder (0.5B\u002F1.5B\u002F3B\u002F7B\u002F14B\u002F32B) 📄🖥️\n  - Llama-3.2 (1B\u002F3B) 📄\n  - OpenCoder (1.5B\u002F8B) 📄🖥️\n  - Index (1.9B) 📄\n- 指令\u002F聊天模型\n  - Qwen2.5-Instruct (0.5B\u002F1.5B\u002F3B\u002F7B\u002F14B\u002F32B\u002F72B) 📄🤖\n  - Qwen2.5-Coder-Instruct (0.5B\u002F1.5B\u002F3B\u002F7B\u002F14B\u002F32B) 📄🤖🖥️\n  - Llama-3.2-Instruct (1B\u002F3B) 📄🤖\n  - OpenCoder-Instruct (1.5B\u002F8B) 📄🤖🖥️\n  - Index-Chat (1.9B) 📄🤖\n  - LLaVA-NeXT (7B\u002F8B\u002F13B\u002F34B\u002F72B\u002F110B) 📄🤖🖼️\n  - LLaVA-NeXT-Video (7B\u002F34B) 📄🤖🖼️\n  - Video-LLaVA (7B) 📄🤖🖼️\n  - Pixtral (12B) 📄🤖🖼️\n  - EXAONE-3.0-Instruct (8B) 📄🤖\n\n### 安全修复\n\n- 修复 [CVE-2024-52803](https:\u002F\u002Fgithub.com\u002Fadvisories\u002FGHSA-hj3w-wrh4-44vp)，由 @superboy-zjc 在 aa6a174d6822340022433c5ba38182b4932adecb 中实现\n\n### 错误修复\n\n- 更新 rocm docker 的版本，由 @HardAndHeavy 在 #5427 中更新\n- 修复 Phi-3-small 模板，由 @menibrief 在 #5475 中修复\n- 修复函数调用数据集处理函数，由 @whybeyoung 在 #5483 中修复\n- 添加 docker 参数，由 @StrangeBytesDev 在 #5533 中添加\n- 修复日志记录器，由 @chengchengpei 在 #5546 中修复\n- 修复 Gemma2 的闪存注意力警告，由 @amrear 在 #5580 中修复\n- 更新设置，由 @johnnynunez 在 #5615 和 #5665 中更新\n- 添加项目，由 @NLPJCL 在 #5801 中添加\n- 修复保存 Qwen2-VL 处理器的问题，由 @hiyouga 在 #5857 中修复\n- 支持在 Dockerfile 中更改基础镜像，由 @sd3ntato 在 #5880 中实现\n- 修复模板替换行为，由 @hiyouga 在 #5907 中修复\n- 添加 `image_dir` 参数，由 @hiyouga 在 #5909 中添加\n- 添加 rank0 日志记录器，由 @hiyouga 在 #5912 中添加\n- 修复 DPO 指标，由 @hiyouga 在 #5913 和 #6052 中修复\n- 更新数据集版本，由 @hiyouga 在 #5926 中更新\n- 修复聊天引擎，由 @hiyouga 在 #5927 中修复\n- 修复 vllm 0.6.3 版本，由 @hiyouga 在 #5970 中修复\n- 修复 llamaboard 中的额外参数，由 @hiyouga 在 #5971 中修复\n- 修复 vllm 输入参数，由 @JJJJerry 在 #5973 中修复\n- 添加 `vllm_config` 参数，由 @hiyouga 在 #5982 和 #5990 中添加\n- 在 docker compose 配置中添加 shm_size，由 @XYZliang 在 #6010 中添加\n- 修复 tyro 版本，由 @hiyouga 在 #6065 中修复\n- 修复 CI 流程，由 @hiyouga 在 #6120 中修复\n- 修复 Qwen2-VL 在 vLLM 上的推理问题，由 @hiyouga 在 #6123 和 #6126 中修复\n- 发布 v0.9.1 版本，由 @hiyouga 在 #6124 中发布\n- 修复 #3881、#4712、#5411、#5542、#5549、#5611、#5668、#5705、#5747、#5749、#5768、#5796、#5797、#5883、#5904、#5966、#5988 等问题，由…","2024-11-24T17:17:33",{"id":191,"version":192,"summary_zh":193,"released_at":194},163356,"v0.9.0","### 恭喜达到3万颗星 🎉 请在 *[X (twitter)](https:\u002F\u002Ftwitter.com\u002Fllamafactory_ai)* 关注我们\n\n### 新功能\n\n- 🔥支持在多图像数据集上微调 **[Qwen2-VL](https:\u002F\u002Fgithub.com\u002FQwenLM\u002FQwen2-VL)** 模型，由 @simonJJJ 在 #5290 中实现\n- 🔥通过 `enable_liger_kernel` 参数支持高效节省时间和内存的 **[Liger-Kernel](https:\u002F\u002Fgithub.com\u002Flinkedin\u002FLiger-Kernel)**，由 @hiyouga 实现\n- 🔥通过 `use_adam_mini` 参数支持内存高效的 **[Adam-mini](https:\u002F\u002Fgithub.com\u002Fzyushun\u002FAdam-mini)** 优化器，由 @relic-yuexi 在 #5095 中实现\n- 支持在视频数据集上微调 Qwen2-VL 模型，由 @hiyouga 在 #5365 和 @BUAADreamer 在 #4136 中实现（需应用补丁 https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Ftransformers\u002Fpull\u002F33307）\n- 支持使用 RLHF\u002FDPO\u002FORPO\u002FSimPO 方法对视觉语言模型（VLMs）进行微调，由 @hiyouga 实现\n- 通过 `use_unsloth_gc` 参数支持 [Unsloth](https:\u002F\u002Funsloth.ai\u002Fblog\u002Flong-context) 的异步激活卸载方法\n- 支持 vLLM 0.6.0 版本\n- 支持计算 MFU，由 @yzoaim 在 #5388 中实现\n\n### 新模型\n\n- 基础模型\n  - Qwen2-Math (1.5B\u002F7B\u002F72B) 📄🔢\n  - Yi-Coder (1.5B\u002F9B) 📄🖥️\n  - InternLM2.5 (1.8B\u002F7B\u002F20B) 📄\n  - Gemma-2-2B 📄\n  - Meta-Llama-3.1 (8B\u002F70B) 📄\n- 指令\u002F聊天模型\n  - MiniCPM\u002FMiniCPM3 (1B\u002F2B\u002F4B)，由 @LDLINGLINGLING 在 #4996 和 #5372 中实现 📄🤖\n  - Qwen2-Math-Instruct (1.5B\u002F7B\u002F72B) 📄🤖🔢\n  - Yi-Coder-Chat (1.5B\u002F9B) 📄🤖🖥️\n  - InternLM2.5-Chat (1.8B\u002F7B\u002F20B) 📄🤖\n  - Qwen2-VL-Instruct (2B\u002F7B) 📄🤖🖼️\n  - Gemma-2-2B-it，由 @codemayq 在 #5037 中实现 📄🤖\n  - Meta-Llama-3.1-Instruct (8B\u002F70B) 📄🤖\n  - Mistral-Nemo-Instruct (12B) 📄🤖\n\n### 新数据集\n\n- 监督微调数据集\n  - Magpie-ultra-v0.1 (en) 📄\n  - Pokemon-gpt4o-captions (en&zh) 📄🖼️\n- 偏好数据集\n  - RLHF-V (en) 📄🖼️\n  - VLFeedback (en) 📄🖼️\n\n### 变更\n\n- 出于兼容性考虑，微调视觉语言模型（VLMs）需要 `transformers>=4.35.0.dev0`，可尝试运行 `pip install git+https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Ftransformers.git` 进行安装。\n- `visual_inputs` 已弃用，现在无需指定该参数。\n- LlamaFactory 现在采用多模态输入的懒加载机制，详情请参见 #5346。请使用 `preprocessing_batch_size` 来限制数据集预处理时的批次大小（由 @naem1023 在 #5323 中支持）。\n- LlamaFactory 现在支持 `lmf`（等同于 `llamafactory-cli`）作为快捷命令。\n\n### Bug 修复\n\n- 修复 LlamaBoard 导出问题，由 @liuwwang 在 #4950 中完成\n- 添加 ROCm Dockerfile，由 @HardAndHeavy 在 #4970 中完成\n- 修复 DeepSeek 模板问题，由 @piamo 在 #4892 中完成\n- 修复 Pissa 保存回调问题，由 @codemayq 在 #4995 中完成\n- 在 LlamaBoard 中添加韩语显示语言，由 @Eruly 在 #5010 中完成\n- 修复 DeepseekCoder 模板问题，由 @relic-yuexi 在 #5072 中完成\n- 修复示例问题，由 @codemayq 在 #5109 中完成\n- 修复 `mask_history` 从末尾截断的问题，由 @YeQiuO 在 #5115 中完成\n- 修复 Jinja 模板问题，由 @YeQiuO 在 #5156 中完成\n- 修复 PPO 优化器和学习率调度器问题，由 @liu-zichen 在 #5163 中完成\n- 添加 SailorLLM 模板","2024-09-08T17:14:03",{"id":196,"version":197,"summary_zh":198,"released_at":199},163357,"v0.8.3","### 新特性\n\n- 🔥支持通过 `neat_packing` 参数实现【无污染打包】功能，由 @chuan298 在 #4224 中提出  \n- 🔥支持通过 `eval_dataset` 参数进行拆分评估，由 @codemayq 在 #4691 中提出  \n- 🔥支持 HQQ\u002FEETQ 量化，通过 `quantization_method` 参数实现，由 @hiyouga 提出  \n- 🔥在使用 BAdam 时支持 ZeRO-3，由 @Ledzy 在 #4352 中实现  \n- 支持基于最后一轮对话进行训练，通过 `mask_history` 参数实现，由 @aofengdaxia 在 #4878 中提出  \n- 添加 NPU Dockerfile，由 @MengqingCao 在 #4355 中完成  \n- 支持在 Dockerfile 中构建 FlashAttention2，由 @hzhaoy 在 #4461 中实现  \n- 支持在评估时使用 `batch_eval_metrics`，由 @hiyouga 提出  \n\n### 新模型\n\n- 基础模型\n  - InternLM2.5-7B 📄\n  - Gemma2（9B\u002F27B） 📄\n- 指令\u002F聊天模型\n  - TeleChat-1B-Chat，由 @hzhaoy 在 #4651 中提出 📄🤖\n  - InternLM2.5-7B-Chat 📄🤖\n  - CodeGeeX4-9B-Chat 📄🤖\n  - Gemma2-it（9B\u002F27B） 📄🤖\n\n### 变更\n\n- 修复 DPO 的截断长度，并弃用 `reserved_label_len` 参数  \n- 改进奖励建模的损失函数  \n\n### Bug 修复\n\n- 修复 NumPy 版本问题，由 @MengqingCao 在 #4382 中完成  \n- 改进命令行界面，由 @kno10 在 #4409 中完成  \n- 添加 `tool_format` 参数以控制提示模板，由 @mMrBun 在 #4417 中完成  \n- 自动标记 NPU 相关问题，由 @MengqingCao 在 #4445 中完成  \n- 修复 flash_attn 参数问题，由 @stceum 在 #4446 中完成  \n- 修复 docker-compose 路径问题，由 @MengqingCao 在 #4544 中完成  \n- 修复 torch-npu 依赖问题，由 @hashstone 在 #4561 中完成  \n- 修复 DeepSpeed + Pissa 的兼容性问题，由 @hzhaoy 在 #4580 中完成  \n- 改进命令行界面，由 @injet-zhou 在 #4590 中完成  \n- 添加项目配置，由 @wzh1994 在 #4662 中完成  \n- 修复文档字符串，由 @hzhaoy 在 #4673 中完成  \n- 修复 WebUI 中 Windows 命令预览的问题，由 @marko1616 在 #4700 中完成  \n- 修复 vLLM 0.5.1 的问题，由 @T-Atlas 在 #4706 中完成  \n- 修复保存价值头模型回调函数的问题，由 @yzoaim 在 #4746 中完成  \n- 修复 CUDA Dockerfile，由 @hzhaoy 在 #4781 中完成  \n- 修复示例代码，由 @codemayq 在 #4804 中完成  \n- 修复评估数据拆分问题，由 @codemayq 在 #4821 中完成  \n- 修复 CI 流程，由 @codemayq 在 #4822 中完成  \n- 修复以下 issue：#2290、#3974、#4113、#4379、#4398、#4402、#4410、#4419、#4432、#4456、#4458、#4549、#4556、#4579、#4592、#4609、#4617、#4674、#4677、#4683、#4684、#4699、#4705、#4731、#4742、#4779、#4780、#4786、#4792、#4820、#4826","2024-07-18T18:00:06",{"id":201,"version":202,"summary_zh":203,"released_at":204},163358,"v0.8.2","### 新特性\n\n- 支持 GLM-4 工具及并行函数调用，由 @mMrBun 在 #4173 中实现\n- 支持 **PiSSA** 微调，由 @hiyouga 在 #4307 中实现\n\n### 新模型\n\n- 基础模型\n  - DeepSeek-Coder-V2（16B MoE\u002F236B MoE）📄\n- 指令\u002F聊天模型\n  - MiniCPM-2B 📄🤖\n  - DeepSeek-Coder-V2-Instruct（16B MoE\u002F236B MoE）📄🤖\n\n### 新数据集\n\n- 监督微调数据集\n  - Neo-sft（zh）\n  - Magpie-Pro-300K-Filtered（en），由 @EliMCosta 在 #4309 中提供\n  - WebInstruct（en），由 @EliMCosta 在 #4309 中提供\n\n### Bug 修复\n\n- 修复 DPO+ZeRO3 问题，由 @hiyouga 完成\n- 添加 MANIFEST.in 文件，由 @iamthebot 在 #4191 中完成\n- 修复 llama3 预训练中的 eos_token 问题，由 @dignfei 在 #4204 中完成\n- 修复 vllm 版本问题，由 @kimdwkimdw 和 @hzhaoy 分别在 #4234 和 #4246 中完成\n- 修复 Dockerfile，由 @EliMCosta 在 #4314 中完成\n- 修复 pandas 版本问题，由 @zzxzz12345 在 #4334 中完成\n- 修复 #3162、#3196、#3778、#4198、#4209、#4221、#4227、#4238、#4242、#4271、#4292、#4295、#4326、#4346、#4357、#4362 等多个问题","2024-06-19T13:06:16",{"id":206,"version":207,"summary_zh":208,"released_at":209},163359,"v0.8.1","- 修复 #2666：Unsloth+DoRA\n- 修复 #4145：Docker 镜像中的 PyTorch 版本与 vLLM 的要求不匹配\n- 修复 #4160：在 @f-q23 的帮助下解决 LongLoRA 实现中的问题\n- 修复 #4167：由 @yzoaim 解决的 Windows 系统安装问题\n","2024-06-10T16:50:22",{"id":211,"version":212,"summary_zh":213,"released_at":214},163360,"v0.8.0","### 更强大的 [LlamaBoard](https:\u002F\u002Fgithub.com\u002Fhiyouga\u002FLLaMA-Factory?tab=readme-ov-file#fine-tuning-with-llama-board-gui-powered-by-gradio) 💪😀\n\n- 在 Web UI 中支持单节点分布式训练\n- 添加下拉菜单，方便从检查点恢复和选择已保存的配置，由 @hiyouga 和 @hzhaoy 在 #4053 中实现\n- 支持选择全参数微调或冻结微调的检查点\n- 为 LlamaBoard 添加吞吐量指标，由 @injet-zhou 在 #4066 中实现\n- 提升 UI 加载速度\n\n### 新功能\n\n- 添加 KTO 算法，由 @enji-zhou 在 #3785 中实现\n- 添加 SimPO 算法，由 @hiyouga 实现\n- 支持将 `max_lora_rank` 传递给 vLLM 后端，由 @jue-jue-zi 在 #3794 中实现\n- 支持 sharegpt 格式的偏好数据集，并移除 Git 仓库中的大文件，由 @hiyouga 在 #3799 中实现\n- 支持在 CLI 推理中设置系统消息，由 @ycjcl868 在 #3812 中实现\n- 在 `dataset_info.json` 中添加 `num_samples` 选项，由 @seanzhang-zhichen 在 #3829 中实现\n- 添加 NPU Docker 镜像，由 @dongdongqiang2018 在 #3876 中实现\n- 完善 NPU 文档，由 @MengqingCao 在 #3930 中实现\n- 支持使用贪心背包算法进行 SFT 打包，由 @AlongWY 在 #4009 中实现\n- 添加 `llamafactory-cli env` 命令，用于提交错误报告\n- 支持 API 模式下的图像输入\n- 支持通过 `train_from_scratch` 参数进行随机初始化\n- 初始化 CI 流程\n\n### 新模型\n\n- 基础模型\n  - Qwen2 (0.5B\u002F1.5B\u002F7B\u002F72B\u002FMoE) 📄\n  - PaliGemma-3B (pt\u002Fmix) 📄🖼️\n  - GLM-4-9B 📄\n  - Falcon-11B 📄\n  - DeepSeek-V2-Lite (16B) 📄\n- 指令\u002F聊天模型\n  - Qwen2-Instruct (0.5B\u002F1.5B\u002F7B\u002F72B\u002FMoE) 📄🤖\n  - Mistral-7B-Instruct-v0.3 📄🤖\n  - Phi-3-small-8k-instruct (7B) 📄🤖\n  - Aya-23 (8B\u002F35B) 📄🤖\n  - OpenChat-3.6-8B 📄🤖\n  - GLM-4-9B-Chat 📄🤖\n  - TeleChat-12B-Chat，由 @hzhaoy 在 #3958 中实现 📄🤖\n  - Phi-3-medium-8k-instruct (14B) 📄🤖\n  - DeepSeek-V2-Lite-Chat (16B) 📄🤖\n  - Codestral-22B-v0.1 📄🤖\n\n### 新数据集\n\n- 预训练数据集\n  - FineWeb (en)\n  - FineWeb-Edu (en)\n- 监督微调数据集\n  - Ruozhiba-GPT4 (zh)\n  - STEM-Instruction (zh)\n- 偏好数据集\n  - Argilla-KTO-mix-15K (en)\n  - UltraFeedback (en)\n\n### 错误修复\n\n- 修复多模态微调中的 RLHF 问题\n- 修复多模态微调中的 LoRA 目标，由 @BUAADreamer 在 #3835 中修复\n- 修复 `yi` 模板，由 @Yimi81 在 #3925 中修复\n- 修复 LlamaBoard 中的中断问题，由 @injet-zhou 在 #3987 中修复\n- 将 `scheduler_specific_kwargs` 传递给 `get_scheduler`，由 @Uminosachi 在 #4006 中实现\n- 修复超参数帮助文档，由 @xu-song 在 #4007 中修复\n- 更新 Issue 模板，由 @statelesshz 在 #4011 中更新\n- 修复 vllm 的 dtype 参数\n- 修复超参数导出问题，由 @MengqingCao 在 #4080 中修复\n- 修复 PPO 训练器中的 DeepSpeed ZeRO3 问题\n- 修复 #3108、#3387、#3646、#3717、#3764、#3769、#3803、#3807、#3818、#3837、#3847、#3853、#3873、#3900、#3931、#3965、#3971、#3978、#3992、#4005、#4012、#4013、#4022、#4033、#4043、#4061、#4075、#4077、#4079、#4085、#4090、#4120、#4132、#4137、#4139 等问题","2024-06-07T22:26:46",{"id":216,"version":217,"summary_zh":218,"released_at":219},163361,"v0.7.1","### 🚨🚨 核心重构 🚨🚨\n\n- 新增 **CLI** 使用方式，现推荐使用 `llamafactory-cli` 启动训练与推理，入口位于 [cli.py](https:\u002F\u002Fgithub.com\u002Fhiyouga\u002FLLaMA-Factory\u002Fblob\u002Fmain\u002Fsrc\u002Fllamafactory\u002Fcli.py)  \n- 重命名文件：`train_bash.py` → `train.py`、`train_web.py` → `webui.py`、`api_demo.py` → `api.py`  \n- 删除文件：`cli_demo.py`、`evaluate.py`、`export_model.py`、`web_demo.py`，改用 `llamafactory-cli chat\u002Feval\u002Fexport\u002Fwebchat` 替代  \n- 示例中改用 **YAML 配置文件** 而非 Shell 脚本，以提升可读性  \n- 加载数据集时移除 SHA1 哈希校验  \n- 重命名参数：`num_layer_trainable` → `freeze_trainable_layers`、`name_module_trainable` → `freeze_trainable_modules`\n\n以上改动由 @hiyouga 在 #3596 中完成。\n\n#### 提醒：现在使用 LLaMA Factory 必须先进行 [安装](https:\u002F\u002Fgithub.com\u002Fhiyouga\u002FLLaMA-Factory?tab=readme-ov-file#installation)\n\n### 新功能\n\n- 由 @zhou-wjjw 和 @statelesshz 支持在 Ascend NPU 910 设备上进行训练与推理（同时提供 Docker 镜像）  \n- 由 @zhaonx 在 #3527 中支持 vLLM 引擎中的 `stop` 参数  \n- 通过 `freeze_extra_modules` 参数支持冻结微调中的 Token Embedding 微调  \n- 在 README 中新增 Llama3 [快速入门](https:\u002F\u002Fgithub.com\u002Fhiyouga\u002FLLaMA-Factory?tab=readme-ov-file#quickstart)\n\n### 新模型\n\n- 基础模型  \n  - Yi-1.5（6B\u002F9B\u002F34B）📄  \n  - DeepSeek-V2（236B）📄  \n- 指令\u002F聊天模型  \n  - Yi-1.5-Chat（6B\u002F9B\u002F34B）📄🤖  \n  - Yi-VL-Chat（6B\u002F34B），由 @BUAADreamer 在 #3748 中贡献 📄🖼️🤖  \n  - Llama3-Chinese-Chat（8B\u002F70B）📄🤖  \n  - DeepSeek-V2-Chat（236B）📄🤖  \n\n### Bug 修复\n\n- 由 @codemayq 在 #3487 中为 LlamaBoard 添加 badam 参数  \n- 由 @khazic 在 #3490 中将 OpenAI 数据格式添加至 README  \n- 由 @hiyouga 修复 DPO\u002FORPO 训练器运行缓慢的问题  \n- 由 @pha123661 在 #3578 中修复 badam 示例  \n- 由 @ZeyuTeng96 在 #3588 中修复 nectar_rm 数据集的下载链接  \n- 由 @Katehuuh 在 #3601 中新增项目  \n- 由 @gaussian8 在 #3604 中修复 Dockerfile  \n- 由 @BUAADreamer 在 #3651 中修复 MLLMs 的完整微调问题  \n- 由 @cocktailpeanut 在 #3654 中修复 Gradio 环境变量  \n- 由 @Tendo33 在 #3655 中修复 API 中的拼写错误并添加日志记录  \n- 由 @YUUUCC 在 #3683 中修复 phi-3 模型的下载链接  \n- 修复 #3559、#3560、#3602、#3603、#3606、#3625、#3650、#3658、#3674、#3694、#3702、#3724、#3728 等相关问题","2024-05-15T18:16:30",{"id":221,"version":222,"summary_zh":223,"released_at":224},163362,"v0.7.0","### Congratulations on 20k stars 🎉 We are the 1st of the *GitHub Trending* at Apr. 23rd 🔥 Follow us at *[X](https:\u002F\u002Ftwitter.com\u002Fllamafactory_ai)* \r\n\r\n### New features\r\n\r\n- Support SFT\u002FPPO\u002FDPO\u002FORPO for the **LLaVA-1.5** model by @BUAADreamer in #3450 \r\n- Support inferring the LLaVA-1.5 model with both native Transformers and vLLM by @hiyouga in #3454 \r\n- Support **vLLM+LoRA** inference for partial models (see [support list](https:\u002F\u002Fdocs.vllm.ai\u002Fen\u002Flatest\u002Fmodels\u002Fsupported_models.html))\r\n- Support 2x faster generation of the QLoRA model based on [UnslothAI](https:\u002F\u002Fgithub.com\u002Funslothai\u002Funsloth)'s optimization\r\n- Support adding new special tokens to the tokenizer via the `new_special_tokens` argument\r\n- Support choosing the device to merge LoRA in LlamaBoard via the `export_device` argument\r\n- Add a Colab notebook for getting into fine-tuning the Llama-3 model on a free T4 GPU\r\n- Automatically enable SDPA attention and fast tokenizer for higher performance\r\n\r\n### New models\r\n\r\n- Base models\r\n  - OLMo-1.7-7B\r\n  - Jamba-v0.1-51B\r\n  - Qwen1.5-110B\r\n  - DBRX-132B-Base\r\n- Instruct\u002FChat models\r\n  - Phi-3-mini-3.8B-instruct (4k\u002F128k)\r\n  - LLaVA-1.5-7B\r\n  - LLaVA-1.5-13B\r\n  - Qwen1.5-110B-Chat\r\n  - DBRX-132B-Instruct\r\n\r\n### New datasets\r\n\r\n- Supervised fine-tuning datasets\r\n  - LLaVA mixed (en&zh) by @BUAADreamer in #3471 \r\n- Preference datasets\r\n  - DPO mixed (en&zh) by @hiyouga \r\n\r\n### Bug fix\r\n\r\n- Fix #2093 #3333 #3347 #3374 #3387 \r\n","2024-04-27T20:24:50",{"id":226,"version":227,"summary_zh":228,"released_at":229},163363,"v0.6.3","### New features\r\n\r\n- Support Meta Llama-3 (8B\u002F70B) models\r\n- Support [UnslothAI](https:\u002F\u002Fgithub.com\u002Funslothai\u002Funsloth)'s long-context QLoRA optimization (56,000 context length for Llama-2 7B in 24GB)\r\n- Support previewing local datasets in directories in LlamaBoard by @codemayq in #3291 \r\n\r\n### New algorithms\r\n\r\n- Support [BAdam](https:\u002F\u002Farxiv.org\u002Fabs\u002F2404.02827) algorithm by @Ledzy in #3287 \r\n- Support [Mixture-of-Depths](https:\u002F\u002Farxiv.org\u002Fabs\u002F2404.02258) training by @mlinmg in #3338 \r\n\r\n### New models\r\n\r\n- Base models\r\n  - CodeGemma (2B\u002F7B)\r\n  - CodeQwen1.5-7B\r\n  - Llama-3 (8B\u002F70B)\r\n  - Mixtral-8x22B-v0.1\r\n- Instruct\u002FChat models\r\n  - CodeGemma-7B-it\r\n  - CodeQwen1.5-7B-Chat\r\n  - Llama-3-Instruct (8B\u002F70B)\r\n  - Command R (35B) by @marko1616 in #3254 \r\n  - Command R+ (104B) by @marko1616 in #3254 \r\n  - Mixtral-8x22B-Instruct-v0.1\r\n\r\n### Bug fix\r\n\r\n- Fix full-tuning batch prediction examples by @khazic in #3261 \r\n- Fix output_router_logits of Mixtral by @liu-zichen in #3276 \r\n- Fix automodel from pretrained with attn implementation (see https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Ftransformers\u002Fissues\u002F30298)\r\n- Fix unable to convergence issue in the layerwise galore optimizer (see https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Ftransformers\u002Fissues\u002F30371)\r\n- Fix #3184 #3238 #3247 #3273 #3316 #3317 #3324 #3348 #3352 #3365 #3366 \r\n","2024-04-21T15:43:07",{"id":231,"version":232,"summary_zh":233,"released_at":234},163364,"v0.6.2","### New features\r\n\r\n- Support **[ORPO](https:\u002F\u002Farxiv.org\u002Fabs\u002F2403.07691)** algorithm by @hiyouga in #3066 \r\n- Support inferring BNB 4-bit models on multiple GPUs via the `quantization_device_map` argument\r\n- Reorganize README files, move example scripts to the `examples` folder\r\n- Support saving & loading arguments quickly in LlamaBoard by @hiyouga and @marko1616 in #3046 \r\n- Support load alpaca-format dataset from the hub without `dataset_info.json` by specifying `--dataset_dir ONLINE`\r\n- Add a parameter `moe_aux_loss_coef` to control the coefficient of auxiliary loss in MoE models.\r\n\r\n### New models\r\n\r\n- Base models\r\n  - Breeze-7B-Base\r\n  - Qwen1.5-MoE-A2.7B (14B)\r\n  - Qwen1.5-32B\r\n- Instruct\u002FChat models\r\n  - Breeze-7B-Instruct\r\n  - Qwen1.5-MoE-A2.7B-Chat (14B)\r\n  - Qwen1.5-32B-Chat\r\n\r\n### Bug fix\r\n\r\n- Fix pile dataset download config by @lealaxy in #3053 \r\n- Fix model generation config by @marko1616 in #3057 \r\n- Fix qwen1.5 models DPO training by @changingivan and @hiyouga in #3083 \r\n- Support Qwen1.5-32B by @sliderSun in #3160 \r\n- Support Breeze-7B by @codemayq in #3161 \r\n- Fix `addtional_target` in unsloth by @kno10 in #3201 \r\n- Fix #2807 #3022 #3023 #3046 #3077 #3085 #3116 #3200 #3225 \r\n","2024-04-11T12:27:01",{"id":236,"version":237,"summary_zh":238,"released_at":239},163365,"v0.6.1","This patch mainly fixes #2983 \r\n\r\nIn commit 9bec3c98a22c91b1c28fda757db51eb780291641, we built the optimizer and scheduler inside the trainers, which inadvertently introduced a bug: when DeepSpeed was enabled, the trainers in transformers would build an optimizer and scheduler before calling the `create_optimizer_and_scheduler` method [1], then the optimizer created by our method would overwrite the original one, while the scheduler would not. Consequently, the scheduler would no longer affect the learning rate in the optimizer, leading to a regression in the training result. We have fixed this bug in 3bcd41b639899e72bcabc51d59bac8967af19899 and 8c77b1091296e204dc3c8c1f157c288ca5b236bd. Thank @HideLord for helping us identify this critical bug.\r\n\r\n[1] https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Ftransformers\u002Fblob\u002Fv4.39.1\u002Fsrc\u002Ftransformers\u002Ftrainer.py#L1877-L1881\r\n\r\nWe have also fixed #2961 #2981 #2982 #2983 #2991 #3010 \r\n","2024-03-29T04:07:57",{"id":241,"version":242,"summary_zh":243,"released_at":244},163366,"v0.6.0","### We released our [paper](https:\u002F\u002Farxiv.org\u002Fabs\u002F2403.13372) on arXiv! Thanks to all co-authors and [AK's recommendation](https:\u002F\u002Ftwitter.com\u002F_akhaliq\u002Fstatus\u002F1770660136391946656)\r\n\r\n### New features\r\n\r\n- Support **GaLore** algorithm, allowing full-parameter learning of a 7B model using less than 24GB VRAM\r\n- Support **FSDP+QLoRA** that allows QLoRA fine-tuning of a 70B model on 2x24GB GPUs\r\n- Support **LoRA+** algorithm for better LoRA fine-tuning by @qibaoyuan in #2830 \r\n- LLaMA Factory 🤝 [vLLM](https:\u002F\u002Fgithub.com\u002Fvllm-project\u002Fvllm), enjoy **270%** inference speed with `--infer_backend vllm`\r\n- Add Colab [notebook](https:\u002F\u002Fcolab.research.google.com\u002Fdrive\u002F1eRTPn37ltBbYsISy9Aw2NuI2Aq5CQrD9?usp=sharing) for easily getting started\r\n- Support pushing fine-tuned models to Hugging Face Hub in web UI\r\n- Support `apply_chat_template` by adding a chat template to the tokenizer after fine-tuning\r\n- Add dockerize support by @S3Studio in #2743 #2849 \r\n\r\n### New models\r\n\r\n- Base models\r\n  - OLMo (1B\u002F7B)\r\n  - StarCoder2 (3B\u002F7B\u002F15B)\r\n  - Yi-9B\r\n- Instruct\u002FChat models\r\n  - OLMo-7B-Instruct\r\n\r\n### New datasets\r\n\r\n- Supervised fine-tuning datasets\r\n  - Cosmopedia (en)\r\n- Preference datasets\r\n  - Orca DPO (en)\r\n\r\n### Bug fix\r\n\r\n- Fix flash_attn in web UI by @cx2333-gt in #2730 \r\n- Fix deepspeed runtime error in PPO by @stephen-nju in #2746 \r\n- Fix readme ddp instruction by @khazic in #2903 \r\n- Fix environment variable in datasets by @SirlyDreamer in #2905 \r\n- Fix readme information by @0xez in #2919 \r\n- Fix generation config validation by @marko1616 in #2945 \r\n- Fix requirements by @rkinas in #2963 \r\n- Fix bitsandbytes windows version by @Tsumugii24 in #2967 \r\n- Fix #2346 #2642 #2649 #2732 #2735 #2756 #2766 #2775 #2777 #2782 #2798 #2802 #2803 #2817 #2895 #2928 #2936 #2941 \r\n","2024-03-25T15:50:44",{"id":246,"version":247,"summary_zh":248,"released_at":249},163367,"v0.5.3","### New features\r\n\r\n- Support **[DoRA](https:\u002F\u002Farxiv.org\u002Fabs\u002F2402.09353)** (Weight-Decomposed LoRA)\r\n- Support QLoRA for the AWQ\u002FAQLM quantized models, now **2-bit QLoRA** is feasible\r\n- Provide some example scripts in https:\u002F\u002Fgithub.com\u002Fhiyouga\u002FLLaMA-Factory\u002Ftree\u002Fmain\u002Fexamples\r\n\r\n### New models\r\n\r\n- Base models\r\n  - Gemma (2B\u002F7B)\r\n- Instruct\u002FChat models\r\n  - Gemma-it (2B\u002F7B)\r\n\r\n### Bug fix\r\n\r\n- Add flash-attn package for Windows user by @codemayq in #2514 \r\n- Fix ppo trainer #1163 by @stephen-nju in #2525 \r\n- Support atom models by @Rayrtfr in #2531 \r\n- Support role in webui by @lungothrin in #2575 \r\n- Bump accelerate to 0.27.2 and fix #2552 by @Katehuuh in #2608 \r\n- Fix #2512 #2516 #2532 #2533 #2629 \r\n","2024-02-28T17:01:31",{"id":251,"version":252,"summary_zh":253,"released_at":254},163368,"v0.5.2","### New features\r\n\r\n- Support **block expansion** in [LLaMA Pro](https:\u002F\u002Fgithub.com\u002FTencentARC\u002FLLaMA-Pro), see `tests\u002Fllama_pro.py` for usage\r\n- Add `use_rslora` option for the LoRA method\r\n\r\n### New models\r\n\r\n- Base models\r\n  - Qwen1.5 (0.5B\u002F1.8B\u002F4B\u002F7B\u002F14B\u002F72B)\r\n  - DeepSeekMath-7B-Base\r\n  - DeepSeekCoder-7B-Base-v1.5\r\n  - Orion-14B-Base\r\n- Instruct\u002FChat models\r\n  - Qwen1.5-Chat (0.5B\u002F1.8B\u002F4B\u002F7B\u002F14B\u002F72B)\r\n  - MiniCPM-2B-SFT\u002FDPO\r\n  - DeepSeekMath-7B-Instruct\r\n  - DeepSeekCoder-7B-Instruct-v1.5\r\n  - Orion-14B-Chat\r\n  - Orion-14B-Long-Chat\r\n  - Orion-14B-RAG-Chat\r\n  - Orion-14B-Plugin-Chat\r\n\r\n### New datasets\r\n\r\n- Supervised fine-tuning datasets\r\n  - SlimOrca (en)\r\n  - Dolly (de)\r\n  - Dolphin (de)\r\n  - Airoboros (de)\r\n- Preference datasets\r\n  - Orca DPO (de)\r\n\r\n### Bug fix\r\n\r\n- Fix `torch_dtype` check in export model by @fenglui in #2262 \r\n- Add Russian locale to LLaMA Board by @seoeaa in #2264 \r\n- Remove manually set `use_cache` in export model by @yhyu13 in #2266 \r\n- Fix DeepSpeed Zero3 training with MoE models by @A-Cepheus in #2283 \r\n- Add a patch for full training of the Mixtral model using DeepSpeed Zero3 by @ftgreat in #2319 \r\n- Fix bug in data pre-processing by @lxsyz in #2411 \r\n- Add German sft and dpo datasets by @johannhartmann in #2423 \r\n- Add version checking in `test_toolcall.py` by @mini-tiger in #2435 \r\n- Enable parsing of SlimOrca dataset by @mnmueller in #2462 \r\n- Add tags for models when pushing to hf hub by @younesbelkada in #2474 \r\n- Fix #2189 #2268 #2282 #2320 #2338 #2376 #2388 #2394 #2397 #2404 #2412 #2420 #2421 #2436 #2438 #2471 #2481 \r\n","2024-02-20T07:32:43",{"id":256,"version":257,"summary_zh":258,"released_at":259},163369,"v0.5.0","### Congratulations on 10k stars 🎉 Make LLM fine-tuning easier and faster together with LLaMA-Factory ✨\r\n\r\n### New features\r\n\r\n- Support **agent tuning** for most models, you can fine-tune any LLMs with `--dataset glaive_toolcall` for tool using #2226 \r\n- Support function calling in both **API** and **Web** mode with fine-tuned models, same as the [OpenAI's format](https:\u002F\u002Fplatform.openai.com\u002Fdocs\u002Fapi-reference\u002Fchat\u002Fcreate)\r\n- LLaMA Factory 🤝 [Unsloth](https:\u002F\u002Fgithub.com\u002Funslothai\u002Funsloth), enjoy **170%** LoRA training speed with `--use_unsloth`, see benchmarking [here](https:\u002F\u002Fgithub.com\u002Fhiyouga\u002FLLaMA-Factory\u002Fwiki\u002FPerformance-comparison)\r\n- Supports fine-tuning models on MPS device #2090 \r\n\r\n### New models\r\n\r\n- Base models\r\n  - Phi-2 (2.7B)\r\n  - InternLM2 (7B\u002F20B)\r\n  - SOLAR-10.7B\r\n  - DeepseekMoE-16B-Base\r\n  - XVERSE-65B-2\r\n- Instruct\u002FChat models\r\n  - InternLM2-Chat (7B\u002F20B)\r\n  - SOLAR-10.7B-Instruct\r\n  - DeepseekMoE-16B-Chat\r\n  - Yuan (2B\u002F51B\u002F102B)\r\n\r\n### New datasets\r\n\r\n- Supervised fine-tuning datasets\r\n  - deepctrl dataset\r\n  - Glaive function calling dataset v2\r\n\r\n### Core updates\r\n\r\n- Refactor data engine: clearer dataset alignment, easier templating and tool formatting\r\n- Refactor saving logic for models with value head #1789 \r\n- Use ruff code formatter for stylish code\r\n\r\n### Bug fix\r\n\r\n- Bump transformers version to 4.36.2 by @ShaneTian in #1932 \r\n- Fix requirements by @dasdristanta13 in #2117 \r\n- Add Machine-Mindset project by @JessyTsui in #2163 \r\n- Fix typo in readme file by @junuMoon in #2194 \r\n- Support resize token embeddings with ZeRO3 by @liu-zichen in #2201 \r\n- Fix #1073 #1462 #1617 #1735 #1742 #1789 #1821 #1875 #1895 #1900 #1908 #1907 #1909 #1923 #2014 #2067 #2081 #2090 #2098 #2125 #2127 #2147 #2161 #2164 #2183 #2195 #2249 #2260 \r\n","2024-01-20T18:37:07",{"id":261,"version":262,"summary_zh":263,"released_at":264},163370,"v0.4.0","### 🚨🚨 Core refactor\r\n\r\n- Deprecate `checkpoint_dir` and use `adapter_name_or_path` instead\r\n- Replace `resume_lora_training` with `create_new_adapter`\r\n- Move the patches in model loading to `llmtuner.model.patcher`\r\n- Bump to Transformers 4.36.1 to adapt to the Mixtral models\r\n- Wide adaptation for FlashAttention2 (LLaMA, Falcon, Mistral)\r\n- Temporarily disable LongLoRA due to breaking changes, which will be supported later\r\n\r\nThe above changes were made by @hiyouga in #1864 \r\n\r\n### New features\r\n\r\n- Add **DPO-ftx**: mixing fine-tuning gradients to DPO via the `dpo_ftx` argument, suggested by @lylcst in https:\u002F\u002Fgithub.com\u002Fhiyouga\u002FLLaMA-Factory\u002Fissues\u002F1347#issuecomment-1846943606 \r\n- Integrate **AutoGPTQ** into the model export via the `export_quantization_bit` and `export_quantization_dataset` arguments\r\n- Support loading datasets from ModelScope Hub by @tastelikefeet and @wangxingjun778 in #1802 \r\n- Support resizing token embeddings with the noisy mean initialization by @hiyouga in a66186b8724ffd0351a32593ab52d8a2312f339b \r\n- Support system column in both alpaca and sharegpt dataset formats\r\n\r\n### New models\r\n\r\n- Base models\r\n  - Mixtral-8x7B-v0.1\r\n- Instruct\u002FChat models\r\n  - Mixtral-8x7B-v0.1-instruct\r\n  - Mistral-7B-Instruct-v0.2\r\n  - XVERSE-65B-Chat\r\n  - Yi-6B-Chat\r\n\r\n### Bug fix\r\n\r\n- Improve logging for unknown arguments by @yhyu13 in #1868 \r\n- Fix an overflow issue in LLaMA2 PPO training #1742 \r\n- Fix #246 #1561 #1715 #1764 #1765 #1770 #1771 #1784 #1786 #1795 #1815 #1819 #1831 \r\n","2023-12-16T13:48:38",{"id":266,"version":267,"summary_zh":268,"released_at":269},163371,"v0.3.3","### New features\r\n\r\n- Support loading pre-trained models from ModelScope Hub by @tastelikefeet in #1700 \r\n- Support launching a reward model server in demo API via specifying `--stage=rm` in `api_demo.py`\r\n- Support using a reward model server in PPO training via specifying `--reward_model_type api`\r\n- Support adjusting the shard size of exported models via the `export_size` argument\r\n\r\n### New models\r\n\r\n- Base models\r\n  - DeepseekLLM-Base (7B\u002F67B)\r\n  - Qwen (1.8B\u002F72B)\r\n- Instruct\u002FChat models\r\n  - DeepseekLLM-Chat (7B\u002F67B)\r\n  - Qwen-Chat (1.8B\u002F72B)\r\n  - Yi-34B-Chat\r\n\r\n### New datasets\r\n\r\n- Supervised fine-tuning datasets\r\n  - Nectar dataset by @mlinmg in #1689 \r\n- Preference datasets\r\n  - Nectar dataset by @mlinmg in #1689 \r\n\r\n### Bug fix\r\n\r\n- Improve get_current_device by @billvsme in #1690 \r\n- Improve web UI preview by @Samge0 in #1695 \r\n- Fix #1543 #1597 #1657 #1658 #1659 #1668 #1682 #1696 #1699 #1703 #1707 #1710 \r\n","2023-12-03T14:17:05"]