Downloads · 30 days
8
3% of all-time downloads
tmiyamoto/qwen3-4b-20260207_1646-exp13-supplement
qwen3-4b-20260207_1646-exp13-supplement is a machine learning model from tmiyamoto. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for peft. The card lists the license as other.
このリポジトリは、Qwen/Qwen3-4B-Instruct-2507 をベースモデルとし、QLoRA (4-bit) を用いてファインチューニングされた LoRA アダプターを提供します。
Downloads · 30 days
8
3% of all-time downloads
All-time downloads
314
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 | linear |
以下のデータセットを結合して学習に使用しました:
tmiyamoto/supplement-from-u10bei-v5 は、daichiraデータセットでカバーされていない8タスクタイプ(yaml_to_xml, text_to_xml, csv_to_toml, json_to_toml, toml_to_csv, toml_to_xml, xml_to_toml, yaml_to_toml)を補完するために作成しました。
LLMによるデータ生成は一切行っていません。 以下のルールベーススクリプトで既存データセットから機械的に抽出・変換しています:
build_supplement_all.py)で以下を実施:
convert.*{src}.*to.*{dst} 等のパターンマッチ)Output: マーカー以前)を除去し、最終出力のみを抽出hashlib.md5 でuser+assistantの全文をハッシュ化)from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
base_model_id = "Qwen/Qwen3-4B-Instruct-2507"
lora_repo_id = "tmiyamoto/qwen3-4b-20260207_1646-exp13-supplement"
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))
本アダプターの学習に使用したデータセットのライセンス:
daichira/* データセット: CC-BY-4.0tmiyamoto/supplement-from-u10bei-v5: u-10bei氏のデータセットから抽出(MIT License)利用者は、データセットの帰属表記(クレジット)に関する要件、およびベースモデルの元の利用規約の両方を遵守する必要があります。