Logo di Litdata

Litdata

Organizzazione
Lightning-AI
litdata

Expert use of the LitData library and work on its codebase. Use when writing or reviewing code that calls litdata (StreamingDataset, StreamingDataLoader, StreamingRawDataset, optimize, map, CombinedStreamingDataset, ParallelStreamingDataset, TokensLoader, serializers, typed media wrappers Text/Audio/Video/Image/Jpeg/File/Tensor/Graph/…, list_media_folder, litdata_collate, train_test_split, complete_dataset, merge_datasets, index_parquet_dataset, index_hf_dataset), answering how-to questions, choosing raw vs optimize vs parquet/HF/MDS, keyed lookup (`key_fn`, `build_keys_index`, `dataset_update`, `get_by_key`), elastic mid-epoch resume, tuning cache/prefetch/shuffle/seed, resolving paths (s3/gs/r2/azure/hf/local:/teamspace via resolver.py), documenting or debugging optimize/map I/O (shared queue, async Downloader download/upload, LITDATA_OPTIMIZE_*), FsProvider vs Downloader, FUSE s3_connections/s3_folders, multi-node DATA_OPTIMIZER_* / num_nodes jobs, POSIX-fast mmap, litsim simulator, or when navigating/editing src/litdata, tests, CI, examples/modality, or debugging streaming / optimize / map. Also use for enable_tracer / Litracer / Perfetto, and multi-worker s3:// FileNotFoundError or obstore-after-fork / Studio R2 data_connection_id Session TypeError.

Panoramica

AutoreLightning-AI
RepositorylitData
Nome della skilllitdata
Stelle
616
Fork
110
File inclusi
16
LicenzaApache-2.0
Link
  • Istruzioni in Markdown

    Un file SKILL.md che il modello carica quando serve, consumando token solo quando una richiesta è effettivamente pertinente.

  • Funziona con qualsiasi LLM

    Le skill IA sono in semplice Markdown, non in codice specifico di un fornitore, quindi funzionano con GPT, Claude, Gemini, Grok o un modello locale.

  • 16 file inclusi

    Script, modelli di documento e riferimenti che il modello può leggere mentre lavora. I file sono di sola lettura e non vengono mai eseguiti.

  • Open source

    Pubblicata da Lightning-AI su GitHub. Leggi i sorgenti prima di installarla.

Installazione

Installa la skill IA Litdata in TypingMind per usarla con qualsiasi LLM, oppure copiala in un altro agente in grado di leggere SKILL.md.

1

Installa in TypingMind

TypingMind installa una skill direttamente dalla sua cartella GitHub: legge SKILL.md, raccoglie i file delle risorse e salva il risultato in locale.

  1. Apri l'app e vai su Plugin → Skill.
  2. Scegli "Installa da GitHub".
  3. Incolla l'URL della cartella della skill riportato qui sotto e conferma.
    https://github.com/Lightning-AI/litData/tree/main/.claude/skills/litdata
  4. Attiva la skill in ogni chat in cui vuoi averla a disposizione.
Plugin → Skill → Nuova skill → Da URL GitHub, poi incolla l'URL della cartella e premi Continua.
2

Installa in un altro agente

Qualsiasi agente che legge il formato Agent Skills può usare questa skill: copia la cartella nella cartella delle skill di quell'agente.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/Lightning-AI/litData.git /tmp/litData
mkdir -p .claude/skills
cp -r /tmp/litData/.claude/skills/litdata .claude/skills/litdata
Dopo la copia, riavvia Claude Code per caricare la nuova skill.

Usala in TypingMind

Attiva Litdata in qualsiasi chat di TypingMind e al resto pensa il modello. Il nome e la descrizione della skill sono nel prompt di sistema e, non appena arriva una richiesta pertinente, il modello carica da solo le istruzioni complete: non devi mai richiamarla manualmente e non consuma token finché non viene effettivamente usata.

Il modello carica automaticamente Litdata non appena riceve una richiesta pertinente.

Funziona con qualsiasi modello IA

Le skill IA sono semplici istruzioni in Markdown, non codice specifico di un fornitore, quindi Litdata non è vincolata al modello per cui è stata scritta. Installala una sola volta in TypingMind e usala con GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama o un modello locale che esegui tu, sempre con le tue chiavi API.

  • Caricata solo quando serve

    Il prompt di sistema contiene solo il nome e la descrizione. Le istruzioni vengono recuperate alla prima richiesta pertinente, quindi una skill inutilizzata non costa nulla.

  • Cambia modello durante la chat

    Poiché la skill è composta da istruzioni e non da codice, continua a funzionare anche se cambi modello: il nuovo modello legge lo stesso file SKILL.md.

Istruzioni della skill

