|
--- |
|
license: gemma |
|
language: |
|
- ja |
|
- en |
|
base_model: |
|
- google/gemma-3-4b-it |
|
pipeline_tag: text-generation |
|
--- |
|
# DataPilot/ArrowMint-Gemma3-4B-ChocoMint-code |
|
|
|
## Overview |
|
|
|
`DataPilot/ArrowMint-Gemma3-4B-ChocoMint-code` は、Google の `google/gemma-3-4b-it` をベースモデルとして、[Unsloth](https://github.com/unslothai/unsloth) ライブラリと合成データセットを用いてファインチューニングされたモデルです。このモデルは、特に **コード生成およびコード関連タスクの性能向上** を目的としてトレーニングされました。 |
|
|
|
ベースモデルである Gemma 3 4B IT は、テキストと画像のマルチモーダル入力に対応し、テキストを出力する能力を持つ軽量な最先端のオープンモデルファミリーの一部です。ArrowMint はその能力を継承しつつ、コードに特化したチューニングが施されています。 |
|
|
|
**主な特徴:** |
|
|
|
* **ベースモデル:** google/gemma-3-4b-it |
|
* **トレーニング:** Unsloth を使用し、効率的なファインチューニングを実施 |
|
* **データセット:** コード性能向上を目的とした合成データセットを利用 |
|
* **目的:** コード生成、コード補完、コード説明、バグ修正などのタスクにおける性能向上 |
|
|
|
## How to use |
|
|
|
このモデルは以下の方法で使えます。 |
|
|
|
```python |
|
# pip install accelerate |
|
# pip install -U transformers |
|
|
|
from transformers import AutoProcessor, Gemma3ForConditionalGeneration |
|
import torch |
|
|
|
model_id = "DataPilot/ArrowMint-Gemma3-4B-ChocoMint-code" |
|
|
|
model = Gemma3ForConditionalGeneration.from_pretrained( |
|
model_id, device_map="auto" |
|
).eval() |
|
|
|
processor = AutoProcessor.from_pretrained(model_id) |
|
|
|
messages = [ |
|
{ |
|
"role": "system", |
|
"content": [{"type": "text", "text": "あなたは素晴らしいアシスタントです。"}] |
|
}, |
|
{ |
|
"role": "user", |
|
"content": [ |
|
{"type": "text", "text": "strawberryのRを数えるコードをPythonで考えてください。"} |
|
] |
|
} |
|
] |
|
|
|
inputs = processor.apply_chat_template( |
|
messages, add_generation_prompt=True, tokenize=True, |
|
return_dict=True, return_tensors="pt" |
|
).to(model.device, dtype=torch.bfloat16) |
|
|
|
input_len = inputs["input_ids"].shape[-1] |
|
|
|
with torch.inference_mode(): |
|
generation = model.generate(**inputs, max_new_tokens=100, do_sample=False) |
|
generation = generation[0][input_len:] |
|
|
|
decoded = processor.decode(generation, skip_special_tokens=True) |
|
print(decoded) |
|
``` |
|
|
|
## License |
|
|
|
このモデルは、ベースモデルである `google/gemma-3-4b-it` のライセンスに基づいています。 |
|
詳細については、[Gemma Terms of Use](https://ai.google.dev/gemma/terms) を参照してください。 |
|
|
|
派生モデルとしての `DataPilot/ArrowMint-Gemma3-4B-ChocoMint-code` の利用にあたっては、ベースモデルのライセンス条件を遵守してください。 |