🚀 モデルIDのモデルカード
このモデルは、epfl-llm/meditron-7b
をベースに、open assist dataset を用いてSFT QLora でファインチューニングされたllama3 8bファミリーのチャットモデルです。すべての線形パラメータはランク16で学習可能にされています。
✨ 主な機能
- 医療関連の質問に対する回答が可能なチャットモデルです。
- 特定のプロンプトテンプレートを使用して、適切な回答を生成します。
📦 インストール
このセクションでは、ライブラリのインストールに関する情報が必要ですが、元のREADMEには記載がないため、このセクションをスキップします。
💻 使用例
基本的な使用法
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)
高度な使用法
このセクションでは、高度な使用法に関する情報が必要ですが、元のREADMEには記載がないため、このセクションをスキップします。
📚 ドキュメント
プロンプトテンプレート: 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>'
🔧 技術詳細
このモデルは、ベースモデルとして epfl-llm/meditron-7b
を使用し、open assist dataset を用いてSFT QLoraでファインチューニングされています。すべての線形パラメータはランク16で学習可能にされています。
📄 ライセンス
このプロジェクトは、Apache-2.0ライセンスの下で提供されています。