Downloads · 30 days
0
maweize027/boat-design-7b-lora
boat-design-7b-lora is a machine learning model from maweize027. 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 apache-2.0.
基于 Qwen2-7B-Instruct 微调的船舶设计专家模型,专注于船舶设计、螺旋桨设计、CFD 等专业领域。
Downloads · 30 days
0
Access
Public
Updated Jan 1, 2026
Repo size
173 MB
Likes
0
Public
Click a slice to open those files.
.safetensors162 MB · 91%
From the Hugging Face model README
基于 Qwen2-7B-Instruct 微调的船舶设计专家模型,专注于船舶设计、螺旋桨设计、CFD 等专业领域。
| 项目 | 详情 |
|---|---|
| 基础模型 | Qwen/Qwen2-7B-Instruct (7B 参数) |
| 训练方法 | LoRA (Low-Rank Adaptation) |
| LoRA 参数 | r=64, alpha=16, dropout=0.1 |
| 训练数据 | 973 条船舶设计专业知识 |
| 领域 | 船舶设计、螺旋桨设计、CFD、船体设计 |
| 语言 | 中文 + 英文 |
| 模型大小 | 155 MB (LoRA 权重) |
pip install transformers peft torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
import torch
# 加载基础模型
base_model_name = "Qwen/Qwen2-7B-Instruct"
model = AutoModelForCausalLM.from_pretrained(
base_model_name,
torch_dtype=torch.float16,
device_map="auto"
)
# 加载 LoRA 权重
model = PeftModel.from_pretrained(
model,
"YOUR_USERNAME/boat-design-7b-lora" # 替换成实际用户名
)
# 加载分词器
tokenizer = AutoTokenizer.from_pretrained(base_model_name)
# 推理
question = "螺旋桨直径如何影响推进效率?"
messages = [{"role": "user", "content": question}]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
inputs = tokenizer([text], return_tensors="pt").to(model.device)
# 生成回答
outputs = model.generate(
**inputs,
max_new_tokens=512,
temperature=0.7,
top_p=0.9
)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(response)
questions = [
"如何选择合适的螺旋桨直径?",
"什么是滑失率?它如何影响推进性能?",
"SPP 系列螺旋桨的主要特点是什么?",
"如何使用 CFD 分析船体阻力?",
"高速船的船型设计有哪些特点?"
]
for q in questions:
# ... (使用上面的推理代码)
print(f"Q: {q}")
print(f"A: {response}\n")
LoraConfig(
task_type="CAUSAL_LM",
r=64,
lora_alpha=16,
lora_dropout=0.1,
target_modules=["q_proj", "k_proj", "v_proj", "o_proj"],
bias="none"
)
Apache License 2.0
如有问题或建议,欢迎提 Issue!
训练日期: 2026-01-01 模型版本: v1.0