nvidia-tao/tao-skill-bank/tao-finetune-clip

Claude Code and agent skill by nvidia-tao/tao-skill-bank

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

CLIP vision-language model for image-text retrieval, zero-shot classification, embedding extraction, ONNX

Install

npx vskill@latest install nvidia-tao/tao-skill-bank/tao-finetune-clip

SKILL.md

CLIP

Standalone install? Read CLIP standalone setup and verify the bank checkout before running tao-setup or launching a CLIP action.

Contrastive Language-Image Pre-training model for zero-shot and fine-tuned image classification, image-text retrieval, and embedding extraction. Fine-tuning adapts CLIP's shared image-text embedding space to domain-specific image-caption data.

No default NGC pretrained checkpoint is required for spec construction, but unset checkpoint behavior is action-specific. In the validation-fixes PyTorch image, export.checkpoint: null exports the selected CLIP architecture and may initialize weights when pretrained weights are unavailable. Do not assume inference.checkpoint: null loads pretrained weights: clip inference currently calls the checkpoint loader with None and fails before embedding extraction. For PyTorch inference, checkpoint-backed evaluation/export, resume, and retrain flows, resolve and pass an exact checkpoint from the parent train output. For trusted TAO checkpoints produced by the current run or a known parent job, set TORCH_FORCE_NO_WEIGHTS_ONLY_LOAD=1 on checkpoint-dependent PyTorch actions so PyTorch 2.6 can load the Lightning checkpoint metadata; do not set this for untrusted checkpoints.

Supported actions: train, evaluate, inference, export, gen_trt_engine.

Train Action Policy

This model is AutoML-enabled at the model layer. Before handling any train-stage request, read references/skill_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 / 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/train.schema.json and references/spec_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/application overrides for datasets, specs, output directories, GPU/platform settings, parent checkpoints, and automl_policy. Use direct model training only when automl_policy: off or the packaged train schema/template is missing; in the missing-schema case, report that AutoML is enabled but not runnable for this model until schemas are generated.

The packaged CLIP train schema enables train.optim.vision_lr and train.optim.text_lr as default AutoML search parameters. For smoke tests, keep the search small by using the Bayesian algorithm with two recommendations and narrow LR ranges.

PAS fine-tuning method integration

For every new PAS DEFT run, ask one mutually exclusive question when the user has not already chosen a method:

text
Fine-tuning method: LoRA (default) or full-parameter SFT?

This LoRA-default contract is scoped to PAS. Standalone CLIP training keeps its packaged SFT image and template behavior; it does not default to LoRA. Do not transfer PAS image capabilities or this selection table to standalone CLIP.

PAS methodEnableDisablePAS image support
full-parameter SFTset both encoder freeze flags to false and peft.enabled: falseselect LoRAsupported
LoRA (default selection)set peft.enabled: true, peft.method: lora, and nested vision/text adapter blocksset peft.enabled: false and use SFT settingssupported for SigLIP2; use targets q_proj, k_proj, v_proj, out_proj

An image capability probe is a launch-gated docker run, so include it in the approval summary before executing it. Documentation, an image tag, or an unrecognized Hydra override is not proof of LoRA support. If the probe does not expose a complete adapter contract (enable flag/config, target modules, rank, alpha, dropout, checkpoint behavior), report LoRA as unsupported for that image and stop before materializing a run.

Non-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.

Instructions

Use this skill for NVIDIA TAO CLIP jobs: training, evaluation, embedding inference, ONNX export, and TensorRT engine generation. Start by identifying the requested action, then read references/skill_info.yaml for image, command, and data-source wiring; references/spec_template_<action>.yaml for packaged action defaults; and schemas/<action>.schema.json when packaged for parameter metadata. Use references/spec_template.yaml for the full spec shape and references/tao-deploy-clip.md for TensorRT actions.

For dataset-backed actions, collect the required image, caption, list, or prompt files from the user and place the resolved paths in spec_overrides. For local Docker runs, mount extracted folders in the container and point image_dir / caption_dir at those folders; if a data source provides .tar.gz archives, extract them before running the in-container CLIP commands. For export and gen_trt_engine, infer parent artifacts from the upstream job when available; otherwise require explicit checkpoint, ONNX, or engine paths. Run gen_trt_engine, TensorRT evaluate, and TensorRT inference in the TAO Deploy image.

For TAO Deploy TensorRT actions (gen_trt_engine, TensorRT evaluate, and TensorRT inference), read references/tao-deploy-clip.md first. Deploy spec templates live in this skill's references/ folder with the spec_template_deploy_*.yaml prefix.

Training Requirements

  • Dataset type: image_text
  • Formats: custom image/caption folders or WebDataset shards
  • Monitoring metric: val/t2i_mAP for paired-caption retrieval;

val/pas/overall_mAP for PAS metadata matching

