Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
base_model: unsloth/DeepSeek-R1-Distill-Llama-8B
|
| 4 |
+
tags:
|
| 5 |
+
- text-generation
|
| 6 |
+
- frontend
|
| 7 |
+
- analysis
|
| 8 |
+
- requirements
|
| 9 |
+
- chinese
|
| 10 |
+
- lora
|
| 11 |
+
- peft
|
| 12 |
+
- sft
|
| 13 |
+
- trl
|
| 14 |
+
- unsloth
|
| 15 |
+
- conversational
|
| 16 |
+
pipeline_tag: text-generation
|
| 17 |
+
---
|
| 18 |
+
|
| 19 |
+
# analysis-llm-v2
|
| 20 |
+
|
| 21 |
+
这是一个基于 DeepSeek-R1-Distill-Llama-8B 微调的前端需求分析模型。
|
| 22 |
+
|
| 23 |
+
## 模型描述
|
| 24 |
+
|
| 25 |
+
该模型专门用于生成前端技术分析文档,能够:
|
| 26 |
+
- 分析前端项目需求
|
| 27 |
+
- 生成详细的技术方案
|
| 28 |
+
- 提供页面路径规划
|
| 29 |
+
- 输出标准的前端项目结构
|
| 30 |
+
|
| 31 |
+
## 使用方法
|
| 32 |
+
|
| 33 |
+
### 使用HuggingFace格式
|
| 34 |
+
|
| 35 |
+
```python
|
| 36 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 37 |
+
import torch
|
| 38 |
+
|
| 39 |
+
# 加载模型
|
| 40 |
+
model_name = "MANSTAGE/analysis-llm-v2"
|
| 41 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 42 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 43 |
+
model_name,
|
| 44 |
+
torch_dtype=torch.float16,
|
| 45 |
+
device_map="auto"
|
| 46 |
+
)
|
| 47 |
+
|
| 48 |
+
# 推理
|
| 49 |
+
question = "请帮我生成一个企业管理系统"
|
| 50 |
+
inputs = tokenizer(question, return_tensors="pt").to(model.device)
|
| 51 |
+
outputs = model.generate(
|
| 52 |
+
**inputs,
|
| 53 |
+
max_new_tokens=1000,
|
| 54 |
+
temperature=0.7,
|
| 55 |
+
do_sample=True
|
| 56 |
+
)
|
| 57 |
+
|
| 58 |
+
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 59 |
+
print(response)
|
| 60 |
+
```
|
| 61 |
+
|
| 62 |
+
### 使用GGUF格式
|
| 63 |
+
|
| 64 |
+
本仓库包含多种GGUF量化格式:
|
| 65 |
+
|
| 66 |
+
- `model_q4_0/` - 4位量化(最小文件大小)
|
| 67 |
+
- `model_q4_k_m/` - 4位量化(平衡版本)
|
| 68 |
+
- `model_q8_0/` - 8位量化(高质量)
|
| 69 |
+
- `model_f16/` - 16位浮点(最高质量)
|
| 70 |
+
|
| 71 |
+
使用llama.cpp加载GGUF文件:
|
| 72 |
+
|
| 73 |
+
```bash
|
| 74 |
+
# 下载GGUF文件
|
| 75 |
+
wget https://huggingface.co/MANSTAGE/analysis-llm-v2/resolve/main/model_q4_0/unsloth.Q4_0.gguf
|
| 76 |
+
|
| 77 |
+
# 使用llama.cpp运行
|
| 78 |
+
./main -m unsloth.Q4_0.gguf -p "请帮我生成一个企业管理系统"
|
| 79 |
+
```
|
| 80 |
+
|
| 81 |
+
## 训练详情
|
| 82 |
+
|
| 83 |
+
- **基础模型**: unsloth/DeepSeek-R1-Distill-Llama-8B
|
| 84 |
+
- **训练数据**: 219条前端需求分析数据
|
| 85 |
+
- **训练步数**: 100步
|
| 86 |
+
- **学习率**: 2e-4
|
| 87 |
+
- **LoRA配置**: r=16, alpha=16, dropout=0.1
|
| 88 |
+
- **量化**: 4-bit量化训练
|
| 89 |
+
|
| 90 |
+
## 文件说明
|
| 91 |
+
|
| 92 |
+
- `final_model/` - HuggingFace格式的完整模型
|
| 93 |
+
- `model_q4_0/` - 4位量化GGUF文件
|
| 94 |
+
- `model_q4_k_m/` - 4位量化GGUF文件(平衡版)
|
| 95 |
+
- `model_q8_0/` - 8位量化GGUF文件
|
| 96 |
+
- `model_f16/` - 16位浮点GGUF文件
|
| 97 |
+
|
| 98 |
+
## 许可证
|
| 99 |
+
|
| 100 |
+
Apache 2.0
|