模型名称: medical-llama3-finetuned-q8_0

模型描述

这是一个基于 unsloth/DeepSeek-R1-Distill-Llama-8B 模型的中文医学领域问答模型。该模型使用 LoRA (Low-Rank Adaptation) 方法在 FreedomIntelligence/medical-o1-reasoning-SFT 数据集的中文部分进行了微调。

注意: 由于计算资源限制,此模型尚未在标准的中文医学 QA 基准测试上进行全面评估。模型性能可能因具体问题和领域而异。

用途

该模型旨在回答中文医学领域的问题。它可以用于辅助临床决策、医学教育、患者咨询等场景。

重要提示: 本模型仅供研究和参考,不能替代专业医疗建议。在做出任何医疗决策之前,请务必咨询医生或其他合格的医疗专业人员。

训练数据

  • 数据集: FreedomIntelligence/medical-o1-reasoning-SFT (中文部分)
  • 数据集描述: 该数据集包含医学领域的复杂推理问题和答案。
  • 数据样例:
    {'Question': Value(dtype='string', id=None), 'Complex_CoT': Value(dtype='string', id=None), 'Response': Value(dtype='string', id=None)}
    
  • 数据预处理:
    • 使用了以下提示模板:

      ### Instruction:
      {Question}
      
      ### Response:
      {Response}
      

    (或者, 如果你使用了Complex_CoT字段, 那么应该是:)

       ### Instruction:
       {Question}
    
       ### Context:
       {Complex_CoT}
    
       ### Response:
       {Response}
    

训练过程

  • 基础模型: unsloth/DeepSeek-R1-Distill-Llama-8B
  • 微调方法: LoRA (Low-Rank Adaptation)
  • LoRA 参数:
    • r: 16
    • target_modules: ["q_proj", "k_proj", "v_proj", "o_proj", "gate_proj", "up_proj", "down_proj"]
    • lora_alpha: 16
    • lora_dropout: 0
  • 训练参数:
    • per_device_train_batch_size: 2
    • gradient_accumulation_steps: 4
    • learning_rate: 2e-4
    • max_steps: (根据你的训练过程填写)
    • ... (其他参数)
  • 训练硬件: NVIDIA A100 GPU
  • 训练时长: (填写实际训练时长)

评估结果

  • 由于计算资源限制, 本模型尚未在标准中文医学QA基准测试上进行全面评估.

使用方法

使用 transformers 库:

from transformers import AutoModelForCausalLM, AutoTokenizer

model_id = "ZhangQiao123/medical-llama3-finetuned-q8_0"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, trust_remote_code=True)
model = model.to("cuda") # 如果你有GPU
model.eval()

prompt = """### Instruction:
血热的临床表现是什么?

### Response:
"""

inputs = tokenizer(prompt, return_tensors="pt").to("cuda") # 如果你有GPU, 将inputs也放到GPU
outputs = model.generate(**inputs, max_new_tokens=1200, use_cache=True) # 你可以调整max_new_tokens
response = tokenizer.decode(outputs[0], skip_special_tokens=True)

print(response)

ollama pull ZhangQiao123/medical-llama3-finetuned-q8_0:q8_0
ollama run ZhangQiao123/medical-llama3-finetuned-q8_0:q8_0

## 局限性和偏见

*   **数据局限性:**  本模型仅在 `FreedomIntelligence/medical-o1-reasoning-SFT` 数据集的中文部分进行了微调,该数据集主要包含 xxx 类型的问题(例如,诊断、治疗建议等)。对于其他类型的医学问题,例如外科手术操作、康复治疗、医学伦理等,模型的性能可能 significantly 下降。
*   **知识局限性:**  本模型主要基于文本数据进行训练,缺乏临床实践经验。对于需要结合患者具体情况、病史、检查结果等多方面因素进行综合判断的复杂病例,模型的建议可能不全面,甚至可能出错。
*   **生成不确定性:** 由于模型的生成特性,对于同一问题,模型可能会生成略有不同的答案。
* **无法处理非文本信息:** 本模型仅接受文本输入, 无法处理医学影像或其他非文本信息.
*   **重要提示:** 本模型仅供研究和参考,不能替代专业医疗建议。在做出任何医疗决策之前,请务必咨询医生或其他合格的医疗专业人员。本模型生成的任何信息均不应被视为诊断、治疗或预防任何疾病的建议。

## 引用 (Citation)

```bibtex
@misc{Unsloth,
  author = {Unsloth, Inc},
  title = {Unsloth: Fast Llama and Mistral finetuning},
  year = {2023},
  publisher = {GitHub},
  journal = {GitHub repository},
  howpublished = {\url{https://github.com/unslothai/unsloth}},
}

@misc{FreedomIntelligence_medical-o1-reasoning-SFT,
  title = {Medical O1 Reasoning SFT dataset},
  author = {FreedomIntelligence},
  year = {2024},
  publisher = {Hugging Face},
  journal = {Hugging Face dataset repository},
  howpublished = {\url{https://huggingface.co/datasets/FreedomIntelligence/medical-o1-reasoning-SFT}},
}

@misc{deepseek-ai_deepseek-llm,
  title = {DeepSeek-LLM},
  author = {DeepSeek-AI},
  year = {2024},
  publisher = {Hugging Face},
  journal = {Hugging Face model repository},
  howpublished = {\url{https://huggingface.co/unsloth/DeepSeek-R1-Distill-Llama-8B}},
}

@article{hu2021lora,
  title={LoRA: Low-Rank Adaptation of Large Language Models},
  author={Hu, Edward J and Shen, Yelong and Wallis, Phillip and Allen-Zhu, Zeyuan and Li, Yuanzhi and Wang, Shean and Wang, Lu and Chen, Weizhu},
  journal={arXiv preprint arXiv:2106.09685},
  year={2021}
}
Downloads last month
5
GGUF
Model size
8.03B params
Architecture
llama
Hardware compatibility
Log In to view the estimation

8-bit

Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support