maweize027 commited on
Commit
95040b4
·
verified ·
1 Parent(s): ec03182

Upload folder using huggingface_hub

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,162 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - zh
4
+ - en
5
+ license: apache-2.0
6
+ tags:
7
+ - lora
8
+ - qwen2
9
+ - boat-design
10
+ - maritime
11
+ - propeller-design
12
+ - ship-design
13
+ base_model: Qwen/Qwen2-7B-Instruct
14
+ ---
15
+
16
+ # 🚢 Boat Design Expert - Qwen2-7B LoRA
17
+
18
+ 基于 Qwen2-7B-Instruct 微调的**船舶设计专家模型**,专注于船舶设计、螺旋桨设计、CFD 等专业领域。
19
+
20
+ ## 📊 模型信息
21
+
22
+ | 项目 | 详情 |
23
+ |------|------|
24
+ | **基础模型** | Qwen/Qwen2-7B-Instruct (7B 参数) |
25
+ | **训练方法** | LoRA (Low-Rank Adaptation) |
26
+ | **LoRA 参数** | r=64, alpha=16, dropout=0.1 |
27
+ | **训练数据** | 973 条船舶设计专业知识 |
28
+ | **领域** | 船舶设计、螺旋桨设计、CFD、船体设计 |
29
+ | **语言** | 中文 + 英文 |
30
+ | **模型大小** | 155 MB (LoRA 权重) |
31
+
32
+ ## 🎯 专业领域
33
+
34
+ - ✅ 螺旋桨设计 (Propeller Design)
35
+ - ✅ 船体设计 (Hull Design)
36
+ - ✅ CFD 分析 (Computational Fluid Dynamics)
37
+ - ✅ 船舶阻力估算 (Resistance Estimation)
38
+ - ✅ 推进效率优化 (Propulsion Efficiency)
39
+ - ✅ SPP 系列螺旋桨知识
40
+
41
+ ## 🚀 使用方法
42
+
43
+ ### 安装依赖
44
+
45
+ ```bash
46
+ pip install transformers peft torch
47
+ ```
48
+
49
+ ### 加载模型
50
+
51
+ ```python
52
+ from transformers import AutoModelForCausalLM, AutoTokenizer
53
+ from peft import PeftModel
54
+ import torch
55
+
56
+ # 加载基础模型
57
+ base_model_name = "Qwen/Qwen2-7B-Instruct"
58
+ model = AutoModelForCausalLM.from_pretrained(
59
+ base_model_name,
60
+ torch_dtype=torch.float16,
61
+ device_map="auto"
62
+ )
63
+
64
+ # 加载 LoRA 权重
65
+ model = PeftModel.from_pretrained(
66
+ model,
67
+ "YOUR_USERNAME/boat-design-7b-lora" # 替换成实际用户名
68
+ )
69
+
70
+ # 加载分词器
71
+ tokenizer = AutoTokenizer.from_pretrained(base_model_name)
72
+
73
+ # 推理
74
+ question = "螺旋桨直径如何影响推进效率?"
75
+ messages = [{"role": "user", "content": question}]
76
+ text = tokenizer.apply_chat_template(
77
+ messages,
78
+ tokenize=False,
79
+ add_generation_prompt=True
80
+ )
81
+ inputs = tokenizer([text], return_tensors="pt").to(model.device)
82
+
83
+ # 生成回答
84
+ outputs = model.generate(
85
+ **inputs,
86
+ max_new_tokens=512,
87
+ temperature=0.7,
88
+ top_p=0.9
89
+ )
90
+
91
+ response = tokenizer.decode(outputs[0], skip_special_tokens=True)
92
+ print(response)
93
+ ```
94
+
95
+ ## 📚 训练详情
96
+
97
+ - **训练集**: 778 条专业知识
98
+ - **验证集**: 97 条
99
+ - **测试集**: 98 条
100
+ - **训练轮数**: 3 epochs
101
+ - **Batch Size**: 1 (effective: 16 with gradient accumulation)
102
+ - **学习率**: 2e-4
103
+ - **训练时间**: 1.5 小时 (RTX 4090D 24GB)
104
+ - **训练成本**: ~¥3.76
105
+
106
+ ## 💡 示例问题
107
+
108
+ ```python
109
+ questions = [
110
+ "如何选择合适的螺旋桨直径?",
111
+ "什么是滑失率?它如何影响推进性能?",
112
+ "SPP 系列螺旋桨的主要特点是什么?",
113
+ "如何使用 CFD 分析船体阻力?",
114
+ "高速船的船型设计有哪些特点?"
115
+ ]
116
+
117
+ for q in questions:
118
+ # ... (使用上面的推理代码)
119
+ print(f"Q: {q}")
120
+ print(f"A: {response}\n")
121
+ ```
122
+
123
+ ## ⚙️ 技术细节
124
+
125
+ ### LoRA 配置
126
+
127
+ ```python
128
+ LoraConfig(
129
+ task_type="CAUSAL_LM",
130
+ r=64,
131
+ lora_alpha=16,
132
+ lora_dropout=0.1,
133
+ target_modules=["q_proj", "k_proj", "v_proj", "o_proj"],
134
+ bias="none"
135
+ )
136
+ ```
137
+
138
+ ### 训练参数
139
+
140
+ - 4-bit 量化加载
141
+ - Gradient checkpointing
142
+ - BF16 混合精度训练
143
+ - paged_adamw_8bit 优化器
144
+
145
+ ## 📄 许可证
146
+
147
+ Apache License 2.0
148
+
149
+ ## 🙏 致谢
150
+
151
+ - 基础模型: [Qwen/Qwen2-7B-Instruct](https://huggingface.co/Qwen/Qwen2-7B-Instruct)
152
+ - 训练框架: Hugging Face Transformers + PEFT
153
+ - 训练平台: AutoDL (RTX 4090D)
154
+
155
+ ## 📞 联系
156
+
157
+ 如有问题或建议,欢迎提 Issue!
158
+
159
+ ---
160
+
161
+ **训练日期**: 2026-01-01
162
+ **模型版本**: v1.0
adapter_config.json ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alora_invocation_tokens": null,
3
+ "alpha_pattern": {},
4
+ "arrow_config": null,
5
+ "auto_mapping": null,
6
+ "base_model_name_or_path": "/root/.cache/huggingface/hub/models--Qwen--Qwen2-7B-Instruct/snapshots/f2826a00ceef68f0f2b946d945ecc0477ce4450c",
7
+ "bias": "none",
8
+ "corda_config": null,
9
+ "ensure_weight_tying": false,
10
+ "eva_config": null,
11
+ "exclude_modules": null,
12
+ "fan_in_fan_out": false,
13
+ "inference_mode": true,
14
+ "init_lora_weights": true,
15
+ "layer_replication": null,
16
+ "layers_pattern": null,
17
+ "layers_to_transform": null,
18
+ "loftq_config": {},
19
+ "lora_alpha": 16,
20
+ "lora_bias": false,
21
+ "lora_dropout": 0.1,
22
+ "megatron_config": null,
23
+ "megatron_core": "megatron.core",
24
+ "modules_to_save": null,
25
+ "peft_type": "LORA",
26
+ "peft_version": "0.18.0",
27
+ "qalora_group_size": 16,
28
+ "r": 64,
29
+ "rank_pattern": {},
30
+ "revision": null,
31
+ "target_modules": [
32
+ "v_proj",
33
+ "q_proj",
34
+ "o_proj",
35
+ "k_proj"
36
+ ],
37
+ "target_parameters": null,
38
+ "task_type": "CAUSAL_LM",
39
+ "trainable_token_indices": null,
40
+ "use_dora": false,
41
+ "use_qalora": false,
42
+ "use_rslora": false
43
+ }
adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:11a2d82734301039a180baaaa7887d12f74d25f619abea841e531a2744aa1d3d
3
+ size 161510984
added_tokens.json ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ {
2
+ "<|endoftext|>": 151643,
3
+ "<|im_end|>": 151645,
4
+ "<|im_start|>": 151644
5
+ }
merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
special_tokens_map.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ "<|im_start|>",
4
+ "<|im_end|>"
5
+ ],
6
+ "eos_token": {
7
+ "content": "<|im_end|>",
8
+ "lstrip": false,
9
+ "normalized": false,
10
+ "rstrip": false,
11
+ "single_word": false
12
+ },
13
+ "pad_token": "<|im_end|>"
14
+ }
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3fd656675cb6365182a74fed9b51e131ec5de26a56a2ebe7aa4606f2ad975bbf
3
+ size 11418365
tokenizer_config.json ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "added_tokens_decoder": {
4
+ "151643": {
5
+ "content": "<|endoftext|>",
6
+ "lstrip": false,
7
+ "normalized": false,
8
+ "rstrip": false,
9
+ "single_word": false,
10
+ "special": true
11
+ },
12
+ "151644": {
13
+ "content": "<|im_start|>",
14
+ "lstrip": false,
15
+ "normalized": false,
16
+ "rstrip": false,
17
+ "single_word": false,
18
+ "special": true
19
+ },
20
+ "151645": {
21
+ "content": "<|im_end|>",
22
+ "lstrip": false,
23
+ "normalized": false,
24
+ "rstrip": false,
25
+ "single_word": false,
26
+ "special": true
27
+ }
28
+ },
29
+ "additional_special_tokens": [
30
+ "<|im_start|>",
31
+ "<|im_end|>"
32
+ ],
33
+ "bos_token": null,
34
+ "clean_up_tokenization_spaces": false,
35
+ "eos_token": "<|im_end|>",
36
+ "errors": "replace",
37
+ "extra_special_tokens": {},
38
+ "model_max_length": 131072,
39
+ "pad_token": "<|im_end|>",
40
+ "split_special_tokens": false,
41
+ "tokenizer_class": "Qwen2Tokenizer",
42
+ "unk_token": null
43
+ }
vocab.json ADDED
The diff for this file is too large to render. See raw diff