Before selecting a PAS AutoML objective or comparing training and evaluation, read PAS metric guidance. PAS validation logs val/pas/{easy,medium,hard,overall}_{mAP,rank1,rank5}; standalone PAS evaluate writes CSVs rather than test/* scalars. For a like-for-like comparison, use the same checkpoint and validation subset, set evaluate.pas_ground_truth_mode: scalar_attributes, and read nvidia_pas_metadata_metrics_weighted_aggregate.csv.

Supported Models
  • OpenCLIP / NV-CLIP: ViT-L-14-SigLIP-CLIPA-224 (default), ViT-L-14-SigLIP-CLIPA-336, ViT-H-14-SigLIP-CLIPA-224, ViT-H-14-SigLIP-CLIPA-336, ViT-H-14-SigLIP-CLIPA-574
  • Radio-CLIP: c-radio_v3-b, c-radio_v3-l, c-radio_v3-h, c-radio_v3-g
  • SigLIP2: siglip2-so400m-patch16-256, siglip2-so400m-patch14-224, siglip2-so400m-patch14-384, siglip2-so400m-patch16-384, siglip2-so400m-patch16-512, siglip2-so400m-patch16-naflex

Radio-CLIP requires model.adaptor_name to be set to siglip or clip.

Under the tower mode contract, OpenCLIP supports full / frozen, but rejects lora. See backbone support.

LoRA and preservation regularization

Before constructing a LoRA spec or PEFT AutoML search space, read CLIP PEFT guidance for per-tower fields, defaults, backbone target modules, numeric bounds, migration from tower enabled to mode, and encoder-freeze precedence. peft and regularization are top-level spec blocks; use the selected runtime's config contract.

With PEFT enabled under the tower mode contract, tower modes override model.freeze_*_encoder: frozen freezes the tower, full trains it, and lora trains adapters with the backbone frozen. Remove conflicting freeze flags and verify per-tower trainable-parameter counts.

LoRA checkpoints contain the full model; budget full-model storage. Preservation regularization adds a full frozen teacher on the GPU and a teacher forward pass. Keep regularization.enabled: false for recommended SigLIP2 PAS runs: preservation loss has not been fully validated there. The teacher is excluded from checkpoints.

Per-Action Dataset Requirements
ActionSpec KeySourceFilesList?
traindataset.train.datasetstrain_datasetsimage_dir: images.tar.gz, image_list_file: image_list.txt, caption_dir: captions.tar.gzYes
traindataset.train.wds.root_dirtrain_wds_datasetroot directory containing .tar shardsNo
traindataset.train.wds.shard_list_filetrain_wds_datasetshards.txt listing shard pathsNo
traindataset.val.datasetseval_datasetimage_dir: images.tar.gz, image_list_file: image_list.txt, caption_dir: captions.tar.gzYes
evaluatedataset.val.datasetseval_datasetimage_dir: images.tar.gz, image_list_file: image_list.txt, caption_dir: captions.tar.gzYes
inferenceinference.datasetsinference_datasetimage_dir: images.tar.gzYes
inferenceinference.text_fileinference_datasetprompts.txtNo
exportexport.checkpointparent train job or explicit checkpointcheckpoint .pth, optional for pretrained exportNo
gen_trt_enginegen_trt_engine.onnx_fileparent export job or explicit ONNXclip_model.onnxNo

For custom training, set dataset.train.type: custom and provide dataset.train.datasets entries. Image and caption files must share the same base name. caption_file_suffix defaults to .txt, and image_list_file is optional.

To run inference on a subset, place only the selected images in a separate directory and set inference.datasets[].image_dir to that directory.

When no native CLIP image-caption dataset is available, do not silently treat image-classification data as CLIP data. If the user explicitly allows a plumbing-only validation fallback, derive caption files from class labels, document that the captions are generated from labels, and keep each image/caption pair on the same base filename. Without an image_list_file, the TAO custom loader scans the configured image directory for image files; keep validation folders flat unless you provide a list file.

For WDS training, set dataset.train.type: wds and provide at least one of dataset.train.wds.root_dir or dataset.train.wds.shard_list_file. root_dir is scanned recursively for .tar shards. shard_list_file is a text file with one shard path per line; relative lines resolve under the list-file directory unless root_dir is also supplied, in which case they resolve under root_dir. Validation/evaluation data remains custom format via dataset.val.datasets.

Typical Spec Overrides

Data source overrides are mandatory for dataset-backed actions. Construct paths from the Per-Action Dataset Requirements table and include them in spec_overrides. For inference, provide at least one of inference.datasets or inference.text_file.

python
S3_TRAIN = "s3://bucket/data/train"
S3_WDS = "s3://bucket/data/wds"
S3_EVAL = "s3://bucket/data/eval"
S3_INFER = "s3://bucket/data/infer"

train, custom dataset:

python
{
"train.num_epochs": 10,
"dataset.train.type": "custom",
"dataset.train.datasets": [{"image_dir": f"{S3_TRAIN}/images.tar.gz", "image_list_file": f"{S3_TRAIN}/image_list.txt", "caption_dir": f"{S3_TRAIN}/captions.tar.gz"}],
"dataset.val.datasets": [{"image_dir": f"{S3_EVAL}/images.tar.gz", "image_list_file": f"{S3_EVAL}/image_list.txt", "caption_dir": f"{S3_EVAL}/captions.tar.gz"}],
}

train, WDS dataset:

python
{
"train.num_epochs": 10,
"dataset.train.type": "wds",
"dataset.train.wds.root_dir": f"{S3_WDS}",
"dataset.train.wds.shard_list_file": f"{S3_WDS}/shards.txt",
"dataset.train.wds.samples_per_shard": 10000,
"dataset.val.datasets": [{"image_dir": f"{S3_EVAL}/images.tar.gz", "image_list_file": f"{S3_EVAL}/image_list.txt", "caption_dir": f"{S3_EVAL}/captions.tar.gz"}],
}

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 90 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/nvidia-tao/tao-skill-bank/tao-finetune-clip/badge)](https://verified-skill.com/skills/nvidia-tao/tao-skill-bank/tao-finetune-clip)

Something wrong with this skill or its page? Tell us.