Questo è il contenuto di SKILL.md che il modello carica. Leggilo prima dell'installazione: una skill è un insieme di istruzioni che il tuo modello seguirà.

LitData

LitData (import litdata) preprocesses and streams datasets for PyTorch training:

  • Write (optimize / map) → chunked chunk-*.bin + index.json → src/litdata/processing/
  • Read (StreamingDataset + StreamingDataLoader) → cache → decode → batch → src/litdata/streaming/
  • Raw (StreamingRawDataset) → stream original files without optimize → src/litdata/raw/

To use the library expertly: always load reference/using-litdata.md first. Narrative source: repo README.md.

Install this skill

From any project (Cursor, Claude Code, and other agents supported by the skills CLI):

bash
npx skills add Lightning-AI/litData

Useful options: -g (user-global), -a cursor (Cursor only), -y (non-interactive). In this repo the skill already lives at .claude/skills/litdata/.

Expert usage (load using-litdata.md)

Before writing examples or answering how-tos, read the cookbook. Highlights:

TopicRemember
Raw filesStreamingRawDataset + torch DataLoader — #stream-raw / §10. Prefer cloud URL / connection path over FUSE. Defaults: max_concurrent_downloads=None (adaptive Stage 1), max_prefetch=16 (worker-aware ~64 aggregate), hedge_delay=0, download_timeout=120 (batch-level), range_parallel_threshold=0. Explicit int concurrency = exact permits.
Images / mediaAlways wrap so a caption is not a path: Text / Image / Audio / Video / File / … (types.py). Class folders: list_media_folder(root, kind=…). Recipes: examples/modality/. README #modality (#media-types). Bare PIL.Image / fromarray → huge PIL RAW. litdata_collate only special-cases graphs — Audio/Video need a custom collate_fn.
Train streamOptimized: StreamingDataLoader + shuffle=True, drop_last=True, seed=…
Optimizeif __name__ == "__main__"; exactly one of chunk_bytes | chunk_size. Default 64MB; multi‑MB samples → consider 256–512MB. Shuffle the sample list before optimize() when source order matters — README #faq-chunk-shuffle
Ordered dataChunk/item shuffle ≠ file-level shuffle. Shuffle before optimize, or use StreamingRawDataset + DataLoader(shuffle=True). LitData does distributed + within-chunk bucket sampling automatically
CachePeak disk ≈ num_workers × max_pre_download × chunk_size; default max_cache_size=None (75% of free disk, leave ≥50GB). "100G" or 0.90 of free.
POSIX-fastLocal/Vast/NFS: mmap in place, no cache copy. WindowShuffle only on parallel FS (or LITDATA_POSIX_FAST=1). Cap workers / skip WILLNEED from MemAvailable. LITDATA_POSIX_FAST=0 disables.
PathsStudio /teamspace/s3_connections & co are FUSE (convenience only — slow, can crash under load). LitData resolves them and talks directly to S3/GCS/R2. Never read the mount by hand. reference/resolver.md + reference/data-movement.md
Optimize I/ODefault keep_data_ordered=False: per-node shared queue; download/upload/remove are node-level threads. Remote I/O uses the streaming Downloader (adownload_file / aupload_file). FsProvider is the fallback / index path. Tune LITDATA_OPTIMIZE_* / LITDATA_PREFETCH_BYTES. Load reference/data-movement.md.
Multi-nodenum_nodes= = Lightning Studio job (_execute), not torchrun/SLURM. Shard by DATA_OPTIMIZER_*; all ranks upload chunks; last node merges {node}-index.json → index.json. Load reference/multi-node.md.
ThroughputRough ImageNet Studio order-of-magnitude (not guarantees): FUSE ~600/s · Raw (right tuning) ~6–7k/s · Optimized 64MB chunks ~11k/s — using-litdata.md FAQ. Raw benches: medians + provenance SHAs; never cite short-window n=1 against Stage 0 medians.
Tracingfrom litdata.debugger import enable_tracer then enable_tracer(level="chunk") (or categories=["download","read","delete"]). Convert with Lightning-AI/litracer: litracer --quiet --validate -o trace.json.gz litdata_debug.log. One line per event; crashes go to stderr + ph: I. Full spec: reference/debugging.md.
S3 workersindex.json is boto3 (no parent tokio). Workers lazy-init obstore; boto3 fallback if parent already started it. Do not pass data_connection_id / endpoint_url into boto3.Session — build obstore from S3Client/R2Client. FileNotFoundError after 120s with num_workers>0 only → debugging.md failure modes.
Keyed lookupoptimize(..., key_fn=...) writes keys/. Read ds["id"] / get_by_key. Patch locally with dataset_update. Needs polars. keyed-lookup.md.
Parquet / HFOne-liner: StreamingDataset("hf://datasets/org/name/data") (auto-index + ParquetLoader). Index persists at {cache}/hf-index/<hash>/index.json (no re-scan). Default prefetches whole parquet then local to_pylist(). Do not default range_read=True (lost to HF on Hub). spawn with workers. Token: HF_TOKEN. using-litdata.md §10.

Reference map

TaskRead
Use the library (raw, optimize/stream, modality, parquet/HF, serializers)reference/using-litdata.md
Paths / URLs / Studio mounts / Dir / time templatesreference/resolver.md (+ README #resolve-paths)
Downloaders / uploaders / removers / FUSE→cloud / optimize I/Oreference/data-movement.md (+ processing.md)
Multi-node optimize/map (num_nodes, DATA_OPTIMIZER_*, index merge)reference/multi-node.md (+ processing.md)
Read path, shuffle math, item loaders, Combined/Parallelreference/streaming.md
Cache / BinaryWriter / BinaryReader / index.json / FsProvider / samplerreference/storage-format.md
Cache / prefetch / eviction / shared-chunk deletionreference/cache-and-chunk-lifecycle.md
Env vars (async prefetch, cache, debug, DATA_OPTIMIZER_*, Studio)reference/env-vars.md
Fair streaming benchmarks (benchmarks/ suite)reference/benchmarking.md
Offline streaming what-if (litsim)repo simulator/README.md
Raw adaptive concurrency / look-ahead stages (clients own rate)repo benchmarks/ADAPTIVE_CONCURRENCY.md
Lightning Studio env, credentials, free-threadingreference/lightning-studio.md
Write path orchestration; raw internals; pointers to I/O + multi-nodereference/processing.md
Dev env, PR/CI stylereference/contributing.md
Tests & fixturesreference/testing.md
Tracing (enable_tracer, Litracer, Perfetto), breakpoints, env knobsreference/debugging.md
Keyed lookup / dataset_update / key_fnreference/keyed-lookup.md

Public API (src/litdata/__init__.py)

SymbolPurpose
StreamingDataset / StreamingDataLoaderOptimized stream + resumable loader
CombinedStreamingDataset / ParallelStreamingDatasetMix or zip streams
StreamingRawDatasetRaw file stream
TokensLoaderToken windows for LLMs
optimize / map / merge_datasets / walk / complete_datasetWrite / transform / merge / finish index
list_media_folder / iter_webdataset_tarClass-folder / WebDataset ingest lists
Audio Video Image Jpeg JpegArray Pil Tiff File Mesh Pdf Nifti Tensor Text GraphTyped media leaves for optimize
litdata_collateLoader default; PyG Batch only for graphs
dataset_update / build_keys_indexKeyed in-place patch / backfill sidecar
train_test_splitSplit by chunk ROIs
index_parquet_dataset / index_hf_dataset / optimize_hfIndex parquet / convert Hub parquet → chunks
breakpointMultiprocessing-safe pdb
enable_tracer (litdata.debugger)Pipeline log → Litracer / Perfetto

Defined under streaming/, processing/, raw/, utilities/ — see cookbook §6–9 for constructor args.

Package map

  • streaming/ — read · processing/ — write · raw/ — raw stream · types.py — media wrappers · cli/ — litdata cache path|clear
  • utilities/ — env, encryption, subsample, split, parquet, HF
  • constants.py — optional-dep flags, env knobs, default chunk 64 MB
  • Registries: downloaders, fs providers, serializers, compressors; resolver.py → Dir

Shared concepts

  • Chunk: [num_items][offsets][data]; index.json holds chunks + config (data_format, item_loader, …) — storage-format.md.
  • Item loaders own layout + intervals (PyTreeLoader, TokensLoader, ParquetLoader).
  • Training downloads = Downloader. Optimize remote I/O prefers the same Downloader (adownload_file / aupload_file); FsProvider remains for index merge and fallback. See data-movement.md. Sampler ChunkedIndex is read-path; CacheBatchSampler is CacheDataLoader only.
  • Ranks from env (_DistributedEnv / DATA_OPTIMIZER_*), not a custom network.
  • Shuffle deterministic from seed+epoch+chunk → resumable (shuffle.py, not sampler.py). Local POSIX-fast keeps FullShuffle unless the mount is Vast/NFS/Lustre/GPFS (or LITDATA_POSIX_FAST=1 → WindowShuffle).
  • Design: one less thing to remember; pure PyTorch; backward compatible; test-driven.

Traps (do not “fix” by guessing)

  • FileNotFoundError / ChunkWaitTimeoutError after ~120s on chunks with num_workers>0 is usually prefetch-thread death or wait timeout — not a missing object. Check stderr + tracer crash.
  • mode="append" vs use_checkpoint=True: append continues chunk indices; checkpoint resumes input slices. Combining them is unsafe; checkpoint filenames / done_till_index are known-fragile (writer.save_checkpoint vs data_processor load).
  • Azure/HF resolve for read; optimize write providers are s3/gs/r2 only (_SUPPORTED_PROVIDERS).
  • dataset_update: local dirs only; ds[int] is positional.
  • Empty Tensor() is not tokens. Only 1-D Tensor(array=…) (or path= / bytes= + dtype=) uses the TokensLoader layout. Empty Text() / JpegArray() fail on write.
  • Bare .txt / .npy / .bin path strings pickle the path. Wrap with Text / File / load the array. Bare *.jpg / *.png / *.wav paths are claimed as media.
  • litdata_collate only batches graphs. A dict with AudioDecoder / video decoder + a stackable field needs a custom collate_fn (see examples/modality/audio.py).

Quick commands

bash
make setup
pre-commit run --all-files
mypy
pytest tests/path/test_x.py::test_name -v --capture=no
litdata cache path
litdata cache clear

Examples: examples/ (modality recipes: examples/modality/). Version: src/litdata/__about__.py.

File inclusi

Il modello legge questi file quando servono, mentre la skill è caricata. Sono accessibili in sola lettura e non vengono mai eseguiti.

Domande frequenti

Cosa fa la skill IA Litdata?

Expert use of the LitData library and work on its codebase. Use when writing or reviewing code that calls litdata (StreamingDataset, StreamingDataLoader, StreamingRawDataset, optimize, map, CombinedStreamingDataset, ParallelStreamingDataset, TokensLoader, serializers, typed media wrappers Text/Audio/Video/Image/Jpeg/File/Tensor/Graph/…, list_media_folder, litdata_collate, train_test_split, complete_dataset, merge_datasets, index_parquet_dataset, index_hf_dataset), answering how-to questions, choosing raw vs optimize vs parquet/HF/MDS, keyed lookup (`key_fn`, `build_keys_index`, `dataset_upd...

Perché usare Litdata su TypingMind?

Perché la installi una volta e la usi con qualsiasi modello. Litdata è scritta in semplice Markdown anziché in codice specifico di un fornitore, quindi la stessa skill funziona con GPT-5, Claude, Gemini, Grok o un modello locale, e puoi cambiare modello durante la chat senza che smetta di funzionare. TypingMind usa le tue chiavi API, quindi paghi direttamente i fornitori anziché un abbonamento per posto utente, e le tue skill e chat restano nel tuo spazio di archiviazione.

Come installo Litdata in TypingMind?

Apri Plugin → Skill → Installa da GitHub in TypingMind e incolla https://github.com/Lightning-AI/litData/tree/main/.claude/skills/litdata. TypingMind legge il file SKILL.md, include i file associati e installa la skill, che puoi abilitare per ogni singola chat.

Quali modelli IA possono usare Litdata?

Qualsiasi modello che colleghi in TypingMind. Le skill IA sono semplici istruzioni in Markdown anziché codice specifico di un fornitore, quindi GPT, Claude, Gemini, Grok e i modelli locali possono tutti caricare questa skill quando una richiesta corrisponde al suo scopo.

Quanti modelli IA posso usare con Litdata?

Quanti ne vuoi. Se un modello supporta le skill, puoi usarlo con Litdata: GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama e molti altri, tutti su TypingMind con le tue chiavi API.

La skill IA Litdata è gratuita?

Sì. È pubblicata su GitHub da Lightning-AI con licenza Apache-2.0. Paghi solo il tuo fornitore IA per i token che usi.

Cosa sono le skill IA?

Una skill IA è un pacchetto di istruzioni riutilizzabili che insegna a un modello IA come svolgere un'attività specifica. Segue il formato aperto Agent Skills: un file SKILL.md con un nome e una descrizione, più eventuali script, modelli o file di riferimento di cui il modello potrebbe aver bisogno. Il modello legge le istruzioni solo quando la tua richiesta corrisponde alla skill, quindi una skill installata non comporta costi finché non viene usata.

In cosa si differenziano le skill IA dai plugin o dai server MCP?

Un plugin o un server MCP fornisce a un modello nuovi strumenti da richiamare: codice che viene eseguito da qualche parte e restituisce un risultato. Una skill IA, invece, fornisce al modello conoscenze e procedure: come affrontare un'attività, quali passaggi seguire e quali caratteristiche deve avere un buon output. Le skill sono semplici istruzioni in Markdown, quindi non richiedono server, chiavi API né ambienti di esecuzione e funzionano con qualsiasi modello.

Vedi tutti

Crea subito la tua area di lavoro IA

Iscriviti alla nostra newsletter per ricevere aggiornamenti sulle nuove funzionalità e sulle prossime iniziative a premi 👇