🚀 モデルカード
このモデルは、peftで微調整されたモデルとマージされた、スタンドアロンのモデルです。
✨ 主な機能
このモデルは、🤗 transformersを使用して開発されたモデルで、Hub上に公開されています。モデルカードは自動生成されています。
属性 |
详情 |
開発者 |
[Liching] |
資金提供 |
[hobby] |
モデルタイプ |
[テキスト生成] |
言語 |
[英語] |
ライセンス |
[MIT] |
微調整元モデル |
[gemma-2b-it] |
📚 詳細ドキュメント
モデルの用途
gemma-2b-itは、ツール呼び出しには使用できず、最近開発されたDeepseek r1のように推論を伴って応答します。これらの制限は、モデルの微調整時に考慮されています。
バイアス、リスク、制限事項
このモデルは1エポックで微調整されているため、バイアスやエラーが発生しやすいです。
📦 インストール
使用するには、以下のコードを実行します。
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
from transformers import pipeline
import torch
model_id = "langdai/gemma-2-2b-it-tool-think"
model = AutoModelForCausalLM.from_pretrained(model_id,
device_map="cuda:0",
)
tokenizer = AutoTokenizer.from_pretrained(model_id)
model.eval()
generator = pipeline("text-generation", model= model, tokenizer= tokenizer)
💻 使用例
基本的な使用法
prompt="""<bos><start_of_turn>human
You are a function calling AI model. You are provided with function signatures within <tools></tools> XML tags.You may call one or more functions to assist with the user query. Don't make assumptions about what values to plug into functions.Here are the available tools:<tools> [{'type': 'function', 'function': {'name': 'convert_currency', 'description': 'Convert from one currency to another', 'parameters': {'type': 'object', 'properties': {'amount': {'type': 'number', 'description': 'The amount to convert'}, 'from_currency': {'type': 'string', 'description': 'The currency to convert from'}, 'to_currency': {'type': 'string', 'description': 'The currency to convert to'}}, 'required': ['amount', 'from_currency', 'to_currency']}}}, {'type': 'function', 'function': {'name': 'calculate_distance', 'description': 'Calculate the distance between two locations', 'parameters': {'type': 'object', 'properties': {'start_location': {'type': 'string', 'description': 'The starting location'}, 'end_location': {'type': 'string', 'description': 'The ending location'}}, 'required': ['start_location', 'end_location']}}}] </tools>Use the following pydantic model json schema for each tool call you will make: {'title': 'FunctionCall', 'type': 'object', 'properties': {'arguments': {'title': 'Arguments', 'type': 'object'}, 'name': {'title': 'Name', 'type': 'string'}}, 'required': ['arguments', 'name']}For each function call return a json object with function name and arguments within <tool_call></tool_call> XML tags as follows:
<tool_call>
{tool_call}
</tool_call>Also, before making a call to a function take the time to plan the function to take. Make that thinking process between <think>{your thoughts}</think>
Hi, I need to convert 500 INR to Euros. Can you help me with that?<end_of_turn><eos>
<start_of_turn>model
<think>"""
output = generator([{"role": "user", "content": prompt}], max_new_tokens=512, return_full_text=False)[0]
print(output)
🔧 技術詳細
環境影響
炭素排出量は、Lacoste et al. (2019)で提示されたMachine Learning Impact calculatorを使用して推定できます。
属性 |
详情 |
ハードウェアタイプ |
[T4 24GPU] |
使用時間 |
[4時間] |