Skip to content
Back to skills

Data And Datasets

ASecurity

"Build and validate torchtune dataset configs, message transforms,

  • 247 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added September 9, 2026
ai-agentspythonbashapi

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 5 files and shows the line behind each finding

Scanned September 9, 2026

npx -y skills add VectorSpaceLab/AREX-Skill --skill data-and-datasets --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Data And Datasets?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Data And Datasets
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vectorspacelab-data-and-datasets-fefe8c28/badge)](https://www.skillsdirectory.com/skills/vectorspacelab-data-and-datasets-fefe8c28)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: data-and-datasets
description: "Build and validate torchtune dataset configs, message transforms,
  packing, prompt templates, multimodal rows, and collators."
disable-model-invocation: true
metadata:
  disco-role: operating
license: BSD 3-Clause
---

# data-and-datasets

Use this sub-skill when a torchtune task is about dataset shape, `Message` conversion, input masking, local or Hugging Face data sources, sample packing, prompt templates, multimodal text+image rows, or batch collation.

## Route Tasks

- Choose `instruct_dataset` or `InputOutputToMessages` for single-turn `input`/`output` SFT rows.
- Choose `chat_dataset`, `ShareGPTToMessages`, or `OpenAIToMessages` for multi-turn conversations.
- Choose `preference_dataset` or `ChosenRejectedToMessages` for DPO/reward data with `chosen` and `rejected` conversations.
- Choose `text_completion_dataset` for free-form pretraining-style corpora with a text column.
- Choose `torchtune.datasets.multimodal` builders for text+image SFT rows, and keep image handling in the dataset/model transform boundary.
- Choose `PackedDataset` only when the tokenizer or model transform has `max_seq_len` and the recipe expects packed SFT/text-completion batches.

## Standard Workflow

1. Identify the raw row shape and source: Hugging Face dataset name, local `json`/`jsonl`/`csv`/`text`, or remote file URL.
2. Map raw columns to the expected torchtune keys with `column_map`, `conversation_column`, or builder-specific arguments.
3. Convert rows to `Message` lists before tokenization; validate role order and non-empty content early.
4. Pair the dataset builder with the correct tokenizer or model transform from [models-and-modules](../models-and-modules/SKILL.md).
5. Decide masking with `masking_strategy` where exposed, or legacy `train_on_input` when using builder config fields.
6. Decide packing and collation after verifying tokenized sample keys match the target recipe in [post-training-recipes](../post-training-recipes/SKILL.md).
7. Use [cli-and-config](../cli-and-config/SKILL.md) for `tune cp`, `tune cat`, `tune validate`, registry names, and launch syntax; do not import `recipes` as a Python package.

## References

- [Data formats](references/data-formats.md) explains row shapes, YAML fragments, packing, prompt templates, collators, and local/HF source assumptions.
- [API reference](references/api-reference.md) lists the practical torchtune data and dataset signatures agents usually need.
- [Troubleshooting](references/troubleshooting.md) maps common data failures to fixes.
- [JSONL validator](scripts/validate_messages_jsonl.py) checks message, input-output, chat, and preference rows without training or downloads.

## Quick Validation

From this sub-skill directory, run the bundled validator on a local JSONL sample before wiring it into a recipe:

```bash
python scripts/validate_messages_jsonl.py data/sample.jsonl --shape auto
```

For multimodal rows with local image paths:

```bash
python scripts/validate_messages_jsonl.py data/sample.jsonl --shape conversations --image-key image --image-root data --check-image-paths
```

The validator is intentionally lightweight: it parses JSONL, checks required columns, checks message role/content structure, optionally checks local image paths, and never imports torch, starts training, or downloads datasets.

Files in this skill

  • SKILL.md3.3 KB
  • references/api-reference.md8.4 KB
  • references/data-formats.md8.8 KB
  • references/troubleshooting.md7.4 KB
  • scripts/validate_messages_jsonl.py17.7 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.