Downloads · 30 days
0
liyimichael/phi3-lora-finetuned
phi3-lora-finetuned is a machine learning model from liyimichael. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
✅ 项目名称:LoRA 微调的 Phi-3 中文指令对话模型 🧠 项目地址(模型仓库) 👉 https://huggingface.co/liyimichael/phi3-lora-finetuned
Downloads · 30 days
0
Access
Public
Updated Jun 26, 2025
Repo size
6.6 MB
Likes
0
Public
Click a slice to open those files.
.safetensors6.1 MB · 60%
From the Hugging Face model README
✅ 项目名称:LoRA 微调的 Phi-3 中文指令对话模型 🧠 项目地址(模型仓库) 👉 https://huggingface.co/liyimichael/phi3-lora-finetuned
🌐 在线体验 Demo 👉 https://huggingface.co/spaces/liyimichael/phi3-lora-chat
📌 项目简介 本项目基于微软开源的轻量级大语言模型 Phi-3 Mini (4K),通过 LoRA(Low-Rank Adaptation)方法完成中文指令微调,并部署为 Hugging Face Spaces 在线聊天机器人,供用户即时体验。
本项目适用于资源受限场景,使用 Kaggle 免费 GPU 环境即可训练与部署,适合个人或初创团队快速试验 LLM 微调效果。
⚙️ 技术栈 分类 工具 模型框架 🤗 Transformers 微调方法 LoRA + QLoRA + PEFT 训练平台 Kaggle Notebook (T4 / 15GB RAM) 部署方式 Hugging Face Spaces + Gradio 基础模型 microsoft/phi-3-mini-4k-instruct 数据格式 自定义中文指令-回答对(prompt + response)
🏗️ 项目结构 bash 复制 编辑 phi3-lora-finetuned/ ├── adapter_model.safetensors # 微调后的权重 ├── adapter_config.json # LoRA 配置文件 ├── tokenizer.json / tokenizer.model / tokenizer_config.json ├── README.md # 当前文件 📊 微调效果(训练日志) Step Train Loss 0 7.14 50 1.73 100 0.96 150 0.84 200 0.80 250 0.99
最终平均训练损失:1.54
方法一:在 Spaces 页面直接体验 点击 👉 在线 Demo,输入中文指令,即可获得模型回复。
方法二:用代码加载本项目模型 python 复制 编辑 from transformers import AutoTokenizer, AutoModelForCausalLM from peft import PeftModel
base_model = "microsoft/phi-3-mini-4k-instruct" lora_model = "liyimichael/phi3-lora-finetuned"
tokenizer = AutoTokenizer.from_pretrained(lora_model, trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained(base_model, trust_remote_code=True) model = PeftModel.from_pretrained(model, lora_model)
📌 项目亮点 ✅ 支持中文指令微调,部署后可直接体验对话
✅ 使用 LoRA+QLoRA 极大降低训练资源消耗
✅ 无需独显,只需免费 Kaggle 平台即可完成全部流程
✅ 模型和界面部署完全开源,支持二次开发与定制
🙋♂️ 作者介绍 本项目由 @liyimichael 完成,适用于简历作品集、NLP 求职展示、教学演示等场景。