Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

微调 DeepSeek-R1 蒸馏模型,在 Chat 加载秩表现出色,但在导出部署到 Ollama 后问答准确率大幅下降 #7238

Open
1 task done
Nehcknarf opened this issue Mar 11, 2025 · 2 comments
Labels
bug Something isn't working pending This problem is yet to be addressed

Comments

@Nehcknarf
Copy link

Nehcknarf commented Mar 11, 2025

Reminder

  • I have read the above rules and searched the existing issues.

System Info

  • llamafactory version: 0.9.2.dev0
  • Platform: Linux-6.8.0-56-generic-x86_64-with-glibc2.35
  • Python version: 3.12.9
  • PyTorch version: 2.6.0+cu124 (GPU)
  • Transformers version: 4.49.0
  • Datasets version: 3.2.0
  • Accelerate version: 1.2.1
  • PEFT version: 0.12.0
  • TRL version: 0.9.6
  • GPU type: NVIDIA GeForce RTX 2080 Ti
  • GPU number: 1
  • GPU memory: 10.57GB
  • Bitsandbytes version: 0.45.3

Reproduction

我使用 alpaca 格式的自定义数据集 SFT 微调 deepseek-ai/DeepSeek-R1-Distill-Llama-8B,模板为 deepseek3,4bit bnb 训练得到 QLora,在 Chat 加载表现出色。但是在合并秩到基模型后(模板确认为 deepseek3,也没有在导入 ollama 的过程中进行量化),问答准确率大幅下降,模型开始自由发挥。想请教一下问题是出在了哪里?

自动生成的 Modelfile 如下:
`# ollama modelfile auto-generated by llamafactory

FROM .

TEMPLATE """<|begin▁of▁sentence|>{{ if .System }}{{ .System }}{{ end }}{{ range .Messages }}{{ if eq .Role "user" }}<|User|>{{ .Content }}<|Assistant|>{{ else if eq .Role "assistant" }}{{ .Content }}<|end▁of▁sentence|>{{ end }}{{ end }}"""

PARAMETER stop "<|end▁of▁sentence|>"
PARAMETER num_ctx 4096
`

Others

No response

@Nehcknarf Nehcknarf added bug Something isn't working pending This problem is yet to be addressed labels Mar 11, 2025
@hiyouga
Copy link
Owner

hiyouga commented Mar 11, 2025

看一下 ollama 是否正常加载了 modelfile

@Nehcknarf
Copy link
Author

Nehcknarf commented Mar 11, 2025

看一下 ollama 是否正常加载了 modelfile

n@Precision-5820-Tower-X-Series:~$ ollama show --modelfile faq_robot:latest
# Modelfile generated by "ollama show"
# To build a new Modelfile based on this, replace FROM with:
# FROM faq_robot:latest

FROM /usr/share/ollama/.ollama/models/blobs/sha256-eeaa06295dfc573322aa5fa303c3dc2103567d28c33a1356816f3a6773167825
TEMPLATE <|begin▁of▁sentence|>{{ if .System }}{{ .System }}{{ end }}{{ range .Messages }}{{ if eq .Role "user" }}<|User|>{{ .Content }}<|Assistant|>{{ else if eq .Role "assistant" }}{{ .Content }}<|end▁of▁sentence|>{{ end }}{{ end }}
PARAMETER stop <|end▁of▁sentence|>
PARAMETER num_ctx 4096

应该是正常加载了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pending This problem is yet to be addressed
Projects
None yet
Development

No branches or pull requests

2 participants