🚀 醫療聊天模型 Meditron-7b-Guanaco
這是一個基於醫療領域的聊天模型,基於 epfl-llm/meditron-7b
基礎模型,使用 open assist dataset 數據集,通過 SFT QLora 方法進行微調。它能為醫療相關問題提供專業、安全且有用的回答。
🚀 快速開始
本模型是 llama3 8b 家族的聊天模型,從基礎模型 epfl-llm/meditron-7b
微調而來,使用了 open assist dataset 數據集和 SFT QLora 方法。所有線性參數的秩設為 16 並可訓練。
✨ 主要特性
- 基於醫療領域的基礎模型微調,能提供專業醫療建議。
- 使用特定的提示模板,確保回答的安全性和有用性。
📦 安裝指南
此部分原文檔未提及具體安裝命令,跳過。
💻 使用示例
基礎用法
model_name='jiviadmin/meditron-7b-guanaco-chat'
base_model = AutoModelForCausalLM.from_pretrained(
model_name,
low_cpu_mem_usage=True,
return_dict=True,
torch_dtype=torch.float16,
device_map={"": 0},
)
tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True,add_eos_token=True)
tokenizer.add_special_tokens({'pad_token': '[PAD]'})
tokenizer.pad_token_id = 18610
tokenizer.padding_side = "right"
default_system_prompt="You are a helpful, respectful and honest medical assistant. Always answer as helpfully as possible, while being safe. Your answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature.
If a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information.Please consider the context below if applicable:
Context:NA"
def format_prompt(question):
return f'''<s> [INST] <<SYS>> {default_system_prompt} <</SYS>> [INST] {question} [/INST]'''
question=' My father has a big white colour patch inside of his right cheek. please suggest a reason.'
pipe = pipeline(task="text-generation", model=base_model, tokenizer=tokenizer, max_length=512,repetition_penalty=1.1,return_full_text=False)
result = pipe(format_prompt(question))
answer=result[0]['generated_text']
print(answer)
📚 詳細文檔
提示模板:Llama
'<s> [INST] <<SYS>>
You are a helpful, respectful and medical honest assistant. Always answer as helpfully as possible, while being safe. Your answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature.
If a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information.
<</SYS>> {question} [/INST] {Model answer } </s>'
📄 許可證
本項目採用 Apache-2.0 許可證。
📋 模型信息
屬性 |
詳情 |
庫名稱 |
transformers |
許可證 |
Apache-2.0 |
數據集 |
skumar9/orpo-mmlu |
標籤 |
醫療 |