第1章 SDG を使用した新しいデータセットの生成


タクソノミーツリーをカスタマイズした後、Red Hat Enterprise Linux AI の合成データ生成 (SDG) プロセスを使用して合成データセットを生成できます。SDG は、提供された例に基づいて実際のデータに似せて人工的に生成されたデータセットを作成するプロセスです。SDG は、質問と回答のペアを含む YAML ファイルを入力データとして使用します。これらの例では、SDG は mixtral-8x7b-instruct-v0-1 LLM を教師モデルとして使用して、同様の質問と回答のペアを生成します。SDG パイプラインでは、多くの質問が生成され、品質に基づいて採点されます。mixtral-8x7b-instruct-v0-1 教師モデルがこれらの関連性と一貫性を評価します。次に、パイプラインはフィルタリングメカニズムを適用して、最もスコアの高い質問を選択し、対応する回答を生成し、元のサンプルの質問に基づいてその精度をさらに評価します。最終的に作成された高品質な質問と回答のペアのセットは、トレーニングに使用される合成データセットに組み込まれます。

1.1. 例を使用した標準データセットの作成

例を使用して SDG プロセスを実行し、合成データセットを作成できます。

重要

4xL40 を搭載したシステムで SDG を実行している場合に、SDG を適切に実行するには次のパラメーターを使用する必要があります。

ilab data generate --num-cpus 4

前提条件

  • 起動可能なコンテナーイメージを使用して RHEL AI をインストールしている。
  • ナレッジデータを含むカスタム qna.yaml ファイルが作成されている。
  • SDG 用の mixtral-8x7B-instruct-v0-1 教師モデルをダウンロードしている。
  • skills-adapter-v3:1.5 および knowledge-adapter-v3:1.5 LoRA 階層化スキルおよびナレッジアダプターをダウンロードしている。
  • マシンの root ユーザーアクセス権がある。

手順

  1. ナレッジを含むカスタムのタクソノミーに基づいて新しい合成データセットを生成するには、次のコマンドを実行します。

    $ ilab data generate
    注記

    ilab data generate コマンドを実行するときに --enable-serving-output フラグを使用すると、vLLM 起動ログを表示できます。

    1. SDG プロセスの開始時に、vLLM は mixtral-8x7B-instruct 教師モデルをホストするためのサーバーを起動しようとします。

      vLLM がサーバーの起動を試みているときの出力例

      Starting a temporary vLLM server at http://127.0.0.1:47825/v1
      INFO 2024-08-22 17:01:09,461 instructlab.model.backends.backends:480: Waiting for the vLLM server to start at http://127.0.0.1:47825/v1, this might take a moment... Attempt: 1/120
      INFO 2024-08-22 17:01:14,213 instructlab.model.backends.backends:480: Waiting for the vLLM server to start at http://127.0.0.1:47825/v1, this might take a moment... Attempt: 2/120

    2. vLLM が接続すると、SDG プロセスは qna.yaml ファイル内のシード例に基づいて合成データの作成を開始します。

      vLLM 接続および SDG 生成の出力例

      INFO 2024-08-22 15:16:43,497 instructlab.model.backends.backends:480: Waiting for the vLLM server to start at http://127.0.0.1:49311/v1, this might take a moment... Attempt: 74/120
      INFO 2024-08-22 15:16:45,949 instructlab.model.backends.backends:487: vLLM engine successfully started at http://127.0.0.1:49311/v1
      Generating synthetic data using '/usr/share/instructlab/sdg/pipelines/agentic' pipeline, '/var/home/cloud-user/.cache/instructlab/models/mixtral-8x7b-instruct-v0-1' model, '/var/home/cloud-user/.local/share/instructlab/taxonomy' taxonomy, against http://127.0.0.1:49311/v1 server
      INFO 2024-08-22 15:16:46,594 instructlab.sdg:375: Synthesizing new instructions. If you aren't satisfied with the generated instructions, interrupt training (Ctrl-C) and try adjusting your YAML files. Adding more examples may help.

  2. CLI が新しいデータセットのロケーションを表示すると、SDG プロセスが完了します。

    SDG 実行が成功した出力例

    INFO 2024-08-16 17:12:46,548 instructlab.sdg.datamixing:200: Mixed Dataset saved to /home/example-user/.local/share/instructlab/datasets/skills_train_msgs_2024-08-16T16_50_11.jsonl
    INFO 2024-08-16 17:12:46,549 instructlab.sdg:438: Generation took 1355.74s

    注記

    このプロセスは、ハードウェアの仕様に応じて時間がかかる場合があります。

検証

  1. SDG ファイルが作成されたことを確認するには、~/.local/share/instructlab/datasets/ ディレクトリーに移動し、データが生成された日付に対応するファイルをリスト表示します。以下に例を示します。

    $ ls 2024-03-24_194933

    出力例

    knowledge_recipe_2024-03-24T20_54_21.yaml                   skills_recipe_2024-03-24T20_54_21.yaml
    knowledge_train_msgs_2024-03-24T20_54_21.jsonl              skills_train_msgs_2024-03-24T20_54_21.jsonl
    messages_granite-7b-lab-Q4_K_M_2024-03-24T20_54_21.jsonl    node_datasets_2024-03-24T15_12_12/

    重要

    最新の knowledge_train_msgs.jsonl および skills_train_msgs.jsonl ファイルをメモします。マルチフェーズのトレーニング中に、このファイルを指定する必要があります。各 JSONL のファイルにタイムスタンプがあります (例: knowledge_train_msgs_2024-08-08T20_04_28.jsonl)。トレーニング時には最新のファイルを使用します。

  2. オプション: ~/.local/share/datasets/<generation-date> ディレクトリーに移動して JSONL ファイルを開くと、SDG の出力を表示できます。

    $ cat ~/.local/share/datasets/<generation-date>/<jsonl-dataset>

    SDG JSONL ファイルの出力例

    {"messages":[{"content":"I am, Red Hat\u00ae Instruct Model based on Granite 7B, an AI language model developed by Red Hat and IBM Research, based on the Granite-7b-base language model. My primary function is to be a chat assistant.","role":"system"},{"content":"<|user|>\n### Deep-sky objects\n\nThe constellation does not lie on the [galactic\nplane](galactic_plane \"wikilink\") of the Milky Way, and there are no\nprominent star clusters. [NGC 625](NGC_625 \"wikilink\") is a dwarf\n[irregular galaxy](irregular_galaxy \"wikilink\") of apparent magnitude\n11.0 and lying some 12.7 million light years distant.
    Only 24000 light\nyears in diameter, it is an outlying member of the [Sculptor\nGroup](Sculptor_Group \"wikilink\"). NGC 625 is thought to have been\ninvolved in a collision and is experiencing a burst of [active star\nformation](Active_galactic_nucleus \"wikilink\"). [NGC\n37](NGC_37 \"wikilink\") is a [lenticular\ngalaxy](lenticular_galaxy \"wikilink\") of apparent magnitude 14.66. It is\napproximately 42 [kiloparsecs](kiloparsecs \"wikilink\") (137,000\n[light-years](light-years \"wikilink\")) in diameter and about 12.9\nbillion years old. [Robert's Quartet](Robert's_Quartet \"wikilink\")\n(composed of the
    irregular galaxy [NGC 87](NGC_87 \"wikilink\"), and three\nspiral galaxies [NGC 88](NGC_88 \"wikilink\"), [NGC 89](NGC_89 \"wikilink\")\nand [NGC 92](NGC_92 \"wikilink\")) is a group of four galaxies located\naround 160 million light-years away which are in the process of\ncolliding and merging. They are within a circle of radius of 1.6 arcmin,\ncorresponding to about 75,000 light-years. Located in the galaxy ESO\n243-49 is [HLX-1](HLX-1 \"wikilink\"), an [intermediate-mass black\nhole](intermediate-mass_black_hole \"wikilink\")\u2014the first one of its kind\nidentified. It is thought to be a remnant of a dwarf
    galaxy that was\nabsorbed in a [collision](Interacting_galaxy \"wikilink\") with ESO\n243-49. Before its discovery, this class of black hole was only\nhypothesized.\n\nLying within the bounds of the constellation is the gigantic [Phoenix\ncluster](Phoenix_cluster \"wikilink\"), which is around 7.3 million light\nyears wide and 5.7 billion light years away, making it one of the most\nmassive [galaxy clusters](galaxy_cluster \"wikilink\"). It was first\ndiscovered in 2010, and the central galaxy is producing an estimated 740\nnew stars a year. Larger still is [El\nGordo](El_Gordo_(galaxy_cluster) \"wikilink\"),
    or officially ACT-CL\nJ0102-4915, whose discovery was announced in 2012.

Red Hat logoGithubredditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

会社概要

Red Hat は、企業がコアとなるデータセンターからネットワークエッジに至るまで、各種プラットフォームや環境全体で作業を簡素化できるように、強化されたソリューションを提供しています。

多様性を受け入れるオープンソースの強化

Red Hat では、コード、ドキュメント、Web プロパティーにおける配慮に欠ける用語の置き換えに取り組んでいます。このような変更は、段階的に実施される予定です。詳細情報: Red Hat ブログ.

Red Hat ドキュメントについて

Legal Notice

Theme

© 2026 Red Hat
トップに戻る