lxcxjxhx commited on
Commit
129577e
·
verified ·
1 Parent(s): 28d30c3

Upload SKILL.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. SKILL.md +101 -0
SKILL.md ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # HOS Model Optimizer Skill
2
+
3
+ ## Description
4
+ HOS Model Optimizer 是一个面向小模型(0.5B-7B 参数)的完整优化工具链,针对 8GB VRAM 场景进行了深度优化。提供从模型量化、推理加速、微调到一键部署的全流程解决方案。
5
+
6
+ ## When to Use
7
+ 当用户需要以下操作时自动触发此技能:
8
+ - 量化大语言模型(GGUF/AWQ/GPTQ)
9
+ - 使用推理后端(llama-cpp/vLLM/SGLang)进行推理
10
+ - 微调训练模型(QLoRA/LoRA)
11
+ - 部署模型为 API 服务
12
+ - 配置和优化模型性能
13
+
14
+ ## Capabilities
15
+ - **量化**: 支持 GGUF、AWQ、GPTQ 三种量化方案
16
+ - **推理**: 三后端统一接口,自动选择最优后端
17
+ - **训练**: QLoRA/LoRA 微调,8GB VRAM 即可训练 7B 模型
18
+ - **部署**: 硬件检测、自动配置、一键启动 API 服务
19
+ - **评测**: 支持 BLEU、ROUGE、PPL 等多种评测指标
20
+
21
+ ## Commands
22
+
23
+ ### 量化模型
24
+ ```bash
25
+ hos-quantize --method gguf --model ./model --output ./model.gguf
26
+ hos-quantize --method awq --bits 4 --model ./model --output ./model-awq
27
+ ```
28
+
29
+ ### 推理服务
30
+ ```bash
31
+ # 单次推理
32
+ hos-infer --model ./model --prompt "你好"
33
+
34
+ # 启动 API 服务
35
+ hos-infer --model ./model --serve --port 8000
36
+
37
+ # 交互模式
38
+ hos-infer --model ./model --chat
39
+ ```
40
+
41
+ ### 训练模型
42
+ ```bash
43
+ # QLoRA 微调
44
+ hos-train --model ./model --dataset ./data.json --method qlora
45
+
46
+ # LoRA 微调并自动合并
47
+ hos-train --model ./model --dataset ./data.json --method lora --merge
48
+ ```
49
+
50
+ ### 部署服务
51
+ ```bash
52
+ hos-deploy --model ./model.gguf --model-size 7.0
53
+ ```
54
+
55
+ ### 配置管理
56
+ ```bash
57
+ # 生成最优配置
58
+ hos-config --generate --scenario inference_7b --model-path ./model
59
+
60
+ # 列出所有模板
61
+ hos-config --list-templates
62
+ ```
63
+
64
+ ### 模型评测
65
+ ```bash
66
+ hos-evaluate --model ./model --dataset ./test.json --metrics bleu rouge
67
+ ```
68
+
69
+ ## Installation
70
+ ```bash
71
+ cd HOS-Model-Optimizer
72
+ pip install -e .
73
+ ```
74
+
75
+ ## Python API
76
+ ```python
77
+ from hos_optimizer import (
78
+ ConfigManager,
79
+ UnifiedInferenceEngine,
80
+ TrainingConfig,
81
+ HardwareDetector,
82
+ )
83
+
84
+ # 推理
85
+ engine = UnifiedInferenceEngine(model_path="./model")
86
+ result = engine.generate("你好")
87
+
88
+ # 训练
89
+ config = TrainingConfig(
90
+ model_name_or_path="./model",
91
+ dataset_path="./data.json",
92
+ finetuning_type="qlora",
93
+ )
94
+ from hos_optimizer.train import train
95
+ train(config)
96
+ ```
97
+
98
+ ## Notes
99
+ - 所有命令都针对 8GB VRAM 场景进行了优化
100
+ - 支持 CPU 和 GPU 混合推理
101
+ - 自动检测硬件并选择最优配置