Documentation Index
Fetch the complete documentation index at: https://wb-21fd5541-john-wbdocs-2044-rename-serverless-products.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Serverless RL でモデルをトレーニングすると、そのモデルは自動的に推論で使用できるようになります。
トレーニング済みモデルにリクエストを送信するには、次のものが必要です。
モデルのエンドポイントは、次のスキーマを使用します。
wandb-artifact:///<entity>/<project>/<model-name>:<step>
スキーマは次の要素で構成されます。
- W&B entity (team) の名
- モデルに関連付けられているプロジェクトの名
- トレーニング済みモデルの名
- デプロイしたいモデルのトレーニング step (通常、これはモデルが評価で最も高い性能を示した step です)
たとえば、W&B の team 名が email-specialists、プロジェクト名が mail-search、トレーニング済みモデル名が agent-001 で、step 25 をデプロイしたい場合、エンドポイントは次のようになります。
wandb-artifact:///email-specialists/mail-search/agent-001:step25
エンドポイントを用意したら、通常の推論ワークフローに組み込めます。以下の例では、cURL リクエストまたは Python OpenAI SDK を使用して、トレーニング済みモデルに推論リクエストを送信する方法を示します.
curl https://api.training.wandb.ai/v1/chat/completions \
-H "Authorization: Bearer $WANDB_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "wandb-artifact://<entity>/<project>/<model-name>:<step>",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Summarize our training run."}
],
"temperature": 0.7,
"top_p": 0.95
}'
from openai import OpenAI
WANDB_API_KEY = "your-wandb-api-key"
ENTITY = "my-entity"
PROJECT = "my-project"
client = OpenAI(
base_url="https://api.training.wandb.ai/v1",
api_key=WANDB_API_KEY
)
response = client.chat.completions.create(
model=f"wandb-artifact:///{ENTITY}/{PROJECT}/my-model:step100",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Summarize our training run."},
],
temperature=0.7,
top_p=0.95,
)
print(response.choices[0].message.content)