Tao Run Deft Cr Its Mining
NVIDIAOfficialCreated by NVIDIA Corporation
- Skill
- Workflow
- Software development
- Apache-2.0
- Medium risk
- Has scripts
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
The TAO Run DEFT CR ITS Mining skill provides an iterative, data-driven workflow to improve Cosmos-Reason binary video classification models. It focuses on identifying gaps in model performance through mining nearest neighbors from training datasets, refining the model, and evaluating improvements. The workflow manages the entire lifecycle, including baseline preparation, embedding generation, gap analysis, iterative training, and performance reporting.
What it does
- Validates workspace configuration and dataset integrity for DEFT runs.
- Prepares baseline Cosmos-Reason models through validation or conversion.
- Generates and manages embeddings for KPI and training datasets using Cosmos Embed.
- Performs automated gap analysis to identify weak samples in model predictions.
- Executes iterative training loops using mined nearest-neighbor data to improve accuracy.
- Generates comprehensive accuracy reports comparing baseline and iterative performance.
When to use it
- When you need to improve the accuracy of ITS Cosmos-Reason binary video classification models.
- When performing iterative refinement of Cosmos-RL models driven by gap analysis.
- When you need to identify and address specific classification failures using data mining.
- When managing a structured, multi-stage improvement loop for traffic-camera video datasets.
Advantages
- Automates complex multi-stage model improvement loops.
- Ensures consistent model preparation and evaluation across iterations.
- Provides clear visibility into performance gains via automated accuracy reporting.
- Supports flexible configuration for dataset paths, model checkpoints, and mining parameters.
Usage examples
- “Run the DEFT CR ITS mining workflow for my traffic-camera dataset.”
- The agent validates the workspace configuration, prepares the baseline model, initializes mining embeddings, and begins the iterative training loop as defined in the workflow.yaml.
- “Perform an iterative Cosmos-RL refinement based on gap analysis.”
- The agent executes the gap analysis stage, identifies weak samples, mines relevant training data, and triggers the training and evaluation cycle to improve the model.
Install
Download the skill as a ZIP:
https://mp-staging.autogineer.com/agent-skills/nvidia/tao-run-deft-cr-its-mining/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip tao-run-deft-cr-its-mining.zip -d .agents/skills
Documentation by NVIDIA Corporation
Skill: TAO Run DEFT CR ITS Mining
Prerequisites
Before preflight, follow references/host-prerequisites.md; use its selected DEFT_PYTHON for every bundled helper and stop if the dependency probe fails.
Bundled Resources
Resolve DEFT_SKILL_ROOT to the absolute directory containing this installed SKILL.md. The agent or plugin runtime resolves this path; it is not a user input. Invoke bundled helpers with "$DEFT_PYTHON" "$DEFT_SKILL_ROOT/scripts/<name>.py" .... Never require a skill-bank checkout or change the user's working directory to a repository root.
This workflow invokes tao-finetune-cosmos-embed, tao-analyze-gaps-vlm-bcq, tao-mine-nearest-neighbors, and the selected platform skill by registered skill name. Those skills own their credentials, actions, and bundled assets. Cosmos Reason is workflow-owned: resolve images.tao_toolkit.deft_cosmos_reason, generate TOMLs with this workflow's helpers and configured base templates, and submit the exact train/evaluate commands in references/mining-loop.md through the selected platform. The baseline-preparation stage reuses only tao-finetune-cosmos-reason's packaged Omni-to-Qwen3-VL conversion helper; do not invoke that model skill for planning, templates, action bundles, train/evaluate commands, or hook resolution.
User Inputs (DEFT Workspace and Workflow Configuration Yaml)
The user should provide a DEFT workspace absolute path that will be used for the entire run. This path should not be /workspace because that conflicts with the Cosmos Reason skills.
The layout of the DEFT workspace should be as follows:
<deft_workspace>/
├── data/
├── hf_cache/
├── model/
├── specs/
└── results/| Path | Purpose |
|---|---|
<deft_workspace>/data/ | User-provided KPI and training datasets, including LLaVA annotations and media directories. |
<deft_workspace>/hf_cache/ | Persistent Hugging Face cache used when workflow steps download or reuse HF models. |
<deft_workspace>/model/ | Local model/checkpoint inputs for the workflow, including the baseline Cosmos Reason checkpoint and any user-provided Cosmos Embed checkpoint. |
<deft_workspace>/specs/ | User-provided configuration files, including templates for Cosmos Reason train and evaluate, Cosmos Embed inference, and TAO Data Services mining. |
<deft_workspace>/results/ | All workflow-generated run artifacts, including state, logs, baseline evaluation, Cosmos Embed outputs, mining outputs, and iteration directories. |
Each workflow run writes under a run-specific directory inside <deft_workspace>/results/. If run.name is set in workflow.yaml, that exact value is used as the directory name; otherwise the workflow creates a timestamped directory. For example, run.name: deft_cr_its_mining_test writes baseline evaluation under <deft_workspace>/results/deft_cr_its_mining_test/baseline/evaluate.
The run directory layout is:
<deft_workspace>/results/<run_name_or_timestamp>/
├── workflow.yaml
├── deft_state.json
├── loop_log.jsonl
├── bcq_accuracy_report.md
├── bcq_accuracy_summary.json
├── baseline/
│ ├── model_preparation.json
│ └── evaluate/
│ └── bcq_accuracy_metrics.json
├── cosmos_embed_output/
│ ├── kpi/
│ └── train/
├── embedding_parquets/
│ ├── kpi/
│ │ └── embeddings.parquet
│ └── train/
│ └── embeddings.parquet
├── iter_1/
│ └── evaluate/
│ └── bcq_accuracy_metrics.json
├── iter_2/
└── ...workflow.yaml snapshots the run config. loop_log.jsonl is the append-only resume source, and every append refreshes deft_state.json. baseline/model_preparation.json records the prepared model and its provenance. Baseline and iteration evaluation directories contain metrics; the run-level reports compare them. cosmos_embed_output/ contains raw inference outputs, embedding_parquets/ contains fixed mining inputs, and each iter_<N>/ contains one loop iteration.
Workflow Configuration
There should be a file called <deft_workspace>/specs/workflow.yaml, which will be the high-level workflow config for the full DEFT run:
run:
name: null
max_iterations: 1
kpi_dataset:
annotations_path: /abs/path/to/deft_workspace/data/kpi/annotations.json
media_dir: /abs/path/to/deft_workspace/data/kpi/media
train_dataset:
annotations_path: /abs/path/to/deft_workspace/data/train/annotations.json
media_dir: /abs/path/to/deft_workspace/data/train/media
cosmos_reason:
baseline_model_path: /abs/path/to/deft_workspace/model/reasoner_checkpoint
base_evaluate_toml: /abs/path/to/deft_workspace/specs/cr_base_evaluate.toml
base_train_toml: /abs/path/to/deft_workspace/specs/cr_base_train.toml
continual_model: false
mining:
embeddings_spec_template: /abs/path/to/deft_workspace/specs/cosmos_embed_inference_template.yaml
embeddings_modality: both
cosmos_embed_checkpoint_path: null
embedding_parquets:
kpi: null
train: null
mining_spec_template: /abs/path/to/deft_workspace/specs/mining_spec_template.yaml
mine_unique_only: truerun, kpi_dataset, train_dataset, cosmos_reason, and mining are required. All configured paths should be absolute and inside <deft_workspace>. cosmos_reason.baseline_model_path is a local checkpoint directory whose config.json declares either qwen3_vl or cosmos3_omni; model preparation validates or converts it before any Cosmos-RL action. cosmos_reason.continual_model is optional and defaults to false; when false, every iteration trains from the prepared baseline checkpoint. mining.embeddings_modality selects KPI target modalities; train/source embeddings always contain both text and video. mining.mine_unique_only is optional and defaults to true; when true, previously mined train/source filepaths are filtered out before later mining runs.
Write all workflow outputs under <deft_workspace>/results; do not add another output root. When run.name is set, use <deft_workspace>/results/<run.name> and explain that baseline/, cosmos_embed_output/, embedding_parquets/, and iter_<N>/ are nested there. When it is null, create <deft_workspace>/results/run_<YYYYMMDD_HHMMSS> and record that path in deft_state.json so resume never recomputes it.
Before running any workflow stage, validate the config:
"$DEFT_PYTHON" "$DEFT_SKILL_ROOT/scripts/verify_workflow_yaml.py" \
--workspace "$WORKSPACE" \
--workflow-yaml "$WORKSPACE/specs/workflow.yaml"The validator requires all configured paths to exist inside <deft_workspace>, checks embeddings_modality, and verifies KPI/train LLaVA ids and media references. It reports the baseline model_type, rejects unsupported formats, and fully validates an existing Qwen3-VL baseline. It also requires positive Cosmos Embed GPU count. The optional Embed checkpoint may be null, a local workspace path, or an HF model id. Supplied KPI/train embedding Parquets must contain filepath, embedding, and modality; KPI must contain the selected modalities and train must contain both. Removed per-modality embedding fields are invalid. Each invoked skill still owns its mount behavior.
If the user does not provide custom Cosmos Reason or Cosmos Embed templates, copy $DEFT_SKILL_ROOT/assets/cr_base_evaluate.toml, $DEFT_SKILL_ROOT/assets/cr_base_train.toml, and $DEFT_SKILL_ROOT/assets/default_cosmos_embed_inference.yaml into <deft_workspace>/specs/. Use tao-mine-nearest-neighbors to copy its bundled assets/default_nearest_neighbors.yaml when the user does not provide a mining template. Point workflow.yaml at the workspace copies. The bundled Cosmos Embed template requests 8 GPUs; do not launch until preflight confirms the selected platform can satisfy that request, or the user approves a modified template.
Initialize a run once after validation:
"$DEFT_PYTHON" "$DEFT_SKILL_ROOT/scripts/initialize_workflow.py" \
--workspace "$WORKSPACE" \
--workflow-yaml "$WORKSPACE/specs/workflow.yaml"Use the printed run_dir as RUN_DIR for every later command. If run.name is null, never ask another preparation script to derive the run directory again; pass --run-dir "$RUN_DIR" so all stages write into the initialized run.
Do not use --force for an ordinary resume. It rewrites the state/config snapshot but intentionally leaves loop_log.jsonl and all stage artifacts in place. Use it only to repair the snapshot for the same run; choose a new run.name for a clean restart. Before resuming, run "$DEFT_PYTHON" "$DEFT_SKILL_ROOT/scripts/resume_position.py" --run-dir "$RUN_DIR" and continue from the reported stage.
Baseline Evaluation
Before preparing TOMLs, follow references/mining-loop.md#qwen3-vl-patch-embedding
for both base templates, including custom templates and resumed workspaces.
Prepare the baseline once before evaluation. Reuse a complete Qwen3-VL checkpoint or convert Cosmos3 Omni through the current model-skill contract, cache it under <deft_workspace>/model/prepared/, and validate it with the pinned runtime. Read references/cosmos-reason-model-preparation.md for this stage.
After its manifest records status: ready, evaluate the prepared path on KPI data and compute baseline/evaluate/bcq_accuracy_metrics.json. Use references/mining-loop.md for evaluation commands and logging.
Initialize Mining Embeddings
Initialize mining embeddings once before the DEFT iteration loop. The KPI and train datasets are fixed for the run, so their Cosmos Embed outputs are reusable across all iterations.
Use scripts/prepare_cosmos_embed_inference.py to prepare the Cosmos Embed inference specs from workflow.yaml. The KPI dataset requires the modality or modalities selected by mining.embeddings_modality; the train dataset always requires text and video. If the user provides a complete dataset Parquet under mining.embedding_parquets.kpi or .train, the preparation script stages it at $RUN_DIR/embedding_parquets/<dataset>/embeddings.parquet and generates no inference specs for that dataset. While staging, it remaps text embedding identifiers from the source run's question files to the current run's lookup by question content; embeddings and video identifiers are preserved. If the dataset value is null or omitted, the script generates every required modality spec for that dataset. Partial per-modality reuse is not supported. If mining.cosmos_embed_checkpoint_path is an absolute local path, the script uses it for generated specs. If it is a remote Hugging Face model id, with or without the hf_model:// prefix, the script downloads or reuses it under <deft_workspace>/hf_cache and writes the local downloaded checkpoint path into the generated inference specs. If the field is null, the script uses nvidia/Cosmos-Embed1-224p.
The script downloads remote HF checkpoints before Cosmos Embed runs because Cosmos Embed startup can race when inference.num_gpus > 1 and multiple workers try to download the same model at once. If both combined dataset Parquets are provided, the preparation script does not need the checkpoint and does not download it.
Use scripts/prepare_cosmos_embed_inference.py once. It prepares both the KPI dataset and the train dataset:
"$DEFT_PYTHON" "$DEFT_SKILL_ROOT/scripts/prepare_cosmos_embed_inference.py" \
--workspace "$WORKSPACE" \
--workflow-yaml "$WORKSPACE/specs/workflow.yaml" \
--run-dir "$RUN_DIR"The preparation script writes only the missing embedding specs under the initialized RUN_DIR. Initialization owns the $RUN_DIR/workflow.yaml snapshot; this stage does not derive a new run or overwrite that snapshot.
For each dataset without a supplied combined Parquet, the preparation script writes all required modality-specific inference specs under cosmos_embed_output/<dataset>/specs/, creates raw Cosmos Embed result directories, stages text questions as files for stable joins, and writes lookup.parquet. After inference, the conversion script gathers those separate modality outputs into one mining-facing file per dataset. Each row contains filepath, embedding, and modality:
$RUN_DIR/embedding_parquets/kpi/embeddings.parquet
$RUN_DIR/embedding_parquets/train/embeddings.parquetThe KPI parquet contains only the selected modality or modalities. The train parquet always contains both text and video rows.
Run Cosmos Embed Inference
Use tao-finetune-cosmos-embed for each generated inference spec. Follow the mandatory terminal-exit validation, permission repair, and conversion procedure in references/mining-loop.md. Do not run inference or conversion for a dataset whose combined Parquet was supplied during preparation.
The generated lookup Parquet uses annotation_id for the original LLaVA id and video_path for resolved media. Do not rename either column to video_id; that external field belongs to Cosmos Reason and gap-analysis records.
DEFT Mining Loop
Run iterations 1..run.max_iterations. The loop is mining-only: no PAIDF or generated-video branch runs in this skill. Before gap analysis, each iteration rewrites Cosmos Reason result video_id values from LLaVA annotation ids to resolved KPI video paths and stores the prepared predictions in the iteration's gaps/ directory. It then runs gap analysis, builds one selected-modality target parquet, mines it against the combined text/video train source in one tao-mine-nearest-neighbors run, converts mined rows to LLaVA annotations, merges annotations, trains Cosmos Reason, evaluates the trained checkpoint, computes that evaluation's BCQ accuracy metrics, and removes the resumable training checkpoints while preserving the exported safetensors. At loop termination, generate the run-level accuracy report and include its baseline/iteration table in the agent's final response. See references/mining-loop.md for exact commands and completion criteria.
Completion Criteria
| Stage | Complete when |
|---|---|
validate_workflow | verify_workflow_yaml.py exits successfully. |
initialize_workflow | $RUN_DIR/workflow.yaml and $RUN_DIR/deft_state.json exist. |
prepare_cosmos_reason_model | baseline/model_preparation.json records status=ready, a complete Qwen3-VL checkpoint, and successful pinned-runtime validation. |
baseline_evaluate | The evaluate job exits successfully, exactly one baseline results.json is found, and baseline/evaluate/bcq_accuracy_metrics.json exists. |
prepare_cosmos_embed_inference | Each dataset has a lookup parquet and either all required Cosmos Embed specs or a staged combined embedding Parquet. |
cosmos_embed | Every generated inference spec has a current completion_validation.json; exit 0 is accepted after output validation, while exit 130 additionally records a teardown warning. |
convert_embeddings | embedding_parquets/{kpi,train}/embeddings.parquet exist; train contains both modalities and KPI contains the selected modalities. |
gap_analysis | $RUN_DIR/iter_<N>/gaps/predictions.json exists and the container exits successfully. The workflow counts valid rows directly from kpi_gaps.jsonl; missing or empty output after successful completion means zero weak samples. |
prepare_nearest_neighbor_mining | One target parquet, optional filtered source parquet, and one nearest-neighbor spec exist. |
mine_nearest_neighbors | One mined-neighbor parquet and mining summary exist. |
record_mined_paths | When mine_unique_only is true, $RUN_DIR/mining/mined_paths_log.parquet exists; otherwise the stage is logged as skipped. |
prepare_cosmos_reason_train | Mined and accumulated LLaVA annotations plus train/specs/train.toml exist, with a positive expected optimizer-step count. |
train | The Cosmos Reason job reaches terminal success, reports at least one optimizer step, and has writable timestamped output and checkpoint directories. |
evaluate | Evaluation preparation finds the latest completed training checkpoint, the evaluation job exits successfully, exactly one iteration results.json is found, and its bcq_accuracy_metrics.json exists. |
cleanup_cosmos_reason_training | train/checkpoint_cleanup.json exists, raw checkpoint directories are gone, and its listed safetensors exports remain. |
loop_stop | Stop reason is logged and bcq_accuracy_report.md plus bcq_accuracy_summary.json compare the baseline with every completed iteration. |
Troubleshooting
Prediction id does not match an annotation: Confirm the evaluation used the same KPI annotations configured by kpi_dataset.annotations_path. Every Cosmos Reason result video_id must match a LLaVA annotation id or an already-resolved annotation video path.
Baseline model format is unsupported: Accept only complete qwen3_vl or local cosmos3_omni. For Omni, follow references/cosmos-reason-model-preparation.md; never pass the source directly to evaluation.
CUDA error 803 in Cosmos-RL: Follow the exact-image probe in references/mining-loop.md. A host that passes nvidia-smi may still load an incompatible image-bundled library. Use the verified launch environment; never mask this with CPU inference or relaxed video decoding.
No target embeddings matched: Check that gaps/predictions.json and gap-analysis video_id paths match the KPI LLaVA media paths used during embedding preparation. Text mode also requires the question text to match after removing <video> and trailing “Answer with yes or no.”
Mining compares visible symlink targets without rewriting inputs. For remote-only media, prepare on the execution host or use identical path spellings.
Mined neighbors do not join to train lookup: Confirm every mined filepath exists in embedding_parquets/train/embeddings.parquet. Its modality determines whether the path must match train lookup.parquet filepath for text or video_path for video.
Run directory looks nested under results/<run.name>: This is expected. run.name is the run directory name under <deft_workspace>/results; all baseline, embedding, and iteration artifacts are nested there.
Docker output permissions or Cosmos Reason status paths fail: Stop and follow the permission-repair and stage-local TAO status contracts in references/mining-loop.md.
Unparseable prediction count is nonzero: Report the count to the user and inspect the corresponding raw results.json responses. These predictions count as incorrect in accuracy and class recall; the metrics script does not silently drop them. An unparseable ground truth stops metric computation because the expected class is undefined.
Cosmos Reason reports No space left on device for /dev/shm/nccl-*: This is container shared memory, not ordinary disk capacity. For local Docker, run the Cosmos Reason action through tao-run-on-docker and require --shm-size=8g --ulimit memlock=-1 --ulimit stack=67108864. Confirm these flags in the submitted job before retrying. Other platforms must provide equivalent shared-memory and memlock settings.
Files
- ATTRIBUTION.mdAdded by AutoGineer948 B
- BENCHMARK.md8.5 KiB
- LICENSELicence file added by AutoGineer11.2 KiB
- SKILL.md19.7 KiB
- assets/cr_base_evaluate.toml554 B
- assets/cr_base_train.toml1.3 KiB
- assets/default_cosmos_embed_inference.yaml800 B
- config/skillspector-baseline.yaml2.6 KiB
- evals/evals.json3.3 KiB
- references/cosmos-reason-model-preparation.md4.0 KiB
- references/host-prerequisites.md1.8 KiB
- references/mining-loop.md32.2 KiB
- scripts/batch_cosmos_embed_text.pyScript10.5 KiB
- scripts/cleanup_cosmos_reason_training.pyScript5.1 KiB
- scripts/compute_bcq_accuracy_metrics.pyScript6.7 KiB
- scripts/cosmos_embed_outputs_to_parquet.pyScript7.1 KiB
- scripts/deft_python.shScript2.0 KiB
- scripts/find_cosmos_reason_results.pyScript856 B
- scripts/initialize_workflow.pyScript3.4 KiB
- scripts/log_stage.pyScript6.8 KiB
- scripts/native_process.pyScript9.5 KiB
- scripts/prepare_cosmos_embed_inference.pyScript16.0 KiB
- scripts/prepare_cosmos_reason_evaluate.pyScript5.8 KiB
- scripts/prepare_cosmos_reason_model.pyScript18.5 KiB
- scripts/prepare_cosmos_reason_train.pyScript15.7 KiB
- scripts/prepare_gap_analysis_predictions.pyScript6.1 KiB
- scripts/prepare_nearest_neighbor_mining.pyScript10.8 KiB
- scripts/record_mined_paths.pyScript2.5 KiB
- scripts/restore_docker_mount_permissions.pyScript4.0 KiB
- scripts/resume_position.pyScript7.2 KiB
- scripts/summarize_bcq_accuracy_metrics.pyScript4.6 KiB
- scripts/validate_cosmos_embed_output.pyScript10.2 KiB
- scripts/verify_workflow_yaml.pyScript11.3 KiB
- scripts/workflow_common.pyScript17.7 KiB
- skill-card.md4.9 KiB
- skill.oms.sig13.0 KiB
- tests/test_batch_process_lifecycle.pyScript14.1 KiB
- tests/test_cosmos_embed_batching.pyScript10.5 KiB
- tests/test_cosmos_embed_completion.pyScript8.1 KiB
- tests/test_host_dependencies.pyScript6.2 KiB
- tests/test_mining_media_paths.pyScript4.6 KiB
- tests/test_model_preparation.pyScript24.0 KiB
references/mining-loop.md
DEFT CR ITS Mining Loop Reference
Use this reference when running the iteration loop after the DEFT workspace and workflow.yaml have been validated.
Resolve DEFT_SKILL_ROOT to the absolute directory containing the installed tao-run-deft-cr-its-mining/SKILL.md; never ask the user for it. Export WORKSPACE_DIR="$WORKSPACE", select DEFT_PYTHON with scripts/deft_python.sh, and invoke every bundled helper with that interpreter. The user's working directory does not need to be the plugin or repository root.
Stage Skills
Read each listed underlying skill before invoking its stage. Cosmos Reason is the exception: this workflow owns its specs and commands, and the selected platform owns execution.
| Stage | Owner | Owns |
|---|---|---|
| Cosmos Reason train/evaluate | This workflow + selected platform | DEFT image key, generated TOMLs, and exact commands; platform submission, logs, status, and terminal-state detection. |
| Cosmos Embed inference | tao-finetune-cosmos-embed | Inference command, image, credentials, mounts, and submitted job. |
| VLM BCQ gap analysis | tao-analyze-gaps-vlm-bcq | Gap spec generation, data-services action, image, and outputs. |
| Nearest-neighbor mining | tao-mine-nearest-neighbors | Default template, spec validation, data-services action, image, and outputs. |
| Job execution | Selected tao-run-on-* platform skill | Resource allocation, submission, status, logs, and terminal-state detection. |
Initialization
If the user does not provide custom Cosmos Reason or Cosmos Embed templates, copy them from $DEFT_SKILL_ROOT/assets/ into <deft_workspace>/specs/. Use tao-mine-nearest-neighbors to copy its bundled default template when the user does not provide a mining template. Point workflow.yaml at the workspace copies.
Initialize a run once:
"$DEFT_PYTHON" "$DEFT_SKILL_ROOT/scripts/initialize_workflow.py" \
--workspace "$WORKSPACE" \
--workflow-yaml "$WORKSPACE/specs/workflow.yaml"Use the printed run_dir as RUN_DIR for every later command. If run.name is null, never let another preparation script derive a new run directory; pass --run-dir "$RUN_DIR".
An orchestrator that resolves the run directory before initialization may also pass that absolute path to this command with --run-dir "$RUN_DIR".
--force rewrites deft_state.json and the workflow snapshot but does not remove the existing loop log or stage artifacts. Use it only to repair the snapshot for the same run. Start a clean run with a new run.name instead.
Append one stage event after each completed, skipped, or failed stage:
"$DEFT_PYTHON" "$DEFT_SKILL_ROOT/scripts/log_stage.py" \
--log-path "$RUN_DIR/loop_log.jsonl" \
--iter-label "iter_${ITER}" \
--stage mine_nearest_neighbors \
--status ok \
--summary "mined nearest train neighbors" \
--duration-sec "$DURATION_SEC" \
--artifact "$RUN_DIR/iter_${ITER}/mining/mined_neighbors.parquet"Each append rebuilds deft_state.json atomically from valid log events. A truncated or otherwise malformed log line is ignored without blocking later appends. Before resuming, refresh state and ask the helper for the next unfinished stage:
"$DEFT_PYTHON" "$DEFT_SKILL_ROOT/scripts/resume_position.py" \
--run-dir "$RUN_DIR"Use the reported stage; do not infer resume position from directory names or rerun iteration 1 by default.
Cosmos Reason Platform Runtime
Resolve images.tao_toolkit.deft_cosmos_reason from the installed skill bank's versions.yaml and keep the resulting literal image URI as DEFT_COSMOS_REASON_IMAGE. Do not substitute images.tao_toolkit.cosmos_rl or any image selected by another skill.
Generate Cosmos Reason TOMLs only with this workflow's bundled helpers. prepare_cosmos_reason_train.py loads cosmos_reason.base_train_toml, and prepare_cosmos_reason_evaluate.py loads cosmos_reason.base_evaluate_toml; when the user does not provide custom base TOMLs, initialization copies the bundled files from assets/ and points workflow.yaml at them. Baseline preparation may reuse only the model skill's packaged conversion helper as described below; do not load its templates or invoke its planner or action bundle.
The pinned runtime commands are:
cosmos-rl --config <train.toml> /opt/cosmos_rl/tao_sft_example.py
cosmos-rl-evaluate --config <evaluate.toml>Qwen3-VL patch embedding
Use the pinned Cosmos-RL image's native linear-equivalent patch projection for this workflow's Qwen3-VL checkpoints, including prepared Cosmos3 Nano. The bundled templates select it in different native sections:
| Base template | Required setting |
|---|---|
cosmos_reason.base_evaluate_toml | [model] → qwen3_vl_patch_embed = "linear" |
cosmos_reason.base_train_toml | [policy] → qwen3_vl_patch_embed = "linear" |
Before preparation, inspect both workspace templates. For older copies or
user-supplied templates, add the missing setting without replacing their other
parameters. If either explicitly selects auto or conv3d, explain the
incompatibility and include the change to linear in the launch review; do not
silently overwrite an explicit choice. Do not launch the affected path until
that configuration change is approved. The helpers preserve these settings;
check the generated baseline/iteration evaluate and train TOMLs before each
submission. On resume, regenerate an unsubmitted stage's TOML after updating
its base template; leave completed stage artifacts intact.
In 7.2.0-cosmos-rl, the precompiled cuDNN engine library is missing and the
runtime's auto policy does not select the linear implementation on H100/H200
(compute capability 9.0). This causes bf16/fp16 patchify Conv3d to fail even when
CUDA initialization and checkpoint validation pass. linear uses the same
trainable projection weights and bias without that cuDNN convolution; it does
not change the checkpoint format, precision, or video decoder. Keep this
selection consistent for baseline evaluation, training, and reevaluation.
Do not downgrade the image (that removes Omni preparation support), disable
cuDNN globally, or inject/mount runtime patches.
Launch checks
Before the first Cosmos Reason launch, inspect DEFT_COSMOS_REASON_IMAGE through the selected platform and require cosmos-rl, cosmos-rl-evaluate, and /opt/cosmos_rl/tao_sft_example.py to exist. Stop with a runtime-contract error if any is missing. Do not invoke cosmos_workflow.py, inspect skill_info.yaml for a replacement command, derive the hook from cosmos_rl.__file__, or submit a model-skill action bundle.
Use the exact image for a CUDA initialization probe before its first GPU action. The probe must initialize libcuda.so.1 and require torch.cuda.is_available(); nvidia-smi alone is insufficient. If Docker reports CUDA_ERROR_SYSTEM_DRIVER_MISMATCH (803) while the host GPU probe succeeds, inspect the image's declared LD_LIBRARY_PATH, remove only entries rooted at /usr/local/cuda/compat, and rerun the exact-image probe with that value. Carry the sanitized value into every Cosmos Reason train/evaluate submission only when this second probe passes. Do not remove unrelated library paths, disable strict GPU video decoding, or fall back to CPU. If either the host probe or sanitized exact-image probe fails, stop with an infrastructure error instead of launching the workflow.
Run every Cosmos Reason train/evaluate action through the selected platform skill with the pinned commands above and the TOML prepared by this workflow. Confirm the submitted job records DEFT_COSMOS_REASON_IMAGE before launch. For local or remote single-node Docker, select tao-run-on-docker; do not construct a competing unmanaged Docker launch. Require its submitted container command to include --shm-size=8g --ulimit memlock=-1 --ulimit stack=67108864. Kubernetes or Slurm must provide equivalent shared-memory and memlock resources. Keep the platform job id and use the platform's status and log operations until the job reaches a terminal state.
Before every Cosmos Reason launch, set STAGE_DIR and TAO_JOB_ID from this table:
| Launch | STAGE_DIR | TAO_JOB_ID |
|---|---|---|
| Baseline evaluate | $RUN_DIR/baseline/evaluate | baseline-evaluate |
| Iteration train | $RUN_DIR/iter_${ITER}/train | iter-${ITER}-train |
| Iteration evaluate | $RUN_DIR/iter_${ITER}/evaluate | iter-${ITER}-evaluate |
Set CONTAINER_STAGE_DIR to the exact writable container destination where the selected platform mounts STAGE_DIR. The submitted job must record the read-write mapping STAGE_DIR:CONTAINER_STAGE_DIR; a one-to-one mapping is valid. Do not infer CONTAINER_STAGE_DIR from the image working directory. If the platform submission does not expose this mapping, stop before launch.
Create $STAGE_DIR/.tao-status/$TAO_JOB_ID/ on the host and verify it is writable. Because it is below the stage mount, its container path is $CONTAINER_STAGE_DIR/.tao-status/$TAO_JOB_ID/. Set:
TAO_API_JOB_ID=$TAO_JOB_ID
TAO_API_RESULTS_DIR=$CONTAINER_STAGE_DIR/.tao-status
TAO_STATUS_FILE=$CONTAINER_STAGE_DIR/.tao-status/$TAO_JOB_ID/status.jsonConfirm the submitted job contains the mount and all three environment variables before launch; otherwise the TAO status decorator may fall back to writing ./results under the image's unwritable /workspace directory.
Baseline Model Preparation
Before baseline evaluation, read references/cosmos-reason-model-preparation.md and run prepare_cosmos_reason_model.py. The raw baseline may be a complete Qwen3-VL checkpoint or a native Cosmos3 Omni checkpoint, but the stage must produce $RUN_DIR/baseline/model_preparation.json with status=ready. Log that manifest as prepare_cosmos_reason_model. All later baseline checkpoint selection is read from this manifest; do not patch a TOML with the raw Omni source path.
Baseline Evaluation
Generate the baseline evaluate TOML:
"$DEFT_PYTHON" "$DEFT_SKILL_ROOT/scripts/prepare_cosmos_reason_evaluate.py" \
--workspace "$WORKSPACE" \
--workflow-yaml "$WORKSPACE/specs/workflow.yaml" \
--run-dir "$RUN_DIR"Run the pinned cosmos-rl-evaluate --config command with $RUN_DIR/baseline/evaluate/specs/evaluate.toml. After the job exits successfully, restore host write access before result discovery:
"$DEFT_PYTHON" "$DEFT_SKILL_ROOT/scripts/restore_docker_mount_permissions.py" \
--path "$RUN_DIR/baseline/evaluate" \
--docker-image "$DEFT_COSMOS_REASON_IMAGE"The helper exits without changing anything when the directory is already writable. Do not continue unless it succeeds. Then locate the result and compute the authoritative binary metrics:
BASELINE_RESULTS_JSON="$("$DEFT_PYTHON" "$DEFT_SKILL_ROOT/scripts/find_cosmos_reason_results.py" \
--evaluate-dir "$RUN_DIR/baseline/evaluate")"
"$DEFT_PYTHON" "$DEFT_SKILL_ROOT/scripts/compute_bcq_accuracy_metrics.py" \
--results-json "$BASELINE_RESULTS_JSON" \
--output-json "$RUN_DIR/baseline/evaluate/bcq_accuracy_metrics.json"Ignore metrics emitted by Cosmos-RL evaluate; compute_bcq_accuracy_metrics.py and its bcq_accuracy_metrics.json output are the source of truth for this workflow. The metrics script reads response/gt and also accepts answer/ground_truth. It extracts yes and no defensively from capitalization, punctuation, and short free-form answers. An unparseable prediction is reported and counted as incorrect; an unparseable ground truth is a hard error. Report the printed accuracy, balanced accuracy, false-positive count, false-negative count, and unparseable count in the baseline stage update. Log both results.json and bcq_accuracy_metrics.json as baseline_evaluate artifacts. The stage is not complete until the metrics file exists.
Mining Embeddings
Prepare fixed KPI/train Cosmos Embed inputs once:
"$DEFT_PYTHON" "$DEFT_SKILL_ROOT/scripts/prepare_cosmos_embed_inference.py" \
--workspace "$WORKSPACE" \
--workflow-yaml "$WORKSPACE/specs/workflow.yaml" \
--run-dir "$RUN_DIR"Run tao-finetune-cosmos-embed inference for every generated spec under:
$RUN_DIR/cosmos_embed_output/kpi/specs/
$RUN_DIR/cosmos_embed_output/train/specs/Only run specs that exist. KPI specs follow mining.embeddings_modality; train specs always cover text and video. If mining.embedding_parquets.kpi or .train supplied a complete combined dataset Parquet, there are no specs for that dataset and its mining-ready output is already staged under $RUN_DIR/embedding_parquets/<dataset>/embeddings.parquet. Staging remaps text identifiers to the current run's lookup by reading the source question files, so those files must remain readable; video identifiers and embedding vectors are unchanged.
Read inference.num_gpus from each generated spec and request exactly that many GPUs from the selected platform. The bundled template defaults to 8 GPUs. The preparation script prints the count for every generated modality; stop before launch if the platform cannot satisfy it.
Use the registered inference action exactly as cosmos-embed1 inference -e <generated-spec>. Do not append a results_dir=... CLI override: OmegaConf would replace the generated spec's modality-specific output path. Before submission, inspect the rendered command and require the selected platform to make the spec's absolute workspace paths visible and writable at those same paths inside the container. Do not infer output location from the container working directory.
For large text-query lists, the 7.1.0 runtime embeds all queries together;
changing the dataset batch size does not bound that forward pass. With user
approval, use scripts/batch_cosmos_embed_text.py to split a fresh text spec
without dropping questions. Choose the query limit for the model and available
GPU memory; 8192 was verified with the 224p model on an 80-GB A100, not as a
universal default:
"$DEFT_PYTHON" "$DEFT_SKILL_ROOT/scripts/batch_cosmos_embed_text.py" prepare \
--inference-spec "$INFERENCE_SPEC" --chunk-size 8192Through the selected platform, stage this workflow's scripts/ directory
read-only as CONTAINER_DEFT_SCRIPTS, keep the original absolute spec/workspace
paths visible, and submit the following command inside the same approved
Cosmos Embed image, with the model skill's startup preamble and GPU count:
python "$CONTAINER_DEFT_SCRIPTS/batch_cosmos_embed_text.py" run \
--inference-spec "$INFERENCE_SPEC"The wrapper calls the unchanged native CLI once per bounded config. It records
each exact child exit, validates every batch, then merges JSON/NPY outputs with
ordered duplicate questions and corrected row indices. It emits the original
full-spec completion artifact only after aggregate validation; downstream
conversion is unchanged. Child exit 130 remains subject to the existing strict
validator and is preserved in batch-provenance.json; the wrapper exits zero
only after successful merging. A failed child stops the run. Existing attempts
are not overwritten or automatically retried: inspect the batch logs and use
a fresh results directory for an approved corrected submission.
Batching preserves rows and metadata, not bitwise-identical floating-point values: the native encoder's low-precision rounding can change with batch shape. Report the actual compute precision, absolute differences, and cosine similarity when checking batched/unbatched equivalence. If a numerical tolerance fails, compare native encoding of the same query slices before attributing the difference to merging; do not silently loosen the check. See PyTorch's batched-computation accuracy notes.
Run the wrapper inside the Linux model container: its worker ownership uses
Linux subreaping and pidfds to stop/reap the CLI, torchrun, and workers even
when they create separate sessions. SIGINT/SIGTERM cancels the whole attempt,
with SIGKILL escalation after five seconds; it never qualifies as native
teardown success. batch-cancellation.json prevents later completion validation
from promoting canceled outputs. Native stdout/stderr streams live through the
platform's logs verb and is also retained in each container-child.log,
including shutdown diagnostics. If the platform log reader stalls or closes,
live forwarding is best-effort so cancellation cannot hang on log backpressure;
the complete batch file records how many live bytes were omitted. Recovery uses
a fresh results directory, not
in-place resume; previously completed batches remain available for inspection.
Keep the exact container image selected by tao-finetune-cosmos-embed as COSMOS_EMBED_IMAGE. Handle every generated spec independently. Set INFERENCE_SPEC to that spec's absolute path and DATASET to its kpi or train parent dataset. Run the inference action through tao-finetune-cosmos-embed and the selected platform. Monitor it to a terminal state and record its exact numeric exit code as COSMOS_EMBED_EXIT_CODE, including when the platform classifies the job as failed. After the container exits, restore host write access if needed with the same image and the dataset directory containing that spec:
"$DEFT_PYTHON" "$DEFT_SKILL_ROOT/scripts/restore_docker_mount_permissions.py" \
--path "$RUN_DIR/cosmos_embed_output/$DATASET" \
--docker-image "$COSMOS_EMBED_IMAGE"Then validate the terminal result and existing outputs:
"$DEFT_PYTHON" "$DEFT_SKILL_ROOT/scripts/validate_cosmos_embed_output.py" \
--inference-spec "$INFERENCE_SPEC" \
--exit-code "$COSMOS_EMBED_EXIT_CODE"The validator reads results_dir from the generated spec and requires metadata and a finite two-dimensional NPY array there, exact input/output counts and identifiers, and one unique npy_row for every embedding. Exit 0 passes only when those checks pass. Exit 130 is the one permitted nonzero code because the affected runtime can return it during torchrun teardown after successful output; the validation artifact records ok_with_teardown_warning. Every other nonzero exit fails. Existing outputs remain reusable when they still match the unchanged inference spec. If the platform cannot report an exact numeric code, do not infer 130 from logs or files; stop and ask how the user wants to proceed.
After every generated spec passes check or complete, log one cosmos_embed ok event with every completion_validation.json as an artifact. If there are no generated specs because both combined Parquets were supplied, log the stage as skipped. Do not log this stage complete from platform status alone.
Convert completed outputs only for datasets that generated inference specs:
"$DEFT_PYTHON" "$DEFT_SKILL_ROOT/scripts/cosmos_embed_outputs_to_parquet.py" \
--output-dir "$RUN_DIR/cosmos_embed_output/kpi" \
--parquet-dir "$RUN_DIR/embedding_parquets/kpi" \
--embedding-modality "$EMBEDDING_MODALITY"
"$DEFT_PYTHON" "$DEFT_SKILL_ROOT/scripts/cosmos_embed_outputs_to_parquet.py" \
--output-dir "$RUN_DIR/cosmos_embed_output/train" \
--parquet-dir "$RUN_DIR/embedding_parquets/train" \
--embedding-modality bothThese commands write $RUN_DIR/embedding_parquets/kpi/embeddings.parquet and $RUN_DIR/embedding_parquets/train/embeddings.parquet. The converter reads each modality's results_dir from its generated spec; it never reconstructs the producer path or searches for misplaced files. Skip the corresponding command when preparation already staged a supplied combined Parquet at that path. The KPI file contains the selected modality or modalities. The train file always contains both, and each row records its modality alongside filepath and embedding.
For text outputs, conversion matches each Cosmos Embed metadata text value to the corresponding lookup question. Repeated questions consume their lookup rows in occurrence order. npy_row selects only the embedding vector; it is not treated as a lookup-row index. Conversion fails if Cosmos Embed returns missing, extra, or unmatched text occurrences.
Iteration Loop
Run iterations 1..run.max_iterations. Before each stage, run resume_position.py; loop_log.jsonl is the event source and deft_state.json is its refreshed snapshot.
Gap analysis: for iteration 1, source predictions come from the baseline
results.json; for later iterations, they come from the previous iteration'sresults.json. Cosmos Reason may write a LLaVA annotation id invideo_id, which is not necessarily the annotation's media path and is ambiguous for downstream video joins when one video has multiple questions. Rewrite each result through the fixed KPI annotations before generating the gap-analysis spec:
PREDICTIONS_JSON="$RUN_DIR/iter_${ITER}/gaps/predictions.json"
"$DEFT_PYTHON" "$DEFT_SKILL_ROOT/scripts/prepare_gap_analysis_predictions.py" \
--results-json "$PREVIOUS_RESULTS_JSON" \
--annotations-json "$KPI_ANNOTATIONS_JSON" \
--media-dir "$KPI_MEDIA_DIR" \
--output-json "$PREDICTIONS_JSON"Invoke tao-analyze-gaps-vlm-bcq with predictions_json=$PREDICTIONS_JSON, no videos_dir because the prepared ids are absolute paths, results_dir=$RUN_DIR/iter_${ITER}/gaps, and output_spec=$RUN_DIR/iter_${ITER}/gaps/vlm_bcq_spec.yaml. Let that skill use its bundled helper to generate the spec and run the action.
KPI_ANNOTATIONS_JSON is kpi_dataset.annotations_path from workflow.yaml. The preparation script preserves every prediction row and changes only video_id; multiple annotation ids may therefore resolve to the same video path while retaining their separate questions. After the submitted container exits successfully, count the valid JSON-object rows in $RUN_DIR/iter_${ITER}/gaps/kpi_gaps.jsonl and report that weak-sample count. A missing or empty file after successful completion means there are no weak samples. In that case, log loop_stop with reason no_weak_samples; otherwise continue with mining. On resume, resume_position.py performs this validation and count directly from kpi_gaps.jsonl.
Prepare nearest-neighbor mining:
"$DEFT_PYTHON" "$DEFT_SKILL_ROOT/scripts/prepare_nearest_neighbor_mining.py" \
--workspace "$WORKSPACE" \
--workflow-yaml "$WORKSPACE/specs/workflow.yaml" \
--run-dir "$RUN_DIR" \
--iteration "$ITER" \
--gaps-jsonl "$RUN_DIR/iter_${ITER}/gaps/kpi_gaps.jsonl"The command writes one $RUN_DIR/iter_<N>/mining/target.parquet. Gap-analysis video_id remains the external resolved media path; internally it joins to lookup video_path. Text target rows are failed (video_path, question) embeddings, and video target rows are unique failed-video embeddings. With embeddings_modality: both, both row types are appended to the same target. When mining.mine_unique_only is true or omitted, the single generated spec points at $RUN_DIR/iter_<N>/mining/filtered_source.parquet, which excludes source filepaths already recorded in $RUN_DIR/mining/mined_paths_log.parquet.
Mine nearest neighbors: use
tao-mine-nearest-neighborsonce with$RUN_DIR/iter_<N>/mining/nearest_neighbors.yaml. Every target row is queried independently against the combined text/video train source. The stage is complete when$RUN_DIR/iter_<N>/mining/mined_neighbors.parquetand its mining summary exist.Record mined paths: when
mining.mine_unique_onlyis true or omitted, update the cumulative mined-path log after the nearest-neighbor run completes.
"$DEFT_PYTHON" "$DEFT_SKILL_ROOT/scripts/record_mined_paths.py" \
--mined-neighbors-parquet "$RUN_DIR/iter_${ITER}/mining/mined_neighbors.parquet" \
--mined-log-parquet "$RUN_DIR/mining/mined_paths_log.parquet"Future iterations filter their train/source embedding pool with the cumulative log. This does not remove records from the already assembled training annotation JSON.
When mining.mine_unique_only is false, do not run the command; append a record_mined_paths event with status=skipped so resume can advance unambiguously.
Prepare Cosmos Reason training:
"$DEFT_PYTHON" "$DEFT_SKILL_ROOT/scripts/prepare_cosmos_reason_train.py" \
--workspace "$WORKSPACE" \
--workflow-yaml "$WORKSPACE/specs/workflow.yaml" \
--run-dir "$RUN_DIR" \
--iteration "$ITER"Nearest-neighbor output contains only selected source filepaths. The preparation script joins those paths back to the train embeddings parquet to recover each source row's modality, writes $RUN_DIR/iter_<N>/mining/mined_train_annotations.json, accumulates it into $RUN_DIR/iter_<N>/train/train_annotations.json, and writes $RUN_DIR/iter_<N>/train/specs/train.toml. A text source path selects its corresponding train question; a video source path selects every train annotation row whose video_path matches. Output records preserve the source annotation_id as their LLaVA id and are deduplicated by that stable id.
Iteration 1 trains on mined annotations only; train_dataset.annotations_path remains a mining source pool and is not inserted directly. Later iterations accumulate the previous iteration's assembled annotations. Iteration 1 starts from the prepared checkpoint recorded in baseline/model_preparation.json. Later iterations use the checkpoint recorded in the previous iteration's generated evaluate TOML only when cosmos_reason.continual_model: true; otherwise they start from that same prepared baseline. Preparation counts the assembled annotations and calculates expected optimizer steps from train.epoch, train.train_batch_per_replica, policy.parallelism.dp_shard_size, dp_replicate_size, and train.train_policy.dataloader_drop_last (which defaults to true when absent). If the result is zero, stop before launch, report the values, and tell the user that the training parameters likely need tuning for that iteration's dataset size and GPU count.
Train Cosmos Reason: run the pinned
cosmos-rl --config <train.toml> /opt/cosmos_rl/tao_sft_example.pycommand with$RUN_DIR/iter_<N>/train/specs/train.toml. Keep monitoring the submitted job until it reaches terminal success. Do not infer completion from checkpoint files appearing during training. After terminal success, require the final structured status or training log to report at least one completed optimizer step. If it reports zero, stop before checkpoint discovery or evaluation, tell the user the parameters likely need tuning, and ask how to proceed. Then restore host write access before checkpoint discovery or evaluation preparation:
"$DEFT_PYTHON" "$DEFT_SKILL_ROOT/scripts/restore_docker_mount_permissions.py" \
--path "$RUN_DIR/iter_${ITER}/train" \
--docker-image "$DEFT_COSMOS_REASON_IMAGE"Do not continue unless the helper succeeds.
Prepare and run evaluation: after the training job reaches terminal success, prepare evaluation:
"$DEFT_PYTHON" "$DEFT_SKILL_ROOT/scripts/prepare_cosmos_reason_evaluate.py" \
--workspace "$WORKSPACE" \
--workflow-yaml "$WORKSPACE/specs/workflow.yaml" \
--run-dir "$RUN_DIR" \
--iteration "$ITER"The preparation command finds the latest epoch_<N> safetensors checkpoint under this iteration's completed train directory, prints the selected path, and writes it into $RUN_DIR/iter_<N>/evaluate/specs/evaluate.toml. If no checkpoint exists, stop before launching evaluation. Run the pinned cosmos-rl-evaluate --config command with that TOML. After the job exits successfully, restore host write access before result discovery:
"$DEFT_PYTHON" "$DEFT_SKILL_ROOT/scripts/restore_docker_mount_permissions.py" \
--path "$RUN_DIR/iter_${ITER}/evaluate" \
--docker-image "$DEFT_COSMOS_REASON_IMAGE"Do not continue unless the helper succeeds. Then locate the result and compute that iteration's metrics:
ITERATION_RESULTS_JSON="$("$DEFT_PYTHON" "$DEFT_SKILL_ROOT/scripts/find_cosmos_reason_results.py" \
--evaluate-dir "$RUN_DIR/iter_${ITER}/evaluate")"
"$DEFT_PYTHON" "$DEFT_SKILL_ROOT/scripts/compute_bcq_accuracy_metrics.py" \
--results-json "$ITERATION_RESULTS_JSON" \
--output-json "$RUN_DIR/iter_${ITER}/evaluate/bcq_accuracy_metrics.json"Report the printed accuracy, balanced accuracy, false-positive count, false-negative count, and unparseable count in the iteration update. Log both files as evaluate artifacts. The evaluate stage is not complete until bcq_accuracy_metrics.json exists. Use ITERATION_RESULTS_JSON as the next iteration's PREVIOUS_RESULTS_JSON.
Clean Cosmos Reason training checkpoints: after evaluation and metric computation complete, remove the large resumable Cosmos-RL checkpoints while retaining the exported safetensors used by later iterations:
"$DEFT_PYTHON" "$DEFT_SKILL_ROOT/scripts/cleanup_cosmos_reason_training.py" \
--train-dir "$RUN_DIR/iter_${ITER}/train"The command removes only each <timestamp>/checkpoints/ directory and the train directory's best/checkpoints link. It also removes a legacy <timestamp>/best/checkpoints link when present. It preserves every <timestamp>/safetensors/epoch_<N> export, training logs, specs, and annotations. It refuses to delete anything unless at least one safetensors epoch export exists, and writes $RUN_DIR/iter_<N>/train/checkpoint_cleanup.json. Log that report as the cleanup_cosmos_reason_training artifact before starting the next iteration. If Docker ownership prevents cleanup, restore write access to the iteration train directory with restore_docker_mount_permissions.py and the Cosmos Reason image, then retry this stage.
Final Accuracy Report
After the loop stops because it reached max_iterations or found no weak samples, generate the baseline/iteration report. Also generate it after a failed run when baseline metrics are available, so completed evaluations are not lost from the final account.
"$DEFT_PYTHON" "$DEFT_SKILL_ROOT/scripts/summarize_bcq_accuracy_metrics.py" \
--run-dir "$RUN_DIR"This writes $RUN_DIR/bcq_accuracy_report.md and $RUN_DIR/bcq_accuracy_summary.json. Read bcq_accuracy_report.md and include its full accuracy table in the agent's final response; providing only the artifact path is not sufficient. Log both report files as loop_stop artifacts together with the stop reason.
Completion Criteria
| Stage | Complete when |
|---|---|
validate_workflow | verify_workflow_yaml.py exits successfully. |
initialize_workflow | $RUN_DIR/workflow.yaml and $RUN_DIR/deft_state.json exist. |
prepare_cosmos_reason_model | baseline/model_preparation.json records status=ready and successful pinned-runtime validation. |
baseline_evaluate | The evaluate job exits successfully, exactly one baseline results.json is found, and baseline/evaluate/bcq_accuracy_metrics.json exists. |
prepare_cosmos_embed_inference | Each dataset has a lookup parquet and either all required Cosmos Embed specs or a staged combined embedding Parquet. |
cosmos_embed | Every generated inference spec has a current completion_validation.json; validated exit 130 is recorded as a teardown warning, and all other nonzero exits fail. |
convert_embeddings | embedding_parquets/{kpi,train}/embeddings.parquet exist with the required modalities. |
gap_analysis | $RUN_DIR/iter_<N>/gaps/predictions.json exists and the container exits successfully. The workflow counts valid rows directly from kpi_gaps.jsonl; missing or empty output after successful completion means zero weak samples. |
prepare_nearest_neighbor_mining | The target, optional filtered source, and nearest-neighbor spec exist. |
mine_nearest_neighbors | One mined-neighbor parquet and mining summary exist. |
record_mined_paths | The cumulative log exists when enabled, or a skipped event is logged when disabled. |
prepare_cosmos_reason_train | Mined and accumulated LLaVA annotations plus train/specs/train.toml exist, with a positive expected optimizer-step count. |
train | The Cosmos Reason job reaches terminal success, reports at least one optimizer step, and has writable timestamped output and checkpoint directories. |
evaluate | Evaluation preparation finds the latest completed training checkpoint, the evaluation job exits successfully, exactly one iteration results.json is found, and its bcq_accuracy_metrics.json exists. |
cleanup_cosmos_reason_training | train/checkpoint_cleanup.json exists, all timestamped checkpoints/ directories and best/checkpoints links are absent, and the listed safetensors exports still exist. |
loop_stop | Stop reason is logged; the run-level Markdown and JSON accuracy reports cover the baseline and every completed iteration. |
Requirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Needs: Declares allowed tools, Needs Python
The author says: Requires Docker with NVIDIA Container Toolkit, Python 3.11 with venv/ensurepip, numpy, pandas, pyarrow, PyYAML, and huggingface_hub, plus the selected platform CLI.
Security
What our scanner noticed· Medium risk
- Large base64-encoded blobs
- Instructions that use the network
- Scripts that your agent may run
This skill includes scripts that your agent may run. Read them before you use it.
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Created by
- NVIDIA Corporation
- Publisher
- NVIDIA (Official)
- Source
- NVIDIA/skills · skills/tao-run-deft-cr-its-mining · commit fce3cca
- Licence
- Apache License 2.0 (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE-APACHE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by NVIDIA Corporation or NVIDIA.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download tao-run-deft-cr-its-mining.zip