Downloads · 30 days
15
6% of all-time downloads
tmiyamoto/qwen3-4b-20260206_1340-exp07-LR2e-6
qwen3-4b-20260206_1340-exp07-LR2e-6 is a text generation model from tmiyamoto. Use it when you need the model to write or continue text. It is set up for peft. The card lists the license as mit.
このリポジトリは、Qwen/Qwen3-4B-Instruct-2507 をベースモデルとし、QLoRA (4-bit) を用いてファインチューニングされた LoRA アダプターを提供します。
Downloads · 30 days
15
6% of all-time downloads
All-time downloads
269
Public
Repo size
540 MB
Likes
0
Public
Click a slice to open those files.
.safetensors529 MB · 97%
From the Hugging Face model README
このリポジトリは、Qwen/Qwen3-4B-Instruct-2507 をベースモデルとし、QLoRA (4-bit) を用いてファインチューニングされた LoRA アダプターを提供します。
【重要】本リポジトリには LoRA アダプターの重みのみが含まれています。ベースモデルは別途ロードする必要があります。
このアダプターは、構造化出力(JSON / YAML / XML / TOML / CSV)の精度向上を目的としてトレーニングされています。
学習時、損失(Loss)は最終的なアシスタントの出力にのみ適用され、中間的な推論プロセス(Chain-of-Thought)はマスクされています(Output: マーカー以降のみ学習)。
| パラメータ | 値 |
|---|---|
| ベースモデル | Qwen/Qwen3-4B-Instruct-2507 |
| 手法 | QLoRA (4-bit) |
| 最大シーケンス長 | 1024 |
| エポック数 | 1 |
| 学習率 | 2e-6 |
| LoRA r | 64 |
| LoRA α | 128 |
| LoRA dropout | 0 |
| LoRA ターゲット | q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj |
| バッチサイズ | 2 per device × 8 gradient accumulation = 16 effective |
| Warmup ratio | 0.1 |
| Weight decay | 0.05 |
| LR scheduler | cosine |
以下のデータセットを組み合わせて使用しています:
合計約 12,000 件のデータで学習しています。
ライセンス: CC-BY-4.0 (daichira)
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
base_model_id = "Qwen/Qwen3-4B-Instruct-2507"
lora_repo_id = "tmiyamoto/qwen3-4b-20260206_1340-exp07-LR2e-6"
tokenizer = AutoTokenizer.from_pretrained(base_model_id, trust_remote_code=True)
base_model = AutoModelForCausalLM.from_pretrained(
base_model_id, torch_dtype="auto", device_map="auto", trust_remote_code=True
)
model = PeftModel.from_pretrained(base_model, lora_repo_id)
messages = [
{"role": "user", "content": "次のテキストからJSON形式で情報を抽出してください: ..."}
]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(text, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=512)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
利用者は、データセットの帰属表記(クレジット)に関する要件、およびベースモデルの元の利用規約の両方を遵守する必要があります。