Gemma 2 9B IT に対する小規模な LoRA ファインチューニングの実験プロジェクトです。データ準備、学習、モデル出力までの一連のワークフローを、設定ファイルと実行スクリプトに分けて管理します。モデルやデータセットの配布ではなく、再現可能な実験手順と実装例を提供します。
このリポジトリには、非公開の学習データ、原資料、モデル重み、checkpoint、マシン固有の生成物は含めていません。
- 対話データを一貫した JSONL 形式に整理すること
- 学習設定を YAML と実行コードから分離すること
- 4-bit のベースモデルに Unsloth で LoRA Adapter を適用すること
- チャット形式への変換と assistant 部分だけの loss 設定
- Adapter の保存、モデル統合、ローカル推論までの流れ
- 英語・日本語の prompt-free スタイル実験
- 環境チェックと GitHub Actions による軽量な検証
- 非公開データ、モデル重み、ローカルキャッシュを公開物から分離すること
技術的な規模は意図的に小さくしています。このプロジェクトの中心は、データ準備 → 設定 → 学習 → 評価・デプロイの記録 → 公開前整理、という追跡可能なワークフローです。
利用許諾を確認したローカルデータ
↓
JSONL のクリーニングと整理
↓
YAML による実験設定
↓
4-bit Gemma 2 の読み込み + LoRA
↓
assistant 部分を対象にした教師あり学習
↓
ローカル Adapter / export 生成物
↓
評価とデプロイ手順の整理
| パス | 内容 |
|---|---|
configs/ |
標準実験と prompt-free 実験の設定 |
engine/ |
モデル読み込みと LoRA 設定 |
scripts/ |
学習、データ整理、export、ローカル UI |
data/ |
非公開ローカルデータの説明 |
source_material/ |
非公開・再配布不可の原資料に関する説明 |
outputs/ |
Git 管理外のローカル生成物 |
.github/workflows/ |
軽量な CI チェック |
docs/ |
再現手順と公開前チェック |
このリポジトリには学習データを含めていません。ローカルでワークフローを実行する場合は、次のように環境を準備します。
python -m venv .venv
. .venv/bin/activate
python -m pip install -r requirements.txt
python scripts/check_environment.py利用許諾のある JSONL データを configs/train.yaml の data_path が指す場所に用意してから実行します。
python scripts/run_pipeline.py --config configs/train.yaml期待するデータ形式は次のとおりです。
{"messages": [{"role": "user", "content": "..."}, {"role": "assistant", "content": "..."}]}詳しい手順は USAGE.md、データの説明は DATA_CARD.md、再現手順は docs/reproducibility.md を参照してください。公開前には docs/github_release_checklist.md を確認してください。
- 本プロジェクトは文体適応の実験であり、事実性や歴史的に真正な人物再現を保証しません。
- ベースモデルは各自のライセンスに従って取得してください。
- 学習データと原資料は非公開であり、このリポジトリには含めていません。
- 学習済みモデルや checkpoint も公開物には含めていません。
- 学習には通常、CUDA 対応 GPU と十分なストレージが必要です。
An experimental project for running a small LoRA fine-tuning workflow with Gemma 2 9B IT. It separates data preparation, training, and model export into configuration files and executable scripts, providing a reproducible implementation example rather than distributing a model or dataset.
This repository is intended to demonstrate engineering process rather than publish a model or dataset. Private training data, source texts, model weights, checkpoints, and machine-specific artifacts are intentionally excluded.
- Turning conversation examples into a consistent JSONL chat format.
- Separating training configuration from executable code.
- Loading a 4-bit base model and applying LoRA adapters with Unsloth.
- Formatting chat messages and calculating assistant-only training labels.
- Saving adapters and documenting a merge/export path.
- Designing prompt-free English/Japanese style experiments.
- Adding lightweight environment checks and GitHub Actions validation.
- Keeping private data, model artifacts, and local caches outside the public release.
The technical scope is intentionally modest. The value of the project is the traceable workflow: data preparation → configuration → training → evaluation/deployment notes → release hygiene.
Permitted local data
↓
JSONL cleaning and curation
↓
YAML experiment configuration
↓
4-bit Gemma 2 loading + LoRA
↓
Assistant-focused supervised fine-tuning
↓
Local adapter/export artifacts
↓
Evaluation and deployment notes
| Path | Purpose |
|---|---|
configs/ |
Canonical and prompt-free experiment configurations |
engine/ |
Model loading and LoRA setup |
scripts/ |
Training, cleaning, curation, export, and local UI tools |
data/ |
Placeholder and instructions for private local data |
source_material/ |
Notice for omitted private or restricted source texts |
outputs/ |
Local model outputs; ignored by Git |
.github/workflows/ |
Lightweight CI checks |
docs/ |
Reproducibility and release guidance |
This repository does not contain a training dataset. To run the workflow locally:
python -m venv .venv
. .venv/bin/activate
python -m pip install -r requirements.txt
python scripts/check_environment.pyPlace a permitted JSONL dataset at the path selected in configs/train.yaml, or pass a different configuration:
python scripts/run_pipeline.py --config configs/train.yamlThe expected conversation shape is:
{"messages": [{"role": "user", "content": "..."}, {"role": "assistant", "content": "..."}]}See USAGE.md for the complete workflow, DATA_CARD.md for the data description, and docs/reproducibility.md for reproduction steps. Before publishing, review docs/github_release_checklist.md.
- This is a style-adaptation experiment, not a factual or historically authentic recreation of Wittgenstein.
- The base model must be obtained and used under its own licence.
- Training data and source texts are private and are not included in this repository.
- Model outputs are local artifacts and are not part of the public release.
- A CUDA-capable GPU and substantial storage are normally required for training.