検索
ホームページバックエンド開発Python チュートリアルwatsonxを使用してアプリケーションのすべての「サンプリングパラメータ」または「生成パラメータ」を簡単に設定するにはどうすればよいですか?

How to set simply all “sampling parameters” or “generation parameters” for applications using watsonx?

導入

watsonx.ai LLM にアクセスするユーザーにとってよくある質問は、「サンプリング パラメーターをどのように設定すればよいですか?」というものです。 !

実際、それは非常に簡単です。

サンプリングパラメータ(または生成パラメータ)

  • watsonx.ai インスタンスにアクセスします。

How to set simply all “sampling parameters” or “generation parameters” for applications using watsonx?

  • 「プロンプト ラボを開く」をクリックします。プロンプト ラボに入ったら、いずれかのタブでパラメータ アイコン (図の右端のアイコン) をクリックします。

How to set simply all “sampling parameters” or “generation parameters” for applications using watsonx?

設定されている LLM (以前に使用したもの、またはデフォルトで設定されたもの) を変更できます。

  • パラメータ ダイアログ ボックスが開いたら、必要に応じて設定できます。

How to set simply all “sampling parameters” or “generation parameters” for applications using watsonx?

  • パラメータを設定したら、同じツール アイコン セットで [コードを表示 >] を選択します。

How to set simply all “sampling parameters” or “generation parameters” for applications using watsonx?

インターフェイスは、パラメーターの実装を埋め込む 3 種類のコードを提供します。以下のサンプルとして Curl、Node.js、Python を使用します。

curl "https://us-south.ml.cloud.ibm.com/ml/v1/text/generation?version=2023-05-29" \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H "Authorization: Bearer ${YOUR_ACCESS_TOKEN}" \
  -d '{
  "input": "systemYou are Granite, an AI language model developed by IBM in 2024. You are a cautious assistant. You carefully follow instructions. You are helpful and harmless and you follow ethical guidelines and promote positive behavior.\nassistant",
  "parameters": {
    "decoding_method": "sample",
    "max_new_tokens": 200,
    "min_new_tokens": 100,
    "random_seed": 42,
    "stop_sequences": [],
    "temperature": 0.7,
    "top_k": 50,
    "top_p": 1,
    "repetition_penalty": 1
  },
  "model_id": "ibm/granite-3-8b-instruct",
  "project_id": "the one you get"
}'
export const generateText = async () => {
 const url = "https://us-south.ml.cloud.ibm.com/ml/v1/text/generation?version=2023-05-29";
 const headers = {
  "Accept": "application/json",
  "Content-Type": "application/json",
  "Authorization": "Bearer YOUR_ACCESS_TOKEN"
 };
 const body = {
  input: "systemYou are Granite, an AI language model developed by IBM in 2024. You are a cautious assistant. You carefully follow instructions. You are helpful and harmless and you follow ethical guidelines and promote positive behavior.\nassistant",
  parameters: {
   decoding_method: "sample",
   max_new_tokens: 200,
   min_new_tokens: 100,
   random_seed: 42,
   stop_sequences: [],
   temperature: 0.7,
   top_k: 50,
   top_p: 1,
   repetition_penalty: 1
  },
  model_id: "ibm/granite-3-8b-instruct",
  project_id: "the-one-you-get"
 };

 const response = await fetch(url, {
  headers,
  method: "POST",
  body: JSON.stringify(body)
 });

 if (!response.ok) {
  throw new Error("Non-200 response");
 }

 return await response.json();
}
import requests

url = "https://us-south.ml.cloud.ibm.com/ml/v1/text/generation?version=2023-05-29"

body = {
 "input": """systemYou are Granite, an AI language model developed by IBM in 2024. You are a cautious assistant. You carefully follow instructions. You are helpful and harmless and you follow ethical guidelines and promote positive behavior.
assistant""",
 "parameters": {
  "decoding_method": "sample",
  "max_new_tokens": 200,
  "min_new_tokens": 100,
  "random_seed": 42,
  "temperature": 0.7,
  "top_k": 50,
  "top_p": 1,
  "repetition_penalty": 1
 },
 "model_id": "ibm/granite-3-8b-instruct",
 "project_id": "the-one-you-get"
}

headers = {
 "Accept": "application/json",
 "Content-Type": "application/json",
 "Authorization": "Bearer YOUR_ACCESS_TOKEN"
}

response = requests.post(
 url,
 headers=headers,
 json=body
)

if response.status_code != 200:
 raise Exception("Non-200 response: " + str(response.text))

data = response.json()

開発者が調整する必要がある唯一の情報はアクセス トークンです。

それで、出来上がり?

結論

watsonx.ai プラットフォームを使用すると、アプリケーション開発者は LLM サンプリング パラメーターのセットを非常に簡単に調整できます。

以上がwatsonxを使用してアプリケーションのすべての「サンプリングパラメータ」または「生成パラメータ」を簡単に設定するにはどうすればよいですか?の詳細内容です。詳細については、PHP 中国語 Web サイトの他の関連記事を参照してください。

