スキルとナレッジの YAML ファイルの作成
スキルとナレッジの YAML ファイルを作成するためのガイドライン
概要
第1章 タクソノミーツリーのカスタマイズ
RHEL AI 環境内のナレッジまたはスキルデータを使用してタクソノミーツリーを変更し、独自のカスタム Granite Large Language Model (LLM) を作成できます。RHEL AI では、ナレッジとスキルで作成されたデータセットが YAML でフォーマットされています。この YAML 設定は qna.yaml
ファイルと呼ばれ、"qna" は質問と回答を表します。タクソノミーツリーは、qna.yaml
ファイルを保持するカテゴリーおよび情報分類の方法です。
次のドキュメントセクションでは、タクソノミーツリーのスキルとナレッジの qna.yaml
ファイルを作成する方法について説明します。
スターター Granite LLM のトレーニングに使用できる、サポート対象のナレッジドキュメントタイプがいくつかあります。現在サポートされているドキュメントの種類は次のとおりです。
- マークダウン
1.1. スキルとナレッジの概要
スキルとナレッジセットを使用し、ドメイン固有の情報を指定してカスタムモデルを教えることができます。
- ナレッジ
- 情報およびファクトで構成されるデータセット。モデルのナレッジデータを作成するときは、モデルが質問に正確に答えられるように、追加のデータと情報を提供します。
- スキル
モデルにタスクの実行方法を教えることができるデータセット。RHEL AI のスキルは、次のカテゴリーに分類されます。
構成スキル: 構成スキルにより、AI モデルは特定のタスクや機能を実行できます。構成スキルには、以下の 2 つのタイプがあります。
- 自由形式の構成スキル: 機能するために追加のコンテキストや情報を必要としないパフォーマンススキルです。
- グラウンディング構成スキル: このスキルは追加のコンテキストを必要とする実行スキルです。たとえば、モデルが表を読み取れるように訓練できます。この場合、追加のコンテキストは表のレイアウトの例などです。
- 基礎スキル: 基礎スキルとは、数学、推論、コーディングに関わるスキルです。
関連情報
第2章 タクソノミーツリーへのナレッジの追加
モデルがドメイン固有の情報を学習できるように、タクソノミーツリーをカスタマイズできます。RHEL AI の場合、ナレッジデータは Git リポジトリーでホストされます。ナレッジコントリビューションは、qna.yaml
ファイルを使用して、モデルを訓練するドキュメントの読み取り方法を学習します。ナレッジの各 qna.yaml
ファイルには、次のキーを持つキー値エントリーのセットが含まれています。
フィールド | 説明 | 制約 | 例 |
---|---|---|---|
| qna.yaml ファイルで使用されるタクソノミースキーマのバージョン。 |
このパラメーターで現在サポートされている値は |
|
| コントリビューターの名前またはユーザー名。 | - |
|
| ナレッジドキュメントの主題またはカテゴリー。ドメインは、合成データの生成中に教師モデルにプロンプトを表示し、別のコンテキストを追加します。 |
|
ほうおう座に関するナレッジドキュメントの場合、ドメインは
健康保険情報に関するナレッジドキュメントの場合、ドメインは |
| ナレッジドキュメントからのコンテキストを含む質問と回答のペアが含まれるフィールド。 |
|
seed_examples: - context: questions_and_answers:
|
| ナレッジドキュメントからそのまま取得された情報のチャンク。表、段落、リストなど、さまざまな種類のコンテンツを強調表示して、教師のモデルをガイドします。 | 各 qna.yaml には 5 つのコンテキストブロックが必要で、最大トークン数は 500 です。 |
|
| モデルが学習する質問と回答が含まれるフィールド。 |
各 |
questions_and_answers: - question: answer:
|
| 関連するコンテキストで、およびそれに関連する質問です。事実に基づく質問、推論、説明など、さまざまな質問と質問タイプを提供します。 | 最大トークン数は 250 です。 |
|
|
指定された質問に対する回答。回答は完全な文章で記述し、 | 最大トークン数は 250 です。 |
|
| 論文の要旨に似た、文書の簡単な要約。これにより、ドキュメントの内容に関するコンテキストの概要がわかります。 |
|
|
| ナレッジデータのソースが含まれるフィールド。 | - |
document: repo: commit: patterns:
|
| ナレッジファイルを含む git リポジトリーへの URL。 | - |
|
| リポジトリー内のドキュメントに対応する完全なコミットハッシュ | - | - |
| git リポジトリーのファイルが含まれています。 |
有効な値は |
|
qna.yaml
を作成するための関連情報
-
サンプルパラメーターを含む完全な
qna.yaml
ファイルについては、サンプルナレッジ YAML 仕様 ドキュメントを参照してください。 - YAML キュレーションプロセスの完全なガイドラインについては、モデルパフォーマンスを最適化するための YAML 作成プラクティス ドキュメントを参照してください。
2.1. ナレッジ YAML ファイルの作成
次のプロセスは、RHEL AI ツールセットを使用して、提供されたナレッジファイルについて LLM に教える qna.yaml
ファイルを作成する方法を示しています。
前提条件
- 起動可能なコンテナーイメージを使用して RHEL AI をインストールしている。
- git CLI をインストールしている。
-
InstructLab を初期化し、
ilab
CLI を使用できる。 - マシンへの root ユーザーアクセス権がある。
手順
- ナレッジファイルを git リポジトリーでホストしているため、タクソノミーを更新するときは作業ブランチをチェックアウトする必要があります。
- taxonomy フォルダーに移動します。RHEL AI には、対話するための既成のタクソノミーツリーが含まれています。
- taxonomy ディレクトリー内の knowledge フォルダーに移動します。
ナレッジ
qna.yaml
ファイルを追加するタクソノミーツリーにディレクトリーとフォルダーを追加します。タクソノミーツリー内のファイルパスの例
taxonomy/knowledge/technical_documents/product_customer_cases/qna.yaml
taxonomy/knowledge/technical_documents/product_customer_cases/qna.yaml
Copy to Clipboard Copied! 任意のテキストエディターを使用して、
qna.yaml
ファイルを作成します。YAML にはqna.yaml
のタイトルが必要です。注記SDG を適切に実行するには、
questions_and_answers
パラメーターに、コンテキスト値ごとに少なくとも 5 つのcontext
チャンクと 3 つの質問と回答のシードを含める必要があります。-
必要なキーを
qna.yaml
ファイルに追加し、変更を保存します。qna.yaml
ファイルのフォーマットに関する詳細は、「ナレッジ YAML 仕様の例」を参照してください。
検証
ナレッジの
qna.yaml
ファイルが正しい形式であることを確認するには、以下のコマンドを実行します。ilab taxonomy diff
$ ilab taxonomy diff
Copy to Clipboard Copied! CLI には、タクソノミーツリーと
qna.yaml
ファイルが有効であるか、適切にフォーマットされているかが表示されます。CLI では、発生したエラーを修正できる場所も表示されます。有効なタクソノミーツリーと
qna.yaml
ファイルの出力例knowledge/technical_documents/product_customer_cases/qna.yaml Taxonomy in /taxonomy/ is valid :)
knowledge/technical_documents/product_customer_cases/qna.yaml Taxonomy in /taxonomy/ is valid :)
Copy to Clipboard Copied! 無効なタクソノミーツリーとエラーのある
qna.yaml
ファイルの出力例9:15 error syntax error: mapping values are not allowed here (syntax) Reading taxonomy failed with the following error: 1 taxonomy with errors! Exiting.
9:15 error syntax error: mapping values are not allowed here (syntax) Reading taxonomy failed with the following error: 1 taxonomy with errors! Exiting.
Copy to Clipboard Copied!
2.1.1. ナレッジ YAML 仕様の例
ナレッジコントリビューションは、qna.yaml
ファイルを使用して、モデルを訓練するドキュメントの読み取り方法を学習します。RHEL AI の合成データ生成 (SDG) プロセスは qna.yaml
シード例を使用して大量の人工データを作成します。このプロセスにより、モデルは提供されたサンプルだけに頼るのではなく、より多くのデータから学習できるようになります。
ナレッジの qna.yaml
ファイルの例
version: 3 domain: astronomy document_outline: | Information about the Phoenix Constellation including the history, characteristics, and features of the stars in the constellation. created_by: <user-name> seed_examples: - context: | **Phoenix** is a minor constellation in the southern sky. Named after the mythical Phoenix_(mythology), it was first depicted on a celestial atlas by Johann Bayerin his 1603 Uranometria. The French explorer and astronomer Nicolas Louis de Lacaille charted the brighter stars and gave their Bayer designations in 1756. The constellation stretches from roughly −39 degrees to −57 degrees declination, and from 23.5h to 2.5h of right ascension. The constellations Phoenix, Grus, Pavo and Tucana are known as the Southern Birds. questions_and_answers: - question: | What is the Phoenix constellation? answer: | The Phoenix constellation is a minor constellation in the southern sky. - question: | Who charted the Phoenix constellation? answer: | The Phoenix constellation was charted by french explorer and astronomer Nicolas Louis de Lacaille. - question: | How far does the Phoenix constellation stretch? answer: | The phoenix constellation stretches from roughly −39° to −57° declination, and from 23.5h to 2.5h of right ascension. - context: | Phoenix was the largest of the 12 constellations established by Petrus Plancius from the observations of Pieter Dirkszoon Keyser and Frederick de Houtman. It first appeared on a 35cm diameter celestial globe published in 1597 (or 1598) in Amsterdam by Plancius with Jodocus Hondius. The first depiction of this constellation in a celestial atlas was in Johann Bayer *Uranometria* of 1603. De Houtman included it in his southern star catalog the same year under the Dutch name *Den voghel Fenicx*, "The Bird Phoenix", symbolising the phoenix of classical mythology. One name of the brightest star Alpha Phoenicis—Ankaa—is derived from the Arabic: العنقاء, romanized: al-‘anqā’, lit. 'the phoenix', and was coined sometime after 1800 in relation to the constellation. questions_and_answers: - question: | What is the brightest star in the Phoenix constellation called? answer: | Alpha Phoenicis or Ankaa is the brightest star in the Phoenix Constellation. - question: Where did the Phoenix constellation first appear? answer: | The Phoenix constellation first appeared on a 35-cm diameter celestial globe published in 1597 (or 1598) in Amsterdam by Plancius with Jodocus Hondius. - question: | What does "The Bird Phoenix" symbolize? answer: | "The Bird Phoenix" symbolizes the phoenix of classical mythology. - context: | Phoenix is a small constellation bordered by Fornax and Sculptor to the north, Grus to the west, Tucana to the south, touching on the corner of Hydrus to the south, and Eridanus to the east and southeast. The bright star Achernar is nearby. The three-letter abbreviation for the constellation, as adopted by the International Astronomical Union in 1922, is "Phe". The official constellation boundaries, as set by Belgian astronomer Eugène Delporte in 1930, are defined by a polygon of 10 segments. In the equatorial coordinate system, the right ascension coordinates of these borders lie between 23<sup>h</sup> 26.5<sup>m</sup> and 02<sup>h</sup> 25.0<sup>m</sup>, while the declination coordinates are between −39.31° and −57.84°. This means it remains below the horizon to anyone living north of the 40th parallel in the Northern Hemisphere, and remains low in the sky for anyone living north of the equator. It is most visible from locations such as Australia and South Africa during late Southern Hemisphere spring. Most of the constellation lies within, and can be located by, forming a triangle of the bright stars Achernar, Fomalhaut and Beta Ceti—Ankaa lies roughly in the centre of this. questions_and_answers: - question: What are the characteristics of the Phoenix constellation? answer: | Phoenix is a small constellation bordered by Fornax and Sculptor to the north, Grus to the west, Tucana to the south, touching on the corner of Hydrus to the south, and Eridanus to the east and southeast. The bright star Achernar is nearby. - question: | When is the phoenix constellation most visible? answer: | Phoenix is most visible from locations such as Australia and South Africa during late Southern Hemisphere spring. - question: | What are the Phoenix Constellation boundaries? answer: | The official constellation boundaries for Phoenix, as set by Belgian astronomer Eugène Delporte in 1930, are defined by a polygon of 10 segments. - context: | Ten stars have been found to have planets to date, and four planetary systems have been discovered with the SuperWASP project. HD 142 is a yellow giant that has an apparent magnitude of 5.7, and has a planet (HD 142b) 1.36 times the mass of Jupiter which orbits every 328 days. HD 2039 is a yellow subgiant with an apparent magnitude of 9.0 around 330 light years away which has a planet (HD 2039) six times the mass of Jupiter. WASP-18 is a star of magnitude 9.29 which was discovered to have a hot Jupiter-like planet (WASP-18b) taking less than a day to orbit the star. The planet is suspected to be causing WASP-18 to appear older than it really is. WASP-4and WASP-5 are solar-type yellow stars around 1000 light years distant and of 13th magnitude, each with a single planet larger than Jupiter. WASP-29 is an orange dwarf of spectral type K4V and visual magnitude 11.3, which has a planetary companion of similar size and mass to Saturn. The planet completes an orbit every 3.9 days. questions_and_answers: - question: In the Phoenix constellation, how many stars have planets? answer: | In the Phoenix constellation, ten stars have been found to have planets to date, and four planetary systems have been discovered with the SuperWASP project. - question: | What is HD 142? answer: | HD 142 is a yellow giant that has an apparent magnitude of 5.7, and has a planet (HD 142 b) 1.36 times the mass of Jupiter which orbits every 328 days. - question: | Are WASP-4 and WASP-5 solar-type yellow stars? answer: | Yes, WASP-4 and WASP-5 are solar-type yellow stars around 1000 light years distant and of 13th magnitude, each with a single planet larger than Jupiter. - context: | The constellation does not lie on the galactic plane of the Milky Way, and there are no prominent star clusters. NGC 625 is a dwarf irregular galaxy of apparent magnitude 11.0 and lying some 12.7 million light years distant. Only 24000 light years in diameter, it is an outlying member of the Sculptor Group. NGC 625 is thought to have been involved in a collision and is experiencing a burst of active star formation. NGC 37 is a lenticular galaxy of apparent magnitude 14.66. It is approximately 42 kiloparsecs 137,000 light-years in diameter and about 12.9 billion years old. Robert's Quartet composed of the irregular galaxy NGC 87, and three spiral galaxies NGC 88, NGC 89 and NGC 92 is a group of four galaxies located around 160 million light-years away which are in the process of colliding and merging. They are within a circle of radius of 1.6 arcmin, corresponding to about 75,000 light-years. Located in the galaxy ESO 243-49 is HLX-1, an intermediate-mass black hole—the first one of its kind identified. It is thought to be a remnant of a dwarf galaxy that was absorbed in a collision with ESO 243-49. Before its discovery, this class of black hole was only hypothesized. questions_and_answers: - question: | Is the Phoenix Constellation part of the Milky Way? answer: | The Phoenix constellation does not lie on the galactic plane of the Milky Way, and there are no prominent star clusters. - question: | How many light years away is NGC 625? answer: | NGC 625 is 24000 light years in diameter and is an outlying member of the Sculptor Group. - question: | What is Robert's Quartet composed of? answer: | Robert's Quartet is composed of the irregular galaxy NGC 87, and three spiral galaxies NGC 88, NGC 89 and NGC 92. document: repo: https://github.com/<profile>/<repo-name> / commit: <commit hash> patterns: - phoenix_constellation.md - phoenix_history.md
version: 3
domain: astronomy
document_outline: |
Information about the Phoenix Constellation including the
history, characteristics, and features of the stars in the constellation.
created_by: <user-name>
seed_examples:
- context: |
**Phoenix** is a minor constellation in the southern sky. Named after the mythical
Phoenix_(mythology), it was first depicted on a celestial atlas by Johann Bayerin his 1603
Uranometria. The French explorer and astronomer Nicolas Louis de Lacaille charted the brighter stars
and gave their Bayer designations in 1756. The constellation stretches from roughly −39 degrees to −57
degrees declination, and from 23.5h to 2.5h of right ascension. The constellations Phoenix, Grus,
Pavo and Tucana are known as the Southern Birds.
questions_and_answers:
- question: |
What is the Phoenix constellation?
answer: |
The Phoenix constellation is a minor constellation in the southern sky.
- question: |
Who charted the Phoenix constellation?
answer: |
The Phoenix constellation was charted by french explorer and
astronomer Nicolas Louis de Lacaille.
- question: |
How far does the Phoenix constellation stretch?
answer: |
The phoenix constellation stretches from roughly −39° to −57°
declination, and from 23.5h to 2.5h of right ascension.
- context: |
Phoenix was the largest of the 12 constellations established by Petrus Plancius from the observations
of Pieter Dirkszoon Keyser and Frederick de Houtman. It first appeared on a 35cm diameter celestial globe
published in 1597 (or 1598) in Amsterdam by Plancius with Jodocus Hondius. The first depiction of this
constellation in a celestial atlas was in Johann Bayer *Uranometria* of 1603. De Houtman included it in
his southern star catalog the same year under the Dutch name *Den voghel Fenicx*, "The Bird Phoenix",
symbolising the phoenix of classical mythology. One name of the brightest star Alpha Phoenicis—Ankaa—is
derived from the Arabic: العنقاء, romanized: al-‘anqā’, lit. 'the phoenix', and was coined sometime after
1800 in relation to the constellation.
questions_and_answers:
- question: |
What is the brightest star in the Phoenix constellation
called?
answer: |
Alpha Phoenicis or Ankaa is the brightest star in the Phoenix
Constellation.
- question: Where did the Phoenix constellation first appear?
answer: |
The Phoenix constellation first appeared on a 35-cm diameter
celestial globe published in 1597 (or 1598) in Amsterdam by
Plancius with Jodocus Hondius.
- question: |
What does "The Bird Phoenix" symbolize?
answer: |
"The Bird Phoenix" symbolizes the phoenix of classical mythology.
- context: |
Phoenix is a small constellation bordered by Fornax and Sculptor to the north, Grus to the west,
Tucana to the south, touching on the corner of Hydrus to the south, and Eridanus to the east and southeast.
The bright star Achernar is nearby. The three-letter abbreviation for the constellation, as adopted by
the International Astronomical Union in 1922, is "Phe". The official constellation boundaries,
as set by Belgian astronomer Eugène Delporte in 1930, are defined by a polygon of 10 segments.
In the equatorial coordinate system, the right ascension coordinates of these borders lie
between 23<sup>h</sup> 26.5<sup>m</sup> and 02<sup>h</sup> 25.0<sup>m</sup>,
while the declination coordinates are between −39.31° and −57.84°. This means it remains
below the horizon to anyone living north of the 40th parallel in the Northern
Hemisphere, and remains low in the sky for anyone living north of the equator. It is most
visible from locations such as Australia and South Africa during late Southern Hemisphere spring.
Most of the constellation lies within, and can be located by, forming a triangle of the bright
stars Achernar, Fomalhaut and Beta Ceti—Ankaa lies roughly in the centre of this.
questions_and_answers:
- question: What are the characteristics of the Phoenix constellation?
answer: |
Phoenix is a small constellation bordered by Fornax and Sculptor to
the north, Grus to the west, Tucana to the south, touching on the
corner of Hydrus to the south, and Eridanus to the east and southeast.
The bright star Achernar is nearby.
- question: |
When is the phoenix constellation most visible?
answer: |
Phoenix is most visible from locations such as Australia and
South Africa during late Southern Hemisphere spring.
- question: |
What are the Phoenix Constellation boundaries?
answer: |
The official constellation boundaries for Phoenix, as set by Belgian
astronomer Eugène Delporte in 1930, are defined by a polygon of 10
segments.
- context: |
Ten stars have been found to have planets to date, and four planetary systems have been
discovered with the SuperWASP project. HD 142 is a yellow giant that has an apparent magnitude
of 5.7, and has a planet (HD 142b) 1.36 times the mass of Jupiter which orbits every 328 days.
HD 2039 is a yellow subgiant with an apparent magnitude of 9.0 around 330 light years away which
has a planet (HD 2039) six times the mass of Jupiter. WASP-18 is a star of magnitude 9.29 which
was discovered to have a hot Jupiter-like planet (WASP-18b) taking less than a day to orbit the star.
The planet is suspected to be causing WASP-18 to appear older than it really is. WASP-4and WASP-5
are solar-type yellow stars around 1000 light years distant and of 13th magnitude, each with a single
planet larger than Jupiter. WASP-29 is an orange dwarf of spectral type K4V and visual magnitude 11.3,
which has a planetary companion of similar size and mass to Saturn. The planet completes an orbit
every 3.9 days.
questions_and_answers:
- question: In the Phoenix constellation, how many stars have planets?
answer: |
In the Phoenix constellation, ten stars have been found to have
planets to date, and four planetary systems have been discovered
with the SuperWASP project.
- question: |
What is HD 142?
answer: |
HD 142 is a yellow giant that has an apparent magnitude of 5.7, and
has a planet (HD 142 b) 1.36 times the mass of Jupiter which
orbits every 328 days.
- question: |
Are WASP-4 and WASP-5 solar-type yellow stars?
answer: |
Yes, WASP-4 and WASP-5 are solar-type yellow stars around 1000 light
years distant and of 13th magnitude, each with a single planet
larger than Jupiter.
- context: |
The constellation does not lie on the galactic plane of the Milky Way, and there are no prominent star
clusters. NGC 625 is a dwarf irregular galaxy of apparent magnitude 11.0 and lying some 12.7 million
light years distant. Only 24000 light years in diameter, it is an outlying member of the Sculptor Group.
NGC 625 is thought to have been involved in a collision and is experiencing a burst of active star formation.
NGC 37 is a lenticular galaxy of apparent magnitude 14.66. It is approximately 42 kiloparsecs 137,000
light-years in diameter and about 12.9 billion years old. Robert's Quartet composed of the irregular galaxy
NGC 87, and three spiral galaxies NGC 88, NGC 89 and NGC 92 is a group of four galaxies located around 160 million
light-years away which are in the process of colliding and merging. They are within a circle of radius of 1.6 arcmin,
corresponding to about 75,000 light-years. Located in the galaxy ESO 243-49 is HLX-1, an intermediate-mass
black hole—the first one of its kind identified. It is thought to be a remnant of a dwarf galaxy that was absorbed
in a collision with ESO 243-49. Before its discovery, this class of black hole was only hypothesized.
questions_and_answers:
- question: |
Is the Phoenix Constellation part of the Milky Way?
answer: |
The Phoenix constellation does not lie on the galactic plane of
the Milky Way, and there are no prominent star clusters.
- question: |
How many light years away is NGC 625?
answer: |
NGC 625 is 24000 light years in diameter and is an outlying
member of the Sculptor Group.
- question: |
What is Robert's Quartet composed of?
answer: |
Robert's Quartet is composed of the irregular galaxy NGC 87,
and three spiral galaxies NGC 88, NGC 89 and NGC 92.
document:
repo: https://github.com/<profile>/<repo-name> /
commit: <commit hash>
patterns:
- phoenix_constellation.md
- phoenix_history.md
- 1
- ナレッジ
qna.yaml
形式のバージョンを指定します。現在、有効な値は3
です。 - 2
- ドキュメントの件名またはカテゴリーを指定します。たとえば、"Technical Documents" または "Installation Guides" です。
- 3
- ドキュメントの内容の概要を指定します。
document_outline
フィールドのコンテキスト
パラメーターに含める主題を参照することを推奨します。たとえば、ドキュメントがインストールガイドで、各context
にさまざまなクラウドプロバイダーの詳細が含まれている場合、document_outline
は "Installation guides for AWS, GCP, and Azure" になります。 - 4
- 名前または git ユーザー名を指定します。
- 5
- ナレッジデータの段落を指定します。これは、質問と回答のベースとなるコンテンツです。コンテキストブロックの形式は、ナレッジファイルの形式と一致する必要があります。たとえば、ナレッジドキュメントが Markdown 形式である場合は、
context
ブロックも Markdown 形式である必要があります。 - 6
- モデルに対する質問を指定します。問題は、
context
フィールドの情報に基づいている必要があります。たとえば、"What is the latest version of the product?" です。 - 7
- モデルからの望ましい応答を指定します。回答の情報は
context
ブロックからコピーするのではなく、完全な文で含める必要があります。回答は完全な文章にする必要があります。たとえば、"The latest version of the product is version 1.5" です。 - 8
- ナレッジファイルを保持するリポジトリーへの URL を指定します。
- 9
- ナレッジファイルの git リポジトリーからのコミットの SHA を指定します。
- 10
- git リポジトリーでドキュメントを指定します。有効なドキュメントタイプの値には、
.md
または.pdf
が含まれます。1 つのqna.yaml
ファイルは 1 つのドキュメントタイプのみを参照でき、同じqna.yaml
内でファイルタイプを混在させることはサポートされていません。
2.2. ナレッジマークダウンファイルの作成
Red Hat Enterprise Linux AI バージョン 1.5 では、ナレッジドキュメントとデータを git リポジトリーにマークダウン形式でホストする必要があります。標準の git ワークフローを使用して、ファイルを作成し、リポジトリーにアップロードできます。使用できるオープンソースのマークダウン変換ツールは、次のとおりです。
- Pandoc: オープンソースの変換ツール。
- All in One エクステンションを備えた Visual Studio Code: Visual Studio Code でドキュメントを開き、Markdown All in One エクステンション を使用して Markdown に変換できます。
- IBM Deepsearch/Docling: PDF ドキュメントを JSON およびマークダウンに変換する機能を自己完結型パッケージにバンドルします。
手順
- 希望する git ホスティングプラットフォームを選択します。Git と互換性がある限り、RHEL AI ではどのプラットフォームでも使用できます。
ドキュメントを
.md
マークダウン形式に変換します。ナレッジデータには、任意のマークダウン変換ソフトウェアを使用できます。次のリストには、ナレッジマークダウンファイルのガイドラインが含まれています。
- すべてのドキュメントはテキストである必要があります。イメージは現在サポートされていません。
- ドキュメントから脚注を削除します。
- 表はマークダウン形式である必要があります。
- チャートとグラフは現在サポートされていません。
-
ファイル名とコミットハッシュをメモします。この値は
qna.yaml
ファイルで使用されます。 md
ファイルを作成し、git リポジトリーにアップロードします。ナレッジドキュメントのマークダウンの例
Phoenix (constellation)
# Phoenix (constellation) **Phoenix** is a minor constellation in the southern sky. Named after the mythical phoenix, it was first depicted on a celestial atlas by Johann Bayer in his 1603 *Uranometria*. The French explorer and astronomer Nicolas Louis de Lacaille charted the brighter stars and gave their Bayer designations in 1756. The constellation stretches from roughly −39 degrees to −57 degrees declination, and from 23.5h to 2.5h of right ascension. The constellations Phoenix, Grus , Pavo and Tucana, are known as the Southern Birds. The brightest star, Alpha Phoenicis, is named Ankaa, an Arabic word meaning 'the Phoenix'. It is an orange giant of apparent magnitude 2.4. Next is Beta Phoenicis, actually a binary system composed of two yellow giants with a combined apparent magnitude of 3.3. Nu Phoenicis has a dust disk, while the constellation has ten star systems with known planets and the recently discovered galaxy clusters El Gordo and the Phoenix Cluster—located 7.2 and 5.7 billion light years away respectively, two of the largest objects in the visible universe. Phoenix is the radiant of two annual meteor showers: the Phoenicids in December, and the July Phoenicids. ## History Phoenix was the largest of the 12 constellations established by Petrus Plancius from the observations of Pieter Dirkszoon Keyser and Frederick de Houtman. It first appeared on a 35-cm diameter celestial globe published in 1597 (or 1598) in Amsterdam by Plancius with Jodocus Hondius. The first depiction of this constellation in a celestial atlas was in Johann Bayer's*Uranometria* of 1603. De Houtman included it in his southern star catalog the same year under the Dutch name *Den voghel Fenicx*, "The Bird Phoenix", symbolizing the phoenix of classical mythology. One name of the brightest star Alpha Phoenicis—Ankaa—is derived from the Arabic: العنقاء, romanized: al-‘anqā’, lit. 'the phoenix', and was coined sometime after 1800 in relation to the constellation. Celestial historian Richard Allen noted that unlike the other constellations introduced by Plancius and La Caille, Phoenix has actual precedent in ancient astronomy, as the Arabs saw this formation as representing young ostriches, *Al Ri'āl*, or as a griffin or eagle. In addition, the same group of stars was sometimes imagined by the Arabs as a boat, *Al Zaurak*, on the nearby river Eridanus. He observed, "the introduction of a Phoenix into modern astronomy was, in a measure, by adoption rather than by invention." The Chinese incorporated Phoenix's brightest star, Ankaa (Alpha Phoenicis), and stars from the adjacent constellation Sculptor to depict *Bakui*, a net for catching birds. Phoenix and the neighboring constellation of Grus together were seen by Julius Schiller as portraying Aaron the High Priest. These two constellations, along with nearby Pavo and Tucana, are called the Southern Birds. ## Characteristics Phoenix is a small constellation bordered by Fornax and Sculptor to the north, Grus to the west, Tucana to the south, touching on the corner of Hydrus to the south, and Eridanus to the east and southeast. The bright star Achernar is nearby. The three-letter abbreviation for the constellation, as adopted by the International Astronomical Union in 1922, is "Phe". The official constellation boundaries, as set by Belgian astronomer Eugène Delporte in 1930, are defined by a polygon of 10 segments. In the equatorial coordinate system, the right ascension coordinates of these borders lie between 23<sup>h</sup> 26.5<sup>m</sup> and 02<sup>h</sup> 25.0<sup>m</sup>, while the declination coordinates are between −39.31° and −57.84°. This means it remains below the horizon to anyone living north of the 40th parallel in the Northern Hemisphere, and remains low in the sky for anyone living north of the equator. It is most visible from locations such as Australia and South Africa during late Southern Hemisphere spring. Most of the constellation lies within, and can be located by, forming a triangle of the bright stars Achernar, Fomalhaut and Beta Ceti—Ankaa lies roughly in the centre of this.
Copy to Clipboard Copied!
第3章 タクソノミーツリーへのスキルの追加
スターターモデルは、ドメイン固有のスキルを qna.yaml
ファイルに入力することでカスタムスキルを学習できます。スキルの各 qna.yaml
ファイルには、次のキーを持つキー値エントリーのセットが含まれています。
フィールド | 説明 | 制限 |
---|---|---|
|
| このパラメーターで現在サポートされている値は 2 です。 |
| Git ユーザー名またはコントリビューター名。 | なし |
| スキルとその機能の説明。 | なし |
| キーと値のエントリーのコレクションです。 |
各 |
| グラウンディングスキルでは、モデルがスキルを実行するために知っておく必要のある情報など、追加のコンテキストをユーザーが提供する必要があります。 |
このフィールドは、グラウンディングスキルに必須です。各 |
| モデルに対する質問を指定します。 |
各 |
| モデルの回答を指定します。 |
各 |
3.1. スキルの YAML ファイルの作成
タクソノミーツリーをカスタマイズして、モデルが目的のユースケースのスキルを新たに学習できるようにします。次の手順では、スキル qna.yaml
ファイルを含むタクソノミーツリーを作成する方法を示します。
前提条件
- 起動可能なコンテナーイメージを使用して RHEL AI をインストールしている。
-
InstructLab を初期化し、
ilab
CLI を使用できる。 - マシンへの root ユーザーアクセス権がある。
手順
taxonomy ディレクトリーの
compositional_skills
フォルダーに移動します。重要基礎スキル、つまりコード作成を伴うスキルの作成は、現在 RHEL AI バージョン 1.5 ではサポートされていません。
ツリー内に存在するディレクトリーに基づいて、ツリー内で、スキルの
qna.yaml
ファイルの追加先を選択します。タクソノミーツリー内のファイルパスの例
taxonomy/compositional_skills/grounded/<add_example>/qna.yaml
taxonomy/compositional_skills/grounded/<add_example>/qna.yaml
Copy to Clipboard Copied! 任意のテキストエディターを使用して、
qna.yaml
ファイルを作成します。注記SDG を適切に実行するには、
qna.yaml
ファイルに少なくとも 5 つの質問と回答のペアの例を含める必要があります。-
必要なキーを
qna.yaml
ファイルに追加し、変更を保存します。qna.yaml
ファイルのフォーマットの詳細は、「スキル YAML 仕様のサンプル」を参照してください。
検証
スキルが適切な形式であることを確認するには、次のコマンドを実行します。
ilab taxonomy diff
$ ilab taxonomy diff
Copy to Clipboard Copied! CLI には、タクソノミーツリーと
qna.yaml
ファイルが有効であるか、適切にフォーマットされているかが表示されます。CLI では、発生したエラーを修正する場所も表示されます。有効なタクソノミーツリーと
qna.yaml
ファイルの出力例compositional_skills/writing/freeform/<example>/qna.yaml Taxonomy in /taxonomy/ is valid :)
compositional_skills/writing/freeform/<example>/qna.yaml Taxonomy in /taxonomy/ is valid :)
Copy to Clipboard Copied! 無効なタクソノミーツリーとエラーのある
qna.yaml
ファイルの出力例6:11 error syntax error: mapping values are not allowed here (syntax) Reading taxonomy failed with the following error: 1 taxonomy with errors! Exiting.
6:11 error syntax error: mapping values are not allowed here (syntax) Reading taxonomy failed with the following error: 1 taxonomy with errors! Exiting.
Copy to Clipboard Copied!
3.2. スキル YAML 仕様のサンプル
スキルは、ナレッジ YAML ファイルと同様の質問と回答のレイアウトを共有します。RHEL AI では、合成データ生成 (SDG) プロセスは、ユーザーが生成したデータのみに依存するのではなく、qna.yaml
シード例を使用して、モデルが学習するための大量の人工データを作成します。
質問、回答、コンテキストのペアの順序は、SDG またはトレーニングプロセスに影響しません。スキルには複数の種類があり、フリーフォーム、グラウンディング、基礎スキルのカテゴリーに分類されます。各カテゴリーのサンプルは次の例で確認できます。
フリーフォーム構成スキル qna.yaml
ファイルの例
version: 2 created_by: <user-name> task_description: 'Teach the model how to rhyme.' seed_examples: - question: What are 5 words that rhyme with horn? answer: warn, torn, born, thorn, and corn. - question: What are 5 words that rhyme with cat? answer: bat, gnat, rat, vat, and mat. - question: What are 5 words that rhyme with poor? answer: door, shore, core, bore, and tore. - question: What are 5 words that rhyme with bank? answer: tank, rank, prank, sank, and drank. - question: What are 5 words that rhyme with bake? answer: wake, lake, steak, make, and quake.
version: 2
created_by: <user-name>
task_description: 'Teach the model how to rhyme.'
seed_examples:
- question: What are 5 words that rhyme with horn?
answer: warn, torn, born, thorn, and corn.
- question: What are 5 words that rhyme with cat?
answer: bat, gnat, rat, vat, and mat.
- question: What are 5 words that rhyme with poor?
answer: door, shore, core, bore, and tore.
- question: What are 5 words that rhyme with bank?
answer: tank, rank, prank, sank, and drank.
- question: What are 5 words that rhyme with bake?
answer: wake, lake, steak, make, and quake.
グラウンディング構成スキルの qna.yaml
ファイルの例
version: 2 created_by: <user-name> task_description: This skill provides the ability to read a markdown-formatted table. seed_examples: - context: | | **Breed** | **Size** | **Barking** | **Energy** | |----------------|--------------|-------------|------------| | Afghan Hound | 25-27 in | 3/5 | 4/5 | | Labrador | 22.5-24.5 in | 3/5 | 5/5 | | Cocker Spaniel | 14.5-15.5 in | 3/5 | 4/5 | | Poodle (Toy) | <= 10 in | 4/5 | 4/5 | question: | Which breed has the most energy? answer: | The breed with the most energy is the Labrador. - context: | | **Name** | **Date** | **Color** | **Letter** | **Number** | |----------|----------|-----------|------------|------------| | George | Mar 5 | Green | A | 1 | | Gráinne | Dec 31 | Red | B | 2 | | Abigail | Jan 17 | Yellow | C | 3 | | Bhavna | Apr 29 | Purple | D | 4 | | Rémy | Sep 9 | Blue | E | 5 | question: | What is Gráinne's letter and what is her color? answer: | Gráinne's letter is B and her color is red. - context: | | Banana | Apple | Blueberry | Strawberry | |--------|------------|-----------|------------| | Yellow | Red, Green | Blue | Red | | Large | Medium | Small | Small | | Peel | Peel | No peel | No peel | question: | Which fruit is blue, small, and has no peel? answer: | The blueberry is blue, small, and has no peel.
version: 2
created_by: <user-name>
task_description: This skill provides the ability to read a markdown-formatted table.
seed_examples:
- context: |
| **Breed** | **Size** | **Barking** | **Energy** |
|----------------|--------------|-------------|------------|
| Afghan Hound | 25-27 in | 3/5 | 4/5 |
| Labrador | 22.5-24.5 in | 3/5 | 5/5 |
| Cocker Spaniel | 14.5-15.5 in | 3/5 | 4/5 |
| Poodle (Toy) | <= 10 in | 4/5 | 4/5 |
question: |
Which breed has the most energy?
answer: |
The breed with the most energy is the Labrador.
- context: |
| **Name** | **Date** | **Color** | **Letter** | **Number** |
|----------|----------|-----------|------------|------------|
| George | Mar 5 | Green | A | 1 |
| Gráinne | Dec 31 | Red | B | 2 |
| Abigail | Jan 17 | Yellow | C | 3 |
| Bhavna | Apr 29 | Purple | D | 4 |
| Rémy | Sep 9 | Blue | E | 5 |
question: |
What is Gráinne's letter and what is her color?
answer: |
Gráinne's letter is B and her color is red.
- context: |
| Banana | Apple | Blueberry | Strawberry |
|--------|------------|-----------|------------|
| Yellow | Red, Green | Blue | Red |
| Large | Medium | Small | Small |
| Peel | Peel | No peel | No peel |
question: |
Which fruit is blue, small, and has no peel?
answer: |
The blueberry is blue, small, and has no peel.
第4章 モデルのパフォーマンスの最適化のための YAML 作成プラクティス
タクソノミーツリーへのナレッジの追加 および タクソノミーツリーへのスキルの追加 で参照されるガイドラインは、スキルとナレッジ YAML ファイルの作成に関する標準手順を提供します。ただし、生成された合成データを最適化し、より高い品質モデルを作成するために、YAML ファイルを改善する方法もあります。
YAML ファイルの context
フィールドにおける多様で包括的なコンテンツ
各 context
ブロックには、ドキュメントのさまざまな情報と形式を含める必要があります。これにより、モデルは情報を提供するさまざまな方法を学ぶことができます。これらの情報を提供するさまざまな方法には、パラグラフ、さまざまな種類の表、リスト、手順、定義などがあります。
context
ブロックは、ドキュメントの包括的な例である必要があります。context
コンテンツと Q&A ペアの合計の長さは、750 トークンを超えることはできません。
効果的な質問の作成
質問は、モデルが回答できるような質問のタイプに合わせる必要があります。各質問は一意で、context
フィールドの情報を参照する必要があります。完全な文章での質問を含めると、生成される合成データが向上し、モデルの回答品質が向上します。
効果的な回答の作成
回答は、質問に直接答え、モデルが提供できる回答のタイプを反映する必要があります。回答は完全な文章で、元の質問を参照する必要があります。完全な文章での回答を含めると、生成される合成データが向上し、モデルの回答品質が向上します。
回答は、context
ブロックから直接コピーしないでください。直接コピーすると、モデルは推論するのではなく、抽出を学習する可能性があります。
質問に回答するための情報は、context
ブロックにある必要があります。情報が別の context ブロックにあるか、参照されていない場合は、モデルがハルシネーションを起こす可能性があります。
高品質の質問と回答ペアの例
- question: How many eggs are needed to make roughly 24 chocolate chip cookies? answer: You need around two eggs to make 24 chocolate chip cookies.
- question: How many eggs are needed to make roughly 24 chocolate chip cookies?
answer: You need around two eggs to make 24 chocolate chip cookies.
複数のドキュメントまたは複数の qna.yaml
ファイルを使用する場合
複数のドキュメントが同様のサブジェクトまたはドメインに関連する場合は、qna.yaml
ファイル 1 つを使用することが推奨されます。それぞれの qna.yaml
ファイルには単数形のドキュメントタイプが含まれている必要がありますが、YAML ファイルでドキュメントタイプを混在させることはできません。
複数のドキュメントが関連していない場合は、個別の qna.yaml
ファイルを使用することが推奨されます。
YAML ファイルへのリンクの追加
モデルはリンクを記憶できるため、YAML ファイルにリンクを追加できます。ただし、ハイパーリンクが頻繁に変更される場合は、ハイパーリンクを追加しないようにすることを推奨します。