Command Palette

Search for a command to run...

Назад к скиллам
скилл № 00308

triton-pytorch-model-repository

Deploy a user's PyTorch model as a working Triton Inference Server endpoint, end to end. Use when the user has a TorchScript .pt file or a PT2 archive (.pt2…

БесплатноБез исполняемых скриптов
NVIDIAот NVIDIA★ 4 269 звёзд на GitHub

Установить triton-pytorch-model-repository в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Об этом скилле

Triton PyTorch Model Repository

When to Use

Trigger on .pt, .pt2, config.pbtxt for a PyTorch model, or a Triton load or inference failure on a PyTorch model. Hand off .onnx to triton-onnx-model-repository and .plan to triton-tensorrt-model-repository. Not for training.

Hard Constraints

  1. No auto-complete. Every input, output, datatype, and shape must be declared in config.pbtxt. Source: pt/model_state.cc, pt2/model_state.cc.
  2. No BF16, no FP8, no UINT16+. Cast to FP16 or FP32, or use the ONNX or TensorRT backend. Source: libtorch_utils.cc. See references/datatypes.md.
  3. PT2 archives are device-baked. CPU export cannot serve on KIND_GPU and vice versa. Re-export to change device. See references/torch-aoti.md.
  4. Misnamed inputs load but produce wrong results. If names match neither forward() nor <name>__<index>, the backend falls back to strict config order. See references/naming.md.
  5. Cache-cleaning parameter is named differently per platform. ENABLE_CACHE_CLEANING on TorchScript, CACHE_CLEANING_ENABLED on PT2. See references/parameters.md.

Platform Form

Form config.pbtxt Model file
TorchScript, C++ runtime platform: "pytorch_libtorch" model.pt
TorchScript, Python runtime backend: "pytorch" + runtime: "model.py" model.pt (the runtime: "model.py" value names the backend's shipped Python runtime, not a user file; if a user authors their own model.py in the version directory it takes priority over model.pt)
AOT Inductor (PT2) backend: "pytorch" + platform: "torch_aoti" model.pt2

Default filenames overridable with default_model_filename.

Deploy TorchScript

Layout:

model_repository/
  <name>/
    config.pbtxt
    1/model.pt

Minimal config.pbtxt:

name: "my_model"
platform: "pytorch_libtorch"
max_batch_size: 8
input  [ { name: "INPUT__0"  data_type: TYPE_FP32 dims: [ 3, 224, 224 ] } ]
output [ { name: "OUTPUT__0" data_type: TYPE_FP32 dims: [ 1000 ] } ]
instance_group [ { kind: KIND_GPU } ]

Launch:

tritonserver --model-repository=/models

--disable-auto-complete-config is optional and only silences the PyTorch backend's "auto-complete not supported" warning at startup. Do not add it when the same model repository also holds ONNX, TensorFlow, or TensorRT models that rely on auto-complete: the flag is server-wide and those models will fail to load.

Deploy PT2

Build the archive with a dynamic batch dim; sample input must have batch > 1 so torch.export does not specialize:

import torch

m = Model().eval()                # add .cuda() for KIND_GPU
sample = (torch.randn(2, 4),)     # one entry per forward() argument; .cuda() each for KIND_GPU
batch = torch.export.Dim("batch", min=1, max=8)
exported = torch.export.export(
    m, sample, dynamic_shapes=({0: batch},)
)
torch._inductor.aoti_compile_and_package(exported, package_path="model.pt2")

Minimal config.pbtxt:

name: "my_model"
backend: "pytorch"
platform: "torch_aoti"
max_batch_size: 8
input  [ { name: "INPUT__0" data_type: TYPE_FP32 dims: [ 4 ] } ]
output [ { name: "OUTPUT__0" data_type: TYPE_FP32 dims: [ 4 ] } ]
instance_group [ { kind: KIND_CPU } ]

Dim("batch", max=N) must be >= max_batch_size. instance_group kind must match the export device.

Build vs Serve Containers

nvcr.io/nvidia/tritonserver:26.10-py3 ships libtorch but no Python torch. Build artifacts in nvcr.io/nvidia/pytorch:26.10-py3 or install torch before building. Match build and serve to 26.10 to avoid opset drift.

Inference (HTTP KFServing v2)

curl -s -X POST -H "Content-Type: application/json" \
  -d '{"inputs":[{"name":"INPUT__0","shape":[1,4],"datatype":"FP32","data":[1,1,1,1]}]}' \
  http://localhost:8000/v2/models/my_model/infer

Large tensors: use the binary tensor extension. See references/config-pbtxt.md.

Debug a Failed Load

Validation order: file exists → input count matches → datatype supported → naming resolves. Fix in order; each later check only runs if earlier ones pass.

Error (server log) Fix
unable to find '/models/<name>/1/model.pt' Place model.pt at 1/ or set default_model_filename.
PyTorch inductor model file "..." is unreachable or inaccessible. Place model.pt2 at 1/.
unsupported datatype TYPE_<X> (TorchScript) See references/datatypes.md. Cast or switch backend.
Unsupported datatype TYPE_<X> ... model instance "<name>_0_0". (PT2) Same recovery; note PT2 wording differs.
configuration expects N inputs, but model expects M inputs. Match input
Полный SKILL.md на GitHub

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

  • BENCHMARK.md
  • evals/evals.json
  • references/config-pbtxt.md
  • references/datatypes.md
  • references/errors.md
  • references/naming.md
  • references/parameters.md
  • references/sequence-batching.md
  • references/torch-aoti.md
  • skill-card.md
  • skill.oms.sig

FAQ

Что делает скилл triton-pytorch-model-repository?

Deploy a user's PyTorch model as a working Triton Inference Server endpoint, end to end. Use when the user has a TorchScript .pt file or a PT2 archive (.pt2 from torch.export + AOT Inductor) and wants it served, wants a config.pbtxt written from scratch, or wants to debug a Triton load or inference failure on a PyTorch model. Use triton-onnx-model-repository for .onnx files and triton-tensorrt-model-repository for .plan engines.

Как установить скилл triton-pytorch-model-repository?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл triton-pytorch-model-repository запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить triton-pytorch-model-repository с