声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。
Pythonアレイをどのようにスライスしますか?Pythonアレイをどのようにスライスしますか?May 01, 2025 am 12:18 AM

Pythonリストスライスの基本的な構文はリストです[start:stop:step]。 1.STARTは最初の要素インデックス、2。ストップは除外された最初の要素インデックスであり、3.ステップは要素間のステップサイズを決定します。スライスは、データを抽出するためだけでなく、リストを変更および反転させるためにも使用されます。

どのような状況で、リストは配列よりもパフォーマンスが向上しますか?どのような状況で、リストは配列よりもパフォーマンスが向上しますか?May 01, 2025 am 12:06 AM

ListSoutPerformArraysIn:1)ダイナミシジョンアンドフレーケンティオン/削除、2)ストーリングヘテロゼンダタ、および3)メモリ効率の装飾、ButmayhaveslightPerformancostsinceNASOPERATIONS。

PythonアレイをPythonリストに変換するにはどうすればよいですか?PythonアレイをPythonリストに変換するにはどうすればよいですか?May 01, 2025 am 12:05 AM

toconvertapythonarraytoalist、usetheList()constructororageneratorexpression.1)importhearraymoduleandcreateanarray.2)useList(arr)または[xforxinarr] toconvertoalistは、largedatatessを変えることを伴うものです。

Pythonにリストが存在する場合、配列を使用する目的は何ですか?Pythonにリストが存在する場合、配列を使用する目的は何ですか?May 01, 2025 am 12:04 AM

choosearraysoverlistsinperbetterperformance andmemoryeficiencyspecificscenarios.1)largeNumericaldatasets:Araysreducememoryusage.2)パフォーマンス - クリティカル操作:ArraysOfferSpeedBoostsfortsfortsclikeappendedoring.3)タイプリー:Arrayesenforc

リストの要素と配列を繰り返す方法を説明します。リストの要素と配列を繰り返す方法を説明します。May 01, 2025 am 12:01 AM

Pythonでは、ループに使用し、列挙し、包括的なリストを通過することができます。 Javaでは、従来のループを使用し、ループを強化してアレイを通過することができます。 1。Pythonリストトラバーサル方法は、ループ、列挙、およびリスト理解のためのものです。 2。Javaアレイトラバーサル法には、従来のループとループ用の強化が含まれます。

Python Switchステートメントとは何ですか?Python Switchステートメントとは何ですか?Apr 30, 2025 pm 02:08 PM

この記事では、バージョン3.10で導入されたPythonの新しい「マッチ」ステートメントについて説明します。これは、他の言語のスイッチステートメントに相当するものです。コードの読みやすさを向上させ、従来のif-elif-elよりもパフォーマンスの利点を提供します

Pythonの例外グループとは何ですか?Pythonの例外グループとは何ですか?Apr 30, 2025 pm 02:07 PM

Python 3.11の例外グループは、複数の例外を同時に処理することで、同時シナリオと複雑な操作でエラー管理を改善します。

Pythonの関数注釈とは何ですか?Pythonの関数注釈とは何ですか?Apr 30, 2025 pm 02:06 PM

Pythonの関数注釈は、タイプチェック、ドキュメント、およびIDEサポートの関数にメタデータを追加します。それらはコードの読みやすさ、メンテナンスを強化し、API開発、データサイエンス、ライブラリの作成において重要です。

See all articles

ホットAIツール

Undresser.AI Undress

Undresser.AI Undress

リアルなヌード写真を作成する AI 搭載アプリ

AI Clothes Remover

AI Clothes Remover

写真から衣服を削除するオンライン AI ツール。

Undress AI Tool

Undress AI Tool

脱衣画像を無料で

Clothoff.io

Clothoff.io

AI衣類リムーバー

Video Face Swap

Video Face Swap

完全無料の AI 顔交換ツールを使用して、あらゆるビデオの顔を簡単に交換できます。

ホットツール

VSCode Windows 64 ビットのダウンロード

VSCode Windows 64 ビットのダウンロード

Microsoft によって発売された無料で強力な IDE エディター

DVWA

DVWA

Damn Vulnerable Web App (DVWA) は、非常に脆弱な PHP/MySQL Web アプリケーションです。その主な目的は、セキュリティ専門家が法的環境でスキルとツールをテストするのに役立ち、Web 開発者が Web アプリケーションを保護するプロセスをより深く理解できるようにし、教師/生徒が教室環境で Web アプリケーションを教え/学習できるようにすることです。安全。 DVWA の目標は、シンプルでわかりやすいインターフェイスを通じて、さまざまな難易度で最も一般的な Web 脆弱性のいくつかを実践することです。このソフトウェアは、

AtomエディタMac版ダウンロード

AtomエディタMac版ダウンロード

最も人気のあるオープンソースエディター

メモ帳++7.3.1

メモ帳++7.3.1

使いやすく無料のコードエディター

SublimeText3 英語版

SublimeText3 英語版

推奨: Win バージョン、コードプロンプトをサポート!