File size: 2,993 Bytes
b95e6d3
 
114f64a
 
 
 
 
 
b95e6d3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
952525e
b95e6d3
 
952525e
 
b95e6d3
952525e
b95e6d3
 
 
 
 
952525e
 
 
 
b95e6d3
 
952525e
 
 
 
 
 
 
 
 
 
b95e6d3
 
952525e
 
 
 
 
 
 
 
 
 
 
 
 
b95e6d3
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
---
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` の利用にあたっては、ベースモデルのライセンス条件を遵守してください。