🚀 aryashah00/survey-finetuned-TinyLlama-1.1B-Chat-v1.0
このモデルは、複数のドメインにわたる合成アンケート回答の生成に最適化された、TinyLlama/TinyLlama-1.1B-Chat-v1.0 のファインチューニング版です。独自のアンケート回答データセットを使用して命令調整されており、各回答は特定の人物像を反映しています。
🚀 クイックスタート
このモデルは、異なる人物像からの合成アンケート回答を生成するために特別に設計されています。以下の情報を提供すると最適に動作します。
- 詳細な人物像の説明
- 特定のアンケートの質問
✨ 主な機能
- 複数ドメインの合成アンケート回答生成に最適化
- 独自データセットを用いた命令調整により、特定の人物像を反映した回答を生成
📦 インストール
このモデルを使用するには、transformers
ライブラリが必要です。以下のコマンドでインストールできます。
pip install transformers
💻 使用例
基本的な使用法
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained("aryashah00/survey-finetuned-TinyLlama-1.1B-Chat-v1.0", device_map="auto", trust_remote_code=True)
tokenizer = AutoTokenizer.from_pretrained("aryashah00/survey-finetuned-TinyLlama-1.1B-Chat-v1.0", trust_remote_code=True)
persona = "A nurse who educates the child about modern medical treatments and encourages a balanced approach to healthcare"
question = "How often was your pain well controlled during this hospital stay?"
system_prompt = f"You are embodying the following persona: {persona}"
user_prompt = f"Survey Question: {question}\n\nPlease provide your honest and detailed response to this question."
messages = [
{"role": "system", "content": system_prompt},
{"role": "user", "content": user_prompt}
]
input_text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
input_ids = tokenizer(input_text, return_tensors="pt").input_ids.to(model.device)
import torch
with torch.no_grad():
output_ids = model.generate(
input_ids=input_ids,
max_new_tokens=256,
temperature=0.7,
top_p=0.9,
do_sample=True
)
output = tokenizer.decode(output_ids[0], skip_special_tokens=True)
response_start = output.find(input_text) + len(input_text)
generated_response = output[response_start:].strip()
print(f"Generated response: {generated_response}")
高度な使用法
import requests
API_URL = "https://api-inference.huggingface.co/models/aryashah00/survey-finetuned-TinyLlama-1.1B-Chat-v1.0"
headers = {"Authorization": "Bearer YOUR_API_KEY"}
def query(payload):
response = requests.post(API_URL, headers=headers, json=payload)
return response.json()
messages = [
{"role": "system", "content": "You are embodying the following persona: A nurse who educates the child about modern medical treatments and encourages a balanced approach to healthcare"},
{"role": "user", "content": "Survey Question: How often was your pain well controlled during this hospital stay?\n\nPlease provide your honest and detailed response to this question."}
]
output = query({"inputs": messages})
print(output)
📚 ドキュメント
モデルの詳細
Property |
Details |
モデルタイプ |
ファインチューニングされた言語モデル |
訓練データ |
約3,000件のサンプル、10ドメイン(医療、教育など)、ChatML命令形式 |
訓練方法 |
LoRAを用いたパラメータ効率的ファインチューニング |
LoRAパラメータ |
r=16, alpha=32, dropout=0.05 |
訓練設定 |
バッチサイズ: 8、学習率: 0.0002、エポック数: 5 |
制限事項
⚠️ 重要な注意事項
- このモデルはアンケート回答生成に最適化されており、他のタスクでは性能が低下する可能性があります。
- 回答の質は、人物像と質問の明確性と具体性に依存します。
- モデルは時々、与えられた人物像と完全に一致しない回答を生成することがあります。
🔧 技術詳細
📄 ライセンス
このモデルは、ベースモデル TinyLlama/TinyLlama-1.1B-Chat-v1.0 のライセンスに従います。