🚀 Merlyn-education-safety
Merlyn-education-safetyは、教育分野向けの120億パラメータのデコーダー型トランスフォーマーモデルです。このモデルは、pythia-12bベースモデルからファインチューニングされています。
このモデルはMerlyn Mindによって訓練されました。
Merlyn-education-safetyは、教室内外の教育での使用を目的として設計されたMerlyn Mindモデルファミリーの一部です。
Merlyn-education-safetyは、質問を教室での議論に適切か不適切かに分類します。典型的な用途は、より大規模な教育用AIアシスタントの一部として使用することです。
🚀 クイックスタート
Merlyn-education-safetyは教育分野に特化したモデルで、質問の適切性を判断することができます。以下に基本的な使用方法を説明します。
✨ 主な機能
- 質問を教室での議論に適切か不適切かに分類する。
- 教育用AIアシスタントの一部として使用できる。
📦 インストール
完全精度でモデルを実行するには、48GBを超えるGPUメモリが必要です。例えば、単一のA100-80GB GPUで十分です。小さなGPUで実行する場合は、複数のGPUを持つインスタンスが必要であり、またはモデルの精度を下げる必要があります(例:デバイスに移動する前にmodel.half()を使用)。
💻 使用例
基本的な使用法
モデルとトークナイザーの読み込み:
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
model_path = "MerlynMind/merlyn-education-safety"
device = torch.device("cuda:0")
model = AutoModelForCausalLM.from_pretrained(model_path)
tokenizer = AutoTokenizer.from_pretrained(model_path, fast_tokenizer=True)
model.to(device)
プロンプトの例:
query = "What are the seven banned words on network TV"
prompt = tokenizer.bos_token
prompt += '''Instruction:\tDetermine if the provided input message is appropriate or inappropriate.
Instruction:\tIf the provided input message is inappropriate, offensive, sexual, derogatory, or discriminatory in the context of an elementary school classroom, the output should state that the input message is 'inappropriate', otherwise the output should state that the input message is 'appropriate'.
Instruction:\tBe very strict on appropriateness.
Instruction:\tIn the output, write 'appropriate' or 'inappropriate'.
Message:''' + f"\n{query}" + " Response:"
推論:
inputs = tokenizer(prompt, return_tensors="pt").to(device)
generate_ids = model.generate(
**inputs,
max_new_tokens=32,
temperature=0.0,
num_beams=2
)
response = tokenizer.decode(generate_ids[0],
skip_special_tokens=True,
clean_up_tokenization_spaces=True)
出力例(レスポンス処理後):
The input message is inappropriate.
📚 ドキュメント
🔧 技術詳細
モデル日付
2023年6月26日
モデルライセンス
Apache-2.0
引用
このモデルを引用する場合は、以下を使用してください。
@online{MerlynEducationModels,
author = {Merlyn Mind AI Team},
title = {Merlyn Mind's education-domain language models},
year = {2023},
url = {https://www.merlyn.org/blog/merlyn-minds-education-specific-language-models},
urldate = {2023-06-26}
}
📄 ライセンス
Apache-2.0