[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7CQWRJPCTSWHS835RT3YVCG":3,"skill-same:01M7CQWRJPCTSWHS835RT3YVCG":54},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":32,"commitSha":33,"skillDirectory":34,"forksCount":35,"repositoryHtmlUrl":36,"repositoryHomepageUrl":6,"ownerHtmlUrl":37,"ownerBlogUrl":6,"ownerDescription":38,"updatedAt":39,"install":40,"resources":53},"01M7CQWRJPCTSWHS835RT3YVCG","tao-train-rtdetr",null,"RT-DETR (Real-Time DEtection TRansformer) for 2D object detection. Designed for real-time inference with competitive accuracy and supports distillation and quantization for deployment optimization. Use when training, evaluating, distilling, quantizing, exporting, or running inference for a TAO RT-DETR model. Trigger phrases include \"train RT-DETR\", \"real-time DETR\", \"low-latency object detection\", \"RT-DETR distillation \u002F quantization\".","om-scogo\u002Fskillsh-scraper","om-scogo","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F160466840?v=4","01M79AWB6DFVCQ7RK70CS34B96","Om Achrekar","01M79AWB6ZM9SKR8KDH1WSSM22",0,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fom-scogo\u002Fskillsh-scraper\u002Fblob\u002Fmain\u002Fdata\u002Fskills\u002Fnvidia-skills\u002Ftao-train-rtdetr\u002Fskills\u002Ftao-train-rtdetr\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: tao-train-rtdetr\ndescription: RT-DETR (Real-Time DEtection TRansformer) for 2D object detection. Designed for real-time inference with\n  competitive accuracy and supports distillation and quantization for deployment optimization. Use when training, evaluating,\n  distilling, quantizing, exporting, or running inference for a TAO RT-DETR model. Trigger phrases include \"train RT-DETR\",\n  \"real-time DETR\", \"low-latency object detection\", \"RT-DETR distillation \u002F quantization\".\nlicense: Apache-2.0\ncompatibility: Requires docker + nvidia-container-toolkit.\nmetadata:\n  version: \"0.1.0\"\n  author: NVIDIA Corporation\nallowed-tools: Read Bash\ntags:\n- object\n- detection\n---\n\n# RT-DETR\n\nRT-DETR (Real-Time DEtection TRansformer) for 2D object detection. Designed for real-time inference with competitive accuracy. Supports distillation and quantization for deployment optimization.\n\nSet model.pretrained_backbone_path for backbone weights or train.pretrained_model_path for full model.\n\nFor TAO Deploy TensorRT actions (`gen_trt_engine`, TensorRT `evaluate`, and TensorRT `inference`), read `references\u002Ftao-deploy-rtdetr.md` first. Deploy spec templates live in this skill's `references\u002F` folder with the `spec_template_deploy_*.yaml` prefix.\n\n## Dataclass Schemas\n\nGenerated TAO Core schemas are packaged in `schemas\u002F\u003Caction>.schema.json`, with `schemas\u002Fmanifest.json` listing available actions. Each generated schema also emits `references\u002Fspec_template_\u003Caction>.yaml` from the schema top-level `default` field. AutoML enablement is declared at the model layer in `references\u002Fskill_info.yaml` via `automl_enabled`. Runnable AutoML still requires `schemas\u002Ftrain.schema.json` and `references\u002Fspec_template_train.yaml` to exist and parse. Use the packaged train schema for `automl_default_parameters`, `automl_disabled_parameters`, defaults, min\u002Fmax bounds, enums, option weights, math conditions, dependencies, and popular parameters. Do not expect `~\u002Ftao-core` at runtime; maintainers regenerate schemas\u002Ftemplates before packaging the skill bank.\n\n## Train Action Policy\n\nThis model is AutoML-enabled at the model layer. Before handling any train-stage request, read `references\u002Fskill_info.yaml` and resolve the run override from either an explicit `automl_policy` value or the user's workflow request. Use `automl_policy: on` by default and only expose `on` \u002F `off` in new launch prompts. Treat phrases like \"turn off AutoML\", \"disable AutoML\", \"no HPO\", or \"plain training\" as `automl_policy: off` for this run only. When `automl_policy: on`, `automl_enabled: true`, and both `schemas\u002Ftrain.schema.json` and `references\u002Fspec_template_train.yaml` are packaged, route the train action through `tao-skill-bank:tao-run-automl` by default with this model's `skill_dir`. Preserve workflow\u002Fapplication overrides for datasets, specs, output directories, GPU\u002Fplatform settings, parent checkpoints, and `automl_policy`. Use direct model training only when `automl_policy: off` or the packaged train schema\u002Ftemplate is missing; in the missing-schema case, report that AutoML is enabled but not runnable for this model until schemas are generated.\n\nNon-train actions such as `evaluate`, `inference`, `export`, and deploy flows stay in this model skill. The per-run `automl_policy` override does not change model metadata.\n\n## Supported Actions\n\nThe packaged RT-DETR PyT CLI supports `train`, `distill`, `quantize`, `evaluate`, `export`, `inference`, and `default_specs`. This model skill exposes `train`, `distill`, `quantize`, `evaluate`, `export`, and `inference`; resume\u002Fretrain is performed through `train` with `train.resume_training_checkpoint_path`.\n\nThe parent PyT CLI does not expose `gen_trt_engine`. Use `models\u002Frtdetr\u002Fdeploy` for TensorRT engine generation, TensorRT evaluation, and TensorRT inference.\n\n## Training Requirements\n\n- **Dataset type:** object_detection\n- **Formats:** coco, coco_raw\n- **Monitoring metric:** mAP50 for quick operational checks; `val_mAP` for COCO\u002Fpaper-style benchmark comparisons.\n\n### Per-Action Dataset Requirements\n\n| Action | Spec Key | Source | Files | List? |\n|---|---|---|---|---|\n| distill | dataset.train_data_sources | train_datasets | image_dir: images.tar.gz, json_file: annotations.json | Yes |\n| distill | dataset.val_data_sources | eval_dataset | image_dir: images.tar.gz, json_file: annotations.json | No |\n| evaluate | dataset.test_data_sources | eval_dataset | image_dir: images.tar.gz, json_file: annotations.json | No |\n| inference | dataset.infer_data_sources | inference_dataset | image_dir: images.tar.gz, classmap: label_map.txt | Yes |\n| quantize | dataset.train_data_sources | train_datasets | image_dir: images.tar.gz, json_file: annotations.json | Yes |\n| quantize | dataset.val_data_sources | eval_dataset | image_dir: images.tar.gz, json_file: annotations.json | No |\n| quantize | dataset.quant_calibration_data_sources | train_datasets | image_dir: images.tar.gz, json_file: annotations.json | No |\n| train | dataset.train_data_sources | train_datasets | image_dir: images.tar.gz, json_file: annotations.json | Yes |\n| train | dataset.val_data_sources | eval_dataset | image_dir: images.tar.gz, json_file: annotations.json | No |\n\n### Typical Spec Overrides\n\nData source overrides are **mandatory for every action** — the agent MUST construct data source paths from the Per-Action Dataset Requirements table above and include them in `spec_overrides`.\n\n```python\nS3_TRAIN = \"s3:\u002F\u002Fbucket\u002Fdata\u002Ftrain\"\nS3_EVAL = \"s3:\u002F\u002Fbucket\u002Fdata\u002Feval\"\nCHECKPOINT = \"\u002Fresults\u002F{train_job_id}\u002Fresults_dir\u002Fmodel_epoch_000.pth\"\nONNX_FILE = \"\u002Fresults\u002F{export_job_id}\u002Fresults_dir\u002Frtdetr.onnx\"\n```\n\n**train (mandatory data sources):**\n```python\n{\n    \"train.num_epochs\": 10,\n    \"train.checkpoint_interval\": 10,\n    \"train.validation_interval\": 10,\n    \"train.num_gpus\": 1,\n    \"train.gpu_ids\": [0],\n    \"dataset.num_classes\": \"\u003Cnum_classes> + 1\",\n    \"dataset.train_data_sources\": [{\"image_dir\": f\"{S3_TRAIN}\u002Fimages.tar.gz\", \"json_file\": f\"{S3_TRAIN}\u002Fannotations.json\"}],\n    \"dataset.val_data_sources\": {\"image_dir\": f\"{S3_EVAL}\u002Fimages.tar.gz\", \"json_file\": f\"{S3_EVAL}\u002Fannotations.json\"},\n}\n```\n\n**resume train (mandatory checkpoint):**\n```python\n{\n    \"train.num_epochs\": 11,\n    \"train.resume_training_checkpoint_path\": CHECKPOINT,\n    \"dataset.num_classes\": \"\u003Cnum_classes> + 1\",\n    \"dataset.eval_class_ids\": [1, 2, 3, 4],\n    \"dataset.train_data_sources\": [{\"image_dir\": f\"{S3_TRAIN}\u002Fimages.tar.gz\", \"json_file\": f\"{S3_TRAIN}\u002Fannotations.json\"}],\n    \"dataset.val_data_sources\": {\"image_dir\": f\"{S3_EVAL}\u002Fimages.tar.gz\", \"json_file\": f\"{S3_EVAL}\u002Fannotations.json\"},\n}\n```\n\n**evaluate (mandatory data sources and checkpoint):**\n```python\n{\n    \"dataset.num_classes\": \"\u003Cnum_classes> + 1\",\n    \"dataset.eval_class_ids\": [1, 2, 3, 4],\n    \"dataset.test_data_sources\": {\"image_dir\": f\"{S3_EVAL}\u002Fimages.tar.gz\", \"json_file\": f\"{S3_EVAL}\u002Fannotations.json\"},\n    \"evaluate.checkpoint\": CHECKPOINT,\n}\n```\n\n**export (mandatory checkpoint and output):**\n```python\n{\n    \"dataset.num_classes\": \"\u003Cnum_classes> + 1\",\n    \"export.checkpoint\": CHECKPOINT,\n    \"export.onnx_file\": ONNX_FILE,\n    \"export.input_height\": 640,\n    \"export.input_width\": 640,\n}\n```\n\n**quantize (mandatory data sources):**\n```python\n{\n    \"dataset.num_classes\": \"\u003Cnum_classes> + 1\",\n    \"quantize.layers\": [\n        {\n            \"module_name\": \"*\",\n            \"weights\": {\n                \"dtype\": \"float8_e4m3fn\"\n            },\n            \"activations\": {\n                \"dtype\": \"float8_e4m3fn\"\n            }\n        }\n    ],\n    \"dataset.train_data_sources\": [{\"image_dir\": f\"{S3_TRAIN}\u002Fimages.tar.gz\", \"json_file\": f\"{S3_TRAIN}\u002Fannotations.json\"}],\n    \"dataset.val_data_sources\": {\"image_dir\": f\"{S3_EVAL}\u002Fimages.tar.gz\", \"json_file\": f\"{S3_EVAL}\u002Fannotations.json\"},\n    \"dataset.quant_calibration_data_sources\": {\"image_dir\": f\"{S3_TRAIN}\u002Fimages.tar.gz\", \"json_file\": f\"{S3_TRAIN}\u002Fannotations.json\"},\n    \"quantize.model_path\": CHECKPOINT,\n}\n```\n\n**inference (mandatory data sources and checkpoint):**\n```python\n{\n    \"dataset.num_classes\": \"\u003Cnum_classes> + 1\",\n    \"dataset.infer_data_sources\": {\"image_dir\": [f\"{S3_EVAL}\u002Fimages.tar.gz\"], \"classmap\": f\"{S3_EVAL}\u002Flabel_map.txt\"},\n    \"inference.checkpoint\": CHECKPOINT,\n}\n```\n\n**distill (mandatory data sources and teacher checkpoint):**\n```python\n{\n    \"dataset.train_data_sources\": [{\"image_dir\": f\"{S3_TRAIN}\u002Fimages.tar.gz\", \"json_file\": f\"{S3_TRAIN}\u002Fannotations.json\"}],\n    \"dataset.val_data_sources\": {\"image_dir\": f\"{S3_EVAL}\u002Fimages.tar.gz\", \"json_file\": f\"{S3_EVAL}\u002Fannotations.json\"},\n    \"distill.pretrained_teacher_model_path\": CHECKPOINT,\n}\n```\n## Eval Dataset\n\nOptional. Provides validation mAP at each checkpoint if supplied.\n\n## Important Parameters\n\n- **dataset.num_classes**: Number of classes. Default 80 (MSCOCO 80-class). Must match your dataset annotations.\n- **model.backbone**: Default resnet_50. Supported: ResNet variants, ConvNeXt, FAN, EfficientViT. RT-DETR is optimized for real-time with lighter backbones.\n- **train.optim.lr**: Learning rate. Default 1e-4 (lower than DINO's 2e-4). lr_backbone defaults to 1e-5.\n- **dataset.augmentation.train_spatial_size**: Training input size. Default [640, 640]. Smaller than DINO's multi-scale (up to 1333). Key to RT-DETR's speed.\n- **model.num_feature_levels**: Default 3 (vs DINO's 4). return_interm_indices is [1,2,3].\n- **train.enable_ema**: Exponential moving average. Default False. Enable for potentially smoother convergence.\n- **dataset.remap_mscoco_category**: Default False. Set True only for original MSCOCO dataset with 91-to-80 category ID remapping.\n\n## Multi-GPU \u002F Multi-Node\n\n**Launch method:** `torchrun` (LIGHTNING_EXCLUDED_NETWORK). The entrypoint runs `torchrun --nnodes=N --nproc-per-node=M train.py`, NOT plain `python`.\n\n| Spec Key | Description | Default |\n|----------|-------------|---------|\n| `train.num_gpus` | Number of GPUs per node | 1 |\n| `train.gpu_ids` | GPU device indices | [0] |\n| `train.num_nodes` | Number of nodes | 1 |\n| `train.distributed_strategy` | `ddp` or `fsdp` | `ddp` |\n\n- When increasing `train.num_gpus`, also set `train.gpu_ids` to the same\n  visible device range. For example, an 8-GPU single-node Slurm run must\n  include both `\"train.num_gpus\": 8` and\n  `\"train.gpu_ids\": [0, 1, 2, 3, 4, 5, 6, 7]`.\n- `CUDA_VISIBLE_DEVICES` is explicitly set (unlike Lightning-managed models which use `TAO_VISIBLE_DEVICES`)\n- `ddp` with activation checkpointing: `find_unused_parameters=False`\n- `ddp` without: `find_unused_parameters=True`\n- `fsdp` supported, forces FP16\n\n**Multi-node env vars** (set by orchestrator):\n\n| Variable | Purpose |\n|----------|---------|\n| `WORLD_SIZE` | Number of nodes (triggers multinode mode) |\n| `NODE_RANK` | This node's rank (0-indexed) |\n| `MASTER_ADDR` | Rank-0 node IP |\n| `MASTER_PORT` | Rank-0 port (default 29500) |\n| `NUM_GPU_PER_NODE` | GPUs per node (default: all visible) |\n\n**CRITICAL:** `NODE_RANK` is copied to `RANK` if `RANK` is unset. This is required for torchrun multinode.\n\n## Export \u002F TRT Defaults\n\n- Export input: 640x640, opset 17\n- TRT data types: FP32, FP16, INT8\n- TRT workspace: 1024 MB\n- TRT max_batch_size: 4\n\n## Distillation\n\nRT-DETR supports knowledge distillation with a teacher model. Requires `distill` action with `distill.pretrained_teacher_model_path` and a distillation binding configuration.\n\nUse the packaged `references\u002Fspec_template_distill.yaml` as the starting point. The validated default binding uses the RT-DETR distiller's explicit IOU feature path:\n\n```yaml\ndistill:\n  bindings:\n  - student_module_name: srcs\n    teacher_module_name: srcs\n    criterion: IOU\n    weight: 1.0\n```\n\nDo not substitute DINO-style output names such as `pred_logits` \u002F `pred_boxes`, and do not bind arbitrary decoder heads unless you have verified the module returns captured feature lists. The RT-DETR distiller asserts that IOU bindings must use `srcs` or `dsrcs`.\n\n## Hardware\n\nMinimum 1 GPU(s), recommended 2 GPU(s). 16GB+ (V100 or A100) VRAM per GPU. RT-DETR is more memory-efficient than DINO\u002FGDINO due to smaller input size (640x640) and fewer feature levels. Trains well on single GPU for small-medium datasets.\n\n## Error Patterns\n\n**CUDA out of memory**: Reduce batch_size. RT-DETR at 640x640 is lighter than DINO at 1333px, but batch_size > 8 may still OOM on 16GB GPUs.\n\n**num_classes mismatch**: RT-DETR defaults to 80 (not 91 like DINO). Ensure dataset.num_classes matches your annotation categories.\n\n**CUDA index assert from category IDs**: If COCO category IDs are one-based or otherwise not remapped to zero-based contiguous IDs, set `dataset.num_classes` to `max(category_id) + 1` and keep `dataset.eval_class_ids` aligned to the actual category IDs. For the packaged four-class S3 sample with IDs 1-4, use `dataset.num_classes: 5` and `dataset.eval_class_ids: [1, 2, 3, 4]`.\n\n**return_interm_indices vs num_feature_levels**: Default is [1,2,3] with num_feature_levels=3. Must be consistent if changed.\n\n**Export shape mismatch**: Keep RT-DETR export and deploy consumer input size at\nthe validated `640x640` default unless the model has been trained and checked\nfor a different shape. The older packaged `960x544` template shape can fail\nduring ONNX tracing with `The size of tensor a (...) must match the size of\ntensor b (...)` in `hybrid_encoder.py` positional embedding addition.\n\n**AutoML metric extraction**: RT-DETR emits detection metrics in structured training status and logs. For COCO\u002Fpaper-style benchmark comparisons, optimize `val_mAP` with `direction: maximize`; for explicit AP50 workflows, optimize `mAP50`. Prefer `results_dir\u002Ftrain\u002Fstatus.json` or AutoML result state before parsing raw logs. Do not optimize `val_loss` for default detection model invocations.\n\n**Checkpoint handoff**: For evaluate\u002Fexport\u002Finference\u002Fquantize\u002Fdistill\u002Fresume, use the checkpoint resolver on the best AutoML child job's `results_dir\u002Ftrain\u002F` folder and select the action-appropriate `model_epoch_*.pth` checkpoint. RT-DETR may also write a latest symlink, but that should only be used when a caller explicitly requests latest. Keep `dataset.num_classes`, `dataset.eval_class_ids`, `model.num_queries`, and `model.num_select` consistent with training.\n\n**Parent `rtdetr gen_trt_engine` rejected by the PyT CLI**: In the validated 7.0.0 PyT container, `rtdetr gen_trt_engine` is not a valid parent-model subtask. Use the RT-DETR deploy workflow (`references\u002Ftao-deploy-rtdetr.md`) for TensorRT engine generation, TensorRT evaluation, and TensorRT inference.\n\n## Spec Param \u002F Parent Model Inference\n\nModel-specific inference mappings belong in this MD file, not in `config.json`. Generated runners should read this section and apply the mappings with SDK helpers before `create_job()`. This mirrors the old microservices `infer_params.py` flow.\n\nInference mappings from TAO Core `rtdetr.config.json`:\n\n| Action | Spec Field | Inference Function | Meaning |\n|---|---|---|---|\n| distill | `distill.pretrained_teacher_model_path` | `parent_model` | model file inferred from the parent job results folder |\n| distill | `encryption_key` | `key` | encryption key |\n| distill | `results_dir` | `output_dir` | current job results directory |\n| evaluate | `encryption_key` | `key` | encryption key |\n| evaluate | `evaluate.checkpoint` | `parent_model` | model file inferred from the parent job results folder |\n| evaluate | `evaluate.trt_engine` | `parent_model` | model file inferred from the parent job results folder |\n| evaluate | `results_dir` | `output_dir` | current job results directory |\n| export | `encryption_key` | `key` | encryption key |\n| export | `export.checkpoint` | `parent_model` | model file inferred from the parent job results folder |\n| export | `export.onnx_file` | `create_onnx_file` | output ONNX path |\n| export | `results_dir` | `output_dir` | current job results directory |\n| inference | `encryption_key` | `key` | encryption key |\n| inference | `inference.checkpoint` | `parent_model` | model file inferred from the parent job results folder |\n| inference | `inference.trt_engine` | `parent_model` | model file inferred from the parent job results folder |\n| inference | `results_dir` | `output_dir` | current job results directory |\n| quantize | `encryption_key` | `key` | encryption key |\n| quantize | `quantize.model_path` | `parent_model` | model file inferred from the parent job results folder |\n| quantize | `results_dir` | `output_dir` | current job results directory |\n| train | `encryption_key` | `key` | encryption key |\n| train | `model.pretrained_backbone_path` | `ptm_if_no_resume_model` | PTM when no resume checkpoint exists |\n| train | `results_dir` | `output_dir` | current job results directory |\n| train | `train.pretrained_model_path` | `ptm_if_no_resume_model` | PTM when no resume checkpoint exists |\n| train | `train.resume_training_checkpoint_path` | `resume_model` | model file inferred from the current job results folder |\n\nFor `parent_model` or `parent_model_folder`, pass the upstream train\u002Fexport\u002FAutoML child job id as `parent_job_id`. The SDK lists the parent result folder, filters checkpoint artifacts, and returns the selected model file or folder. Do not add these mappings back to `config.json` and do not patch generated runner scripts to guess checkpoint paths.\n\n## Deployment\n\n- [tao-deploy-rtdetr](references\u002Ftao-deploy-rtdetr.md)\n","# RT-DETR\n\nRT-DETR (Real-Time DEtection TRansformer) for 2D object detection. Designed for real-time inference with competitive accuracy. Supports distillation and quantization for deployment optimization.\n\nSet model.pretrained_backbone_path for backbone weights or train.pretrained_model_path for full model.\n\nFor TAO Deploy TensorRT actions (`gen_trt_engine`, TensorRT `evaluate`, and TensorRT `inference`), read `references\u002Ftao-deploy-rtdetr.md` first. Deploy spec templates live in this skill's `references\u002F` folder with the `spec_template_deploy_*.yaml` prefix.\n\n## Dataclass Schemas\n\nGenerated TAO Core schemas are packaged in `schemas\u002F\u003Caction>.schema.json`, with `schemas\u002Fmanifest.json` listing available actions. Each generated schema also emits `references\u002Fspec_template_\u003Caction>.yaml` from the schema top-level `default` field. AutoML enablement is declared at the model layer in `references\u002Fskill_info.yaml` via `automl_enabled`. Runnable AutoML still requires `schemas\u002Ftrain.schema.json` and `references\u002Fspec_template_train.yaml` to exist and parse. Use the packaged train schema for `automl_default_parameters`, `automl_disabled_parameters`, defaults, min\u002Fmax bounds, enums, option weights, math conditions, dependencies, and popular parameters. Do not expect `~\u002Ftao-core` at runtime; maintainers regenerate schemas\u002Ftemplates before packaging the skill bank.\n\n## Train Action Policy\n\nThis model is AutoML-enabled at the model layer. Before handling any train-stage request, read `references\u002Fskill_info.yaml` and resolve the run override from either an explicit `automl_policy` value or the user's workflow request. Use `automl_policy: on` by default and only expose `on` \u002F `off` in new launch prompts. Treat phrases like \"turn off AutoML\", \"disable AutoML\", \"no HPO\", or \"plain training\" as `automl_policy: off` for this run only. When `automl_policy: on`, `automl_enabled: true`, and both `schemas\u002Ftrain.schema.json` and `references\u002Fspec_template_train.yaml` are packaged, route the train action through `tao-skill-bank:tao-run-automl` by default with this model's `skill_dir`. Preserve workflow\u002Fapplication overrides for datasets, specs, output directories, GPU\u002Fplatform settings, parent checkpoints, and `automl_policy`. Use direct model training only when `automl_policy: off` or the packaged train schema\u002Ftemplate is missing; in the missing-schema case, report that AutoML is enabled but not runnable for this model until schemas are generated.\n\nNon-train actions such as `evaluate`, `inference`, `export`, and deploy flows stay in this model skill. The per-run `automl_policy` override does not change model metadata.\n\n## Supported Actions\n\nThe packaged RT-DETR PyT CLI supports `train`, `distill`, `quantize`, `evaluate`, `export`, `inference`, and `default_specs`. This model skill exposes `train`, `distill`, `quantize`, `evaluate`, `export`, and `inference`; resume\u002Fretrain is performed through `train` with `train.resume_training_checkpoint_path`.\n\nThe parent PyT CLI does not expose `gen_trt_engine`. Use `models\u002Frtdetr\u002Fdeploy` for TensorRT engine generation, TensorRT evaluation, and TensorRT inference.\n\n## Training Requirements\n\n- **Dataset type:** object_detection\n- **Formats:** coco, coco_raw\n- **Monitoring metric:** mAP50 for quick operational checks; `val_mAP` for COCO\u002Fpaper-style benchmark comparisons.\n\n### Per-Action Dataset Requirements\n\n| Action | Spec Key | Source | Files | List? |\n|---|---|---|---|---|\n| distill | dataset.train_data_sources | train_datasets | image_dir: images.tar.gz, json_file: annotations.json | Yes |\n| distill | dataset.val_data_sources | eval_dataset | image_dir: images.tar.gz, json_file: annotations.json | No |\n| evaluate | dataset.test_data_sources | eval_dataset | image_dir: images.tar.gz, json_file: annotations.json | No |\n| inference | dataset.infer_data_sources | inference_dataset | image_dir: images.tar.gz, classmap: label_map.txt | Yes |\n| quantize | dataset.train_data_sources | train_datasets | image_dir: images.tar.gz, json_file: annotations.json | Yes |\n| quantize | dataset.val_data_sources | eval_dataset | image_dir: images.tar.gz, json_file: annotations.json | No |\n| quantize | dataset.quant_calibration_data_sources | train_datasets | image_dir: images.tar.gz, json_file: annotations.json | No |\n| train | dataset.train_data_sources | train_datasets | image_dir: images.tar.gz, json_file: annotations.json | Yes |\n| train | dataset.val_data_sources | eval_dataset | image_dir: images.tar.gz, json_file: annotations.json | No |\n\n### Typical Spec Overrides\n\nData source overrides are **mandatory for every action** — the agent MUST construct data source paths from the Per-Action Dataset Requirements table above and include them in `spec_overrides`.\n\n```python\nS3_TRAIN = \"s3:\u002F\u002Fbucket\u002Fdata\u002Ftrain\"\nS3_EVAL = \"s3:\u002F\u002Fbucket\u002Fdata\u002Feval\"\nCHECKPOINT = \"\u002Fresults\u002F{train_job_id}\u002Fresults_dir\u002Fmodel_epoch_000.pth\"\nONNX_FILE = \"\u002Fresults\u002F{export_job_id}\u002Fresults_dir\u002Frtdetr.onnx\"\n```\n\n**train (mandatory data sources):**\n```python\n{\n    \"train.num_epochs\": 10,\n    \"train.checkpoint_interval\": 10,\n    \"train.validation_interval\": 10,\n    \"train.num_gpus\": 1,\n    \"train.gpu_ids\": [0],\n    \"dataset.num_classes\": \"\u003Cnum_classes> + 1\",\n    \"dataset.train_data_sources\": [{\"image_dir\": f\"{S3_TRAIN}\u002Fimages.tar.gz\", \"json_file\": f\"{S3_TRAIN}\u002Fannotations.json\"}],\n    \"dataset.val_data_sources\": {\"image_dir\": f\"{S3_EVAL}\u002Fimages.tar.gz\", \"json_file\": f\"{S3_EVAL}\u002Fannotations.json\"},\n}\n```\n\n**resume train (mandatory checkpoint):**\n```python\n{\n    \"train.num_epochs\": 11,\n    \"train.resume_training_checkpoint_path\": CHECKPOINT,\n    \"dataset.num_classes\": \"\u003Cnum_classes> + 1\",\n    \"dataset.eval_class_ids\": [1, 2, 3, 4],\n    \"dataset.train_data_sources\": [{\"image_dir\": f\"{S3_TRAIN}\u002Fimages.tar.gz\", \"json_file\": f\"{S3_TRAIN}\u002Fannotations.json\"}],\n    \"dataset.val_data_sources\": {\"image_dir\": f\"{S3_EVAL}\u002Fimages.tar.gz\", \"json_file\": f\"{S3_EVAL}\u002Fannotations.json\"},\n}\n```\n\n**evaluate (mandatory data sources and checkpoint):**\n```python\n{\n    \"dataset.num_classes\": \"\u003Cnum_classes> + 1\",\n    \"dataset.eval_class_ids\": [1, 2, 3, 4],\n    \"dataset.test_data_sources\": {\"image_dir\": f\"{S3_EVAL}\u002Fimages.tar.gz\", \"json_file\": f\"{S3_EVAL}\u002Fannotations.json\"},\n    \"evaluate.checkpoint\": CHECKPOINT,\n}\n```\n\n**export (mandatory checkpoint and output):**\n```python\n{\n    \"dataset.num_classes\": \"\u003Cnum_classes> + 1\",\n    \"export.checkpoint\": CHECKPOINT,\n    \"export.onnx_file\": ONNX_FILE,\n    \"export.input_height\": 640,\n    \"export.input_width\": 640,\n}\n```\n\n**quantize (mandatory data sources):**\n```python\n{\n    \"dataset.num_classes\": \"\u003Cnum_classes> + 1\",\n    \"quantize.layers\": [\n        {\n            \"module_name\": \"*\",\n            \"weights\": {\n                \"dtype\": \"float8_e4m3fn\"\n            },\n            \"activations\": {\n                \"dtype\": \"float8_e4m3fn\"\n            }\n        }\n    ],\n    \"dataset.train_data_sources\": [{\"image_dir\": f\"{S3_TRAIN}\u002Fimages.tar.gz\", \"json_file\": f\"{S3_TRAIN}\u002Fannotations.json\"}],\n    \"dataset.val_data_sources\": {\"image_dir\": f\"{S3_EVAL}\u002Fimages.tar.gz\", \"json_file\": f\"{S3_EVAL}\u002Fannotations.json\"},\n    \"dataset.quant_calibration_data_sources\": {\"image_dir\": f\"{S3_TRAIN}\u002Fimages.tar.gz\", \"json_file\": f\"{S3_TRAIN}\u002Fannotations.json\"},\n    \"quantize.model_path\": CHECKPOINT,\n}\n```\n\n**inference (mandatory data sources and checkpoint):**\n```python\n{\n    \"dataset.num_classes\": \"\u003Cnum_classes> + 1\",\n    \"dataset.infer_data_sources\": {\"image_dir\": [f\"{S3_EVAL}\u002Fimages.tar.gz\"], \"classmap\": f\"{S3_EVAL}\u002Flabel_map.txt\"},\n    \"inference.checkpoint\": CHECKPOINT,\n}\n```\n\n**distill (mandatory data sources and teacher checkpoint):**\n```python\n{\n    \"dataset.train_data_sources\": [{\"image_dir\": f\"{S3_TRAIN}\u002Fimages.tar.gz\", \"json_file\": f\"{S3_TRAIN}\u002Fannotations.json\"}],\n    \"dataset.val_data_sources\": {\"image_dir\": f\"{S3_EVAL}\u002Fimages.tar.gz\", \"json_file\": f\"{S3_EVAL}\u002Fannotations.json\"},\n    \"distill.pretrained_teacher_model_path\": CHECKPOINT,\n}\n```\n## Eval Dataset\n\nOptional. Provides validation mAP at each checkpoint if supplied.\n\n## Important Parameters\n\n- **dataset.num_classes**: Number of classes. Default 80 (MSCOCO 80-class). Must match your dataset annotations.\n- **model.backbone**: Default resnet_50. Supported: ResNet variants, ConvNeXt, FAN, EfficientViT. RT-DETR is optimized for real-time with lighter backbones.\n- **train.optim.lr**: Learning rate. Default 1e-4 (lower than DINO's 2e-4). lr_backbone defaults to 1e-5.\n- **dataset.augmentation.train_spatial_size**: Training input size. Default [640, 640]. Smaller than DINO's multi-scale (up to 1333). Key to RT-DETR's speed.\n- **model.num_feature_levels**: Default 3 (vs DINO's 4). return_interm_indices is [1,2,3].\n- **train.enable_ema**: Exponential moving average. Default False. Enable for potentially smoother convergence.\n- **dataset.remap_mscoco_category**: Default False. Set True only for original MSCOCO dataset with 91-to-80 category ID remapping.\n\n## Multi-GPU \u002F Multi-Node\n\n**Launch method:** `torchrun` (LIGHTNING_EXCLUDED_NETWORK). The entrypoint runs `torchrun --nnodes=N --nproc-per-node=M train.py`, NOT plain `python`.\n\n| Spec Key | Description | Default |\n|----------|-------------|---------|\n| `train.num_gpus` | Number of GPUs per node | 1 |\n| `train.gpu_ids` | GPU device indices | [0] |\n| `train.num_nodes` | Number of nodes | 1 |\n| `train.distributed_strategy` | `ddp` or `fsdp` | `ddp` |\n\n- When increasing `train.num_gpus`, also set `train.gpu_ids` to the same\n  visible device range. For example, an 8-GPU single-node Slurm run must\n  include both `\"train.num_gpus\": 8` and\n  `\"train.gpu_ids\": [0, 1, 2, 3, 4, 5, 6, 7]`.\n- `CUDA_VISIBLE_DEVICES` is explicitly set (unlike Lightning-managed models which use `TAO_VISIBLE_DEVICES`)\n- `ddp` with activation checkpointing: `find_unused_parameters=False`\n- `ddp` without: `find_unused_parameters=True`\n- `fsdp` supported, forces FP16\n\n**Multi-node env vars** (set by orchestrator):\n\n| Variable | Purpose |\n|----------|---------|\n| `WORLD_SIZE` | Number of nodes (triggers multinode mode) |\n| `NODE_RANK` | This node's rank (0-indexed) |\n| `MASTER_ADDR` | Rank-0 node IP |\n| `MASTER_PORT` | Rank-0 port (default 29500) |\n| `NUM_GPU_PER_NODE` | GPUs per node (default: all visible) |\n\n**CRITICAL:** `NODE_RANK` is copied to `RANK` if `RANK` is unset. This is required for torchrun multinode.\n\n## Export \u002F TRT Defaults\n\n- Export input: 640x640, opset 17\n- TRT data types: FP32, FP16, INT8\n- TRT workspace: 1024 MB\n- TRT max_batch_size: 4\n\n## Distillation\n\nRT-DETR supports knowledge distillation with a teacher model. Requires `distill` action with `distill.pretrained_teacher_model_path` and a distillation binding configuration.\n\nUse the packaged `references\u002Fspec_template_distill.yaml` as the starting point. The validated default binding uses the RT-DETR distiller's explicit IOU feature path:\n\n```yaml\ndistill:\n  bindings:\n  - student_module_name: srcs\n    teacher_module_name: srcs\n    criterion: IOU\n    weight: 1.0\n```\n\nDo not substitute DINO-style output names such as `pred_logits` \u002F `pred_boxes`, and do not bind arbitrary decoder heads unless you have verified the module returns captured feature lists. The RT-DETR distiller asserts that IOU bindings must use `srcs` or `dsrcs`.\n\n## Hardware\n\nMinimum 1 GPU(s), recommended 2 GPU(s). 16GB+ (V100 or A100) VRAM per GPU. RT-DETR is more memory-efficient than DINO\u002FGDINO due to smaller input size (640x640) and fewer feature levels. Trains well on single GPU for small-medium datasets.\n\n## Error Patterns\n\n**CUDA out of memory**: Reduce batch_size. RT-DETR at 640x640 is lighter than DINO at 1333px, but batch_size > 8 may still OOM on 16GB GPUs.\n\n**num_classes mismatch**: RT-DETR defaults to 80 (not 91 like DINO). Ensure dataset.num_classes matches your annotation categories.\n\n**CUDA index assert from category IDs**: If COCO category IDs are one-based or otherwise not remapped to zero-based contiguous IDs, set `dataset.num_classes` to `max(category_id) + 1` and keep `dataset.eval_class_ids` aligned to the actual category IDs. For the packaged four-class S3 sample with IDs 1-4, use `dataset.num_classes: 5` and `dataset.eval_class_ids: [1, 2, 3, 4]`.\n\n**return_interm_indices vs num_feature_levels**: Default is [1,2,3] with num_feature_levels=3. Must be consistent if changed.\n\n**Export shape mismatch**: Keep RT-DETR export and deploy consumer input size at\nthe validated `640x640` default unless the model has been trained and checked\nfor a different shape. The older packaged `960x544` template shape can fail\nduring ONNX tracing with `The size of tensor a (...) must match the size of\ntensor b (...)` in `hybrid_encoder.py` positional embedding addition.\n\n**AutoML metric extraction**: RT-DETR emits detection metrics in structured training status and logs. For COCO\u002Fpaper-style benchmark comparisons, optimize `val_mAP` with `direction: maximize`; for explicit AP50 workflows, optimize `mAP50`. Prefer `results_dir\u002Ftrain\u002Fstatus.json` or AutoML result state before parsing raw logs. Do not optimize `val_loss` for default detection model invocations.\n\n**Checkpoint handoff**: For evaluate\u002Fexport\u002Finference\u002Fquantize\u002Fdistill\u002Fresume, use the checkpoint resolver on the best AutoML child job's `results_dir\u002Ftrain\u002F` folder and select the action-appropriate `model_epoch_*.pth` checkpoint. RT-DETR may also write a latest symlink, but that should only be used when a caller explicitly requests latest. Keep `dataset.num_classes`, `dataset.eval_class_ids`, `model.num_queries`, and `model.num_select` consistent with training.\n\n**Parent `rtdetr gen_trt_engine` rejected by the PyT CLI**: In the validated 7.0.0 PyT container, `rtdetr gen_trt_engine` is not a valid parent-model subtask. Use the RT-DETR deploy workflow (`references\u002Ftao-deploy-rtdetr.md`) for TensorRT engine generation, TensorRT evaluation, and TensorRT inference.\n\n## Spec Param \u002F Parent Model Inference\n\nModel-specific inference mappings belong in this MD file, not in `config.json`. Generated runners should read this section and apply the mappings with SDK helpers before `create_job()`. This mirrors the old microservices `infer_params.py` flow.\n\nInference mappings from TAO Core `rtdetr.config.json`:\n\n| Action | Spec Field | Inference Function | Meaning |\n|---|---|---|---|\n| distill | `distill.pretrained_teacher_model_path` | `parent_model` | model file inferred from the parent job results folder |\n| distill | `encryption_key` | `key` | encryption key |\n| distill | `results_dir` | `output_dir` | current job results directory |\n| evaluate | `encryption_key` | `key` | encryption key |\n| evaluate | `evaluate.checkpoint` | `parent_model` | model file inferred from the parent job results folder |\n| evaluate | `evaluate.trt_engine` | `parent_model` | model file inferred from the parent job results folder |\n| evaluate | `results_dir` | `output_dir` | current job results directory |\n| export | `encryption_key` | `key` | encryption key |\n| export | `export.checkpoint` | `parent_model` | model file inferred from the parent job results folder |\n| export | `export.onnx_file` | `create_onnx_file` | output ONNX path |\n| export | `results_dir` | `output_dir` | current job results directory |\n| inference | `encryption_key` | `key` | encryption key |\n| inference | `inference.checkpoint` | `parent_model` | model file inferred from the parent job results folder |\n| inference | `inference.trt_engine` | `parent_model` | model file inferred from the parent job results folder |\n| inference | `results_dir` | `output_dir` | current job results directory |\n| quantize | `encryption_key` | `key` | encryption key |\n| quantize | `quantize.model_path` | `parent_model` | model file inferred from the parent job results folder |\n| quantize | `results_dir` | `output_dir` | current job results directory |\n| train | `encryption_key` | `key` | encryption key |\n| train | `model.pretrained_backbone_path` | `ptm_if_no_resume_model` | PTM when no resume checkpoint exists |\n| train | `results_dir` | `output_dir` | current job results directory |\n| train | `train.pretrained_model_path` | `ptm_if_no_resume_model` | PTM when no resume checkpoint exists |\n| train | `train.resume_training_checkpoint_path` | `resume_model` | model file inferred from the current job results folder |\n\nFor `parent_model` or `parent_model_folder`, pass the upstream train\u002Fexport\u002FAutoML child job id as `parent_job_id`. The SDK lists the parent result folder, filters checkpoint artifacts, and returns the selected model file or folder. Do not add these mappings back to `config.json` and do not patch generated runner scripts to guess checkpoint paths.\n\n## Deployment\n\n- [tao-deploy-rtdetr](references\u002Ftao-deploy-rtdetr.md)\n",{"name":5,"tags":24,"license":15,"metadata":27,"description":7,"allowed-tools":30,"compatibility":31},[25,26],"object","detection",{"author":28,"version":29},"NVIDIA Corporation","0.1.0","Read Bash","Requires docker + nvidia-container-toolkit.","main","8859218955d9504cd18b59e7892100718039d3b4","data\u002Fskills\u002Fnvidia-skills\u002Ftao-train-rtdetr\u002Fskills\u002Ftao-train-rtdetr",1,"https:\u002F\u002Fgithub.com\u002Fom-scogo\u002Fskillsh-scraper","https:\u002F\u002Fgithub.com\u002Fom-scogo","SDE-1 @ Scogo ","2026-07-18 12:22:46",{"source":8,"skillName":5,"commands":41,"prompt":51,"zipAvailable":52},[42,45,48],{"tool":43,"command":44},"npx","npx skills add om-scogo\u002Fskillsh-scraper --skill tao-train-rtdetr",{"tool":46,"command":47},"bunx","bunx skills add om-scogo\u002Fskillsh-scraper --skill tao-train-rtdetr",{"tool":49,"command":50},"pnpm","pnpm dlx skills add om-scogo\u002Fskillsh-scraper --skill tao-train-rtdetr","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fom-scogo\u002Fskillsh-scraper\u002Fblob\u002Fmain\u002Fdata\u002Fskills\u002Fnvidia-skills\u002Ftao-train-rtdetr\u002Fskills\u002Ftao-train-rtdetr\u002FSKILL.md",true,[],[55,63,68,75,80,87],{"skillNo":56,"name":57,"nameZh":6,"description":58,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":59,"licenseFileUrl":6,"sourceHtmlUrl":60,"categories":61,"keywords":62,"publishedAt":19},"01M7D6MC9FAAEV4CMNYX8W7JTG","arxiv-search","Search arXiv physics, math, and computer science preprints using natural language queries. Powered by Valyu semantic search.","MIT","https:\u002F\u002Fgithub.com\u002Fom-scogo\u002Fskillsh-scraper\u002Fblob\u002Fmain\u002Fdata\u002Fskills\u002Fyorkeccak-scientific-skills\u002Farxiv-search\u002Fskills\u002Farxiv-search\u002FSKILL.md",[],[],{"skillNo":64,"name":57,"nameZh":6,"description":58,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":59,"licenseFileUrl":6,"sourceHtmlUrl":65,"categories":66,"keywords":67,"publishedAt":19},"01M7D6M85CKKN87TA98VCQV4H7","https:\u002F\u002Fgithub.com\u002Fom-scogo\u002Fskillsh-scraper\u002Fblob\u002Fmain\u002Fdata\u002Fskills\u002Fyorkeccak-scientific-skills\u002Farxiv-search\u002FSkill.md",[],[],{"skillNo":69,"name":70,"nameZh":6,"description":71,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":59,"licenseFileUrl":6,"sourceHtmlUrl":72,"categories":73,"keywords":74,"publishedAt":19},"01M7D4ZTCS4DR3CE4JY06X84T2","working-with-legacy-code","Safely change and test untested codebases using Feathers' \"Working Effectively with Legacy Code\". Use when the user mentions \"legacy code\", \"no tests\", \"untested codebase\", \"how do I test this\", \"seams\", \"characterization tests\", \"golden master\", \"sprout method\", \"afraid to change this code\", \"monster method\", \"dependency breaking\", or \"inherited a messy codebase\". Also trigger when changing code without tests safely, getting a class under test when constructors, statics, or singletons block it, adding features to tangled modules, or planning incremental test coverage for an old codebase. Covers the legacy-code change algorithm, seams, characterization tests, sprout\u002Fwrap, and dependency-breaking techniques. For refactoring code that already has tests, see refactoring-patterns. For day-to-day code quality, see clean-code.","https:\u002F\u002Fgithub.com\u002Fom-scogo\u002Fskillsh-scraper\u002Fblob\u002Fmain\u002Fdata\u002Fskills\u002Fwondelai-skills\u002Fworking-with-legacy-code\u002Fworking-with-legacy-code\u002FSKILL.md",[],[],{"skillNo":76,"name":70,"nameZh":6,"description":71,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":59,"licenseFileUrl":6,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":19},"01M7D4ZHZKJD2RSNGAF63V14P4","https:\u002F\u002Fgithub.com\u002Fom-scogo\u002Fskillsh-scraper\u002Fblob\u002Fmain\u002Fdata\u002Fskills\u002Fwondelai-skills\u002Fworking-with-legacy-code\u002FSkill.md",[],[],{"skillNo":81,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":59,"licenseFileUrl":6,"sourceHtmlUrl":84,"categories":85,"keywords":86,"publishedAt":19},"01M7D4ZB4CJBFW5JE67CPH2QRV","web-typography","Select, pair, and implement typefaces for web projects. Use when the user mentions \"font pairing\", \"which typeface\", \"line height\", \"responsive typography\", \"web font loading\", \"type hierarchy\", \"variable fonts\", \"FOUT\u002FFOIT\", \"typographic scale\", or \"the text is hard to read\". Also trigger when choosing between system fonts and web fonts, optimizing font-loading performance, or designing readable long-form content. Covers readability evaluation, CSS implementation, and performance optimization. For overall UI design systems, see refactoring-ui. For dramatic typographic experiences, see top-design.","https:\u002F\u002Fgithub.com\u002Fom-scogo\u002Fskillsh-scraper\u002Fblob\u002Fmain\u002Fdata\u002Fskills\u002Fwondelai-skills\u002Fweb-typography\u002Fweb-typography\u002FSKILL.md",[],[],{"skillNo":88,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":59,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":19},"01M7D4Z4MVYVY3NMJ18BNV6WNA","https:\u002F\u002Fgithub.com\u002Fom-scogo\u002Fskillsh-scraper\u002Fblob\u002Fmain\u002Fdata\u002Fskills\u002Fwondelai-skills\u002Fweb-typography\u002FSkill.md",[],[]]