95 lines
2.8 KiB
Markdown
95 lines
2.8 KiB
Markdown
---
|
||
license: apache-2.0
|
||
language:
|
||
- en
|
||
- ja
|
||
tags:
|
||
- olmo
|
||
- sft
|
||
- instruction-tuning
|
||
- bilingual
|
||
pipeline_tag: text-generation
|
||
base_model: your_username/olmo2-300m-cpt
|
||
---
|
||
|
||
# OLMo-2 300M — SFT (Supervised Fine-Tuning)
|
||
|
||
OLMo-2 ~300M の CPT モデルに Tülu-3 SFT ミックスで instruction tuning したモデルです。
|
||
質問への回答・指示への応答が可能になります。
|
||
|
||
## Model Architecture
|
||
|
||
| 項目 | 値 |
|
||
|------|-----|
|
||
| Base config | allenai/OLMo-2-0425-1B(config のみ・重みは使用せず) |
|
||
| Parameters | ~300M |
|
||
| hidden_size | 1024 |
|
||
| num_hidden_layers | 16 |
|
||
| num_attention_heads | 16 |
|
||
| num_key_value_heads | 8 (GQA) |
|
||
| intermediate_size | 4096 |
|
||
| Tokenizer | allenai/OLMo-2-0425-1B |
|
||
|
||
## Training Pipeline
|
||
|
||
| Stage | モデル | データ | トークン数 |
|
||
|-------|--------|--------|-----------|
|
||
| 1. Pretrain | ランダム初期化 | FineWeb | ~1.5B |
|
||
| 2. CPT | Stage 1 出力 | FineWeb-Edu 60% + Wikipedia JA 40% | ~0.3B |
|
||
| 3. SFT(このモデル) | Stage 2 出力 | Tülu-3 SFT mixture | 100K samples |
|
||
|
||
## SFT Training Details
|
||
|
||
| 項目 | 値 |
|
||
|------|-----|
|
||
| Dataset | allenai/tulu-3-sft-mixture (100K samples) |
|
||
| Learning rate | 5e-6 (linear decay) |
|
||
| Warmup ratio | 0.03 |
|
||
| Epochs | 2 |
|
||
| Batch size (effective) | 64 seq |
|
||
| Max seq length | 2048 |
|
||
| Hardware | NVIDIA RTX 4090 24GB |
|
||
| Framework | TRL SFTTrainer |
|
||
|
||
## Usage
|
||
|
||
```python
|
||
from transformers import AutoTokenizer, AutoModelForCausalLM
|
||
import torch
|
||
|
||
model_id = "your_username/olmo2-300m-sft"
|
||
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
||
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.bfloat16, device_map="auto")
|
||
|
||
messages = [{"role": "user", "content": "日本語で自己紹介してください。"}]
|
||
input_text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
||
inputs = tokenizer(input_text, return_tensors="pt").to(model.device)
|
||
|
||
outputs = model.generate(**inputs, max_new_tokens=200, temperature=0.7, do_sample=True)
|
||
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
|
||
```
|
||
|
||
## Intended Use
|
||
|
||
- 英日バイリンガルの質問応答・テキスト生成
|
||
- LLM トレーニングパイプラインの学習・研究目的
|
||
- DPO(Stage 4)のベースモデルとして使用
|
||
|
||
## Limitations
|
||
|
||
- DPO による alignment は未実施のため、有害な出力の抑制は限定的
|
||
- データ量・モデルサイズともに小規模のため、品質は限定的
|
||
- 事実の正確性を保証しない
|
||
|
||
## Training Data Attribution
|
||
|
||
| データセット | ライセンス |
|
||
|------------|-----------|
|
||
| FineWeb-Edu (HuggingFaceFW) | ODC-By |
|
||
| Wikipedia JA (Wikimedia) | CC BY-SA 4.0 |
|
||
| Tülu-3 SFT mixture (AllenAI) | 混合(各サブセットのライセンスに従う) |
|
||
|
||
## License
|
||
|
||
Apache 2.0
|