メインコンテンツへスキップ
学習ガイドの章 すべてのドキュメント

モデル学習チュートリアルと完全な例

SDK 0.2.0 でドイツ語、分類、翻訳、プライバシー、ホスティング、Colab、複数 GPU、エクスポートを扱う例です。

どの言語版でもコマンドとコードは英語のままです。大文字のプレースホルダーは、ご自身のアカウントと有料ジョブの値に置き換えてください。共有ノートブックやログに実際のキーを貼り付けないでください。

完全な学習レシピを作る

役立つ例にはプロンプトだけでなく、データ、計算資源、受け入れ基準も含まれます。
  1. タスク 言語または業務の目標
  2. 入力 学習、検証、非公開テスト
  3. 実行環境 互換性のある計算資源とストレージ
  4. 結果 受け入れ基準と有効な出力

タスク: 言語または業務の目標. 入力: 学習、検証、非公開テスト. 実行環境: 互換性のある計算資源とストレージ. 結果: 受け入れ基準と有効な出力

独立したドイツ語モデルを学習する

設定の章にある自動モードの完全な設定から始めます。互換性のある生徒モデル、レビュー済みの学習素材、独立した検証セットと最終テストセット、ドイツ語のルーブリックを含むプロジェクトディレクトリを作成してください。プロバイダープランに含まれる参照モデルを選びます。SDK は前提知識とトピックを提案し、ベースラインを測定し、承認済みの予算内で改善を進める想定です。

  • 以下の JSON は英語のデータ形式を示す例です。実際のデータファイルには、レビュー済みのドイツ語テキストを1行につき1オブジェクトで記載します。
  • 実行可能なプロジェクトファイルには、レシピの一部ではなく自動モードの完全な設定を使用してください。
  • 読解、作文、翻訳、推論を個別に評価します。小型の生徒モデルがすべてのタスクで教師モデルと同等になる保証はありません。
例 · jsonl
{"text":"Customer: My invoice total is incorrect. Category: billing"}
{"text":"Customer: I cannot sign in. Category: account_access"}
{"text":"Customer: The application closes when I upload a file. Category: technical_issue"}
例 · bash
# Full Automatic German-language workflow.
# 1. Put a compatible local model in german-project/models/student/.
# 2. Save the complete project configuration as german-project/training.json.
# 3. Add independent train/validation/test files and the reviewed german rubric.
# 4. Replace provider/reference placeholders using your included model catalogue.
fpai-training doctor --config ./german-project/training.json
fpai-training plan --config ./german-project/training.json --dry-run
# The plan must break the objective into prerequisites and measurable topics.
fpai-training run --config ./german-project/training.json
fpai-training evaluate --run ./german-project/runs/german-001 --split test
fpai-training export --run ./german-project/runs/german-001 --format safetensors
# Evaluate comprehension, writing, translation and reasoning separately.
# A passed classifier does not prove all German-language capabilities.

業務タスクに合わせてプロジェクトを調整する

以下の JSON は設定の一部であり、完全なプロジェクトファイルではありません。自動モードまたは詳細設定モードの完全な設定をコピーし、指定されたセクションを例で置き換えます。識別情報、モデル、教師モデル、実行環境、上限付き予算は残したうえで、ファイル全体を検証してください。分類と翻訳では、トピック、データ、受け入れ基準をそれぞれ変える必要があります。

  • サポート問い合わせの分類では、クラスごとの precision と recall、macro F1、クラス分布、判断が難しい事例を報告します。
  • 翻訳では、独立した二言語の例を使い、意味、用語、人名、数値、文調を確認します。
  • teacher_sharing が none の場合、顧客データはローカルにとどまります。禁止されている共有なしでは目標を達成できない場合、データをアップロードせず、その理由を説明して停止してください。
例 · json
{
  "schema_version": "1.0", "mode": "automatic",
  "objective": "Classify support messages into billing, account_access or technical_issue.",
  "model": {"path": "./models/student", "adapter": "transformers-causal-lm", "revision": null},
  "teacher": {"provider": "openai", "reference_model_id": 123},
  "data": {"sources": ["./data/train.jsonl"], "teacher_sharing": "none", "validation_path": "./data/validation.jsonl", "test_path": "./data/test.jsonl", "deduplicate": true, "seed": 42},
  "runtime": {"target": "customer_datacenter", "devices": "auto", "distributed": {"backend": "none", "nodes": 1}},
  "training": {"method": "auto"},
  "curriculum": {"topics": ["intent", "ambiguous_requests", "class_balance"], "max_improvement_cycles": 3, "stop_on_regression": true},
  "budgets": {"max_training_minutes": 120, "max_teacher_requests": 100, "max_storage_gib": 20},
  "checkpoints": {"every_steps": 100, "keep_last": 3, "resume_validation": "strict"},
  "evaluation": {"rubric": "./rubric.json", "baseline_required": true},
  "output": {"directory": "./runs/support-001", "format": "adapters"}
}
例 · json
{
  "objective": "Translate English support replies into German while preserving names, numbers and meaning.",
  "curriculum": {"topics": ["terminology", "meaning", "names_and_numbers", "tone"], "max_improvement_cycles": 3, "stop_on_regression": true},
  "evaluation": {"rubric": "./rubrics/translation.json", "baseline_required": true},
  "data": {"sources": ["./data/translation-train.jsonl"], "validation_path": "./data/translation-validation.jsonl", "test_path": "./data/translation-test.jsonl", "teacher_sharing": "approved_only"},
  "output": {"directory": "./runs/translation-001", "format": "safetensors"}
}
例 · jsonl
{"prompt":"My invoice total is wrong. Which category applies?","target":"billing","criterion":"support_category"}
{"prompt":"I cannot sign in. Which category applies?","target":"account_access","criterion":"support_category"}
例 · json
{
  "schema_version": "1.0",
  "name": "support-category-evaluation",
  "scale": {"minimum": 0, "maximum": 1},
  "criteria": [
    {"id": "support_category", "description": "Match the expected category.", "metric": "macro_f1", "minimum_score": 0.85}
  ],
  "regression": {"maximum_score_drop": 0.02},
  "final_test": {"path": "./data/test.jsonl", "allow_training_use": false}
}

適切なインフラで実行し、安全に成果物を渡す

これらの実行環境の例も、レビュー済みの完全な設定に組み込む断片です。FusionPointAI Hosting、顧客のデータセンター、互換性のある Colab 環境は計算資源を提供します。名称を選んでも GPU が割り当てられたり、ノートブックのクレジットを購入したり、別の実行環境が互換になったりするわけではありません。SDK はその環境で生徒モデルを読み込み、学習します。一時的なノートブックが終了する前に出力を保存してください。

  • ホスティング例:契約済みの計算環境、承認されたストレージ、アカウントの利用資格を使います。該当する場合、ホスティングは別の商取引項目です。
  • Colab の例:API key はノートブックの機密情報ストレージに保存し、利用可能な GPU とストレージを確認します。環境の終了前に有効なチェックポイントを承認済みの永続ストレージへコピーしてください。
  • 分散実行の例:承認されたコーディネーターと認証済みのノード間通信を使い、固定した環境と合意済みの rendezvous/rank 値をそろえます。launcher が管理するのは、このプロジェクトの worker だけです。
例 · json
{
  "runtime": {"target": "fusionpointai_hosting", "devices": "auto", "distributed": {"backend": "none", "nodes": 1}},
  "budgets": {"max_training_minutes": 60, "max_teacher_requests": 500, "max_storage_gib": 20},
  "output": {"directory": "./runs/hosted-001", "format": "safetensors"}
}
例 · json
{
  "runtime": {"target": "colab", "devices": [0], "distributed": {"backend": "none", "nodes": 1}},
  "checkpoints": {"every_steps": 50, "keep_last": 2, "resume_validation": "strict"},
  "budgets": {"max_training_minutes": 30, "max_teacher_requests": 100, "max_storage_gib": 10},
  "output": {"directory": "./runs/colab-001", "format": "adapters"}
}
例 · json
{
  "runtime": {"target": "customer_datacenter", "devices": [0, 1], "distributed": {"backend": "ddp", "nodes": 2}},
  "checkpoints": {"every_steps": 100, "keep_last": 3, "resume_validation": "strict"},
  "output": {"directory": "./runs/distributed-001", "format": "safetensors"}
}
例 · bash
# Export a validated adapter or full model, not teacher weights.
fpai-training evaluate --run ./german-project/runs/support-001 --split test
fpai-training export --run ./german-project/runs/support-001 --format adapters
# Inspect artifact-manifest.json, pinned base/tokenizer and evaluation-report.json.
# Reload the package in a fresh compatible runtime before changing live inference.
# Export does not deploy, allocate hosting, or upload to an external model hub.