Hugging Face, End to EndLesson 45 of 75

Module 5 · Datasets, and the work that happens before any model

Media columns decode when you touch them

In this lesson

  • 8 min read
  • 6 reading sections
  • Knowledge check
  • Lesson 8 of 10 in this chapter

This chapter’s goalInspect, stream, filter and transform a dataset far larger than your RAM, query the Hub’s parquet conversion with SQL before downloading anything, run duplicate, leakage and class-balance checks on your own data, and publish it with a card stating provenance and licence.

This chapter’s media

The film explains chapter ideas. The audiobook narrates the complete teaching text.

FormatEnglishहिंदी
Chapter filmWatch2:05Not available
Full audiobookNot availableNot available

A little at a time

Explore an idea, try it, then check what stays.

Step 1 of 8Free · no account needed
Lesson steps

What is actually stored

Python
ds = load_dataset("PolyAI/minds14", "en-US", split="train")
print(ds.features["audio"])
# Audio(sampling_rate=8000, mono=True, decode=True,
# id=None)

row = ds[0]
print(
    row["audio"]["array"].shape,
    row["audio"]["sampling_rate"],
)

The stored column holds a path or the encoded bytes. The decoded waveform appears only when you access the row: Audio and Image are lazy decoding types. So a dataset of 100,000 photographs takes the disk of 100,000 compressed JPEGs, not of 100,000 raw arrays, and iterating decodes one at a time.

Two consequences worth holding:

  • Never call ds.map over a media column carelessly. If your function touches row["image"], every image decodes and the result is written back as decoded data, which can be fifty times the size. Use set_transform for augmentation, or return only the small derived columns you need.
  • ds.cast_column("image", Image(decode=False)) gives you paths and bytes without decoding, which is what you want for deduplication, hashing or copying files.

Your place and first choices stay on this browser. Classroom credit is recorded separately.

Every lesson here is open. Your progress is recorded once you pass the Image Generation, in Practice exam.

Stuck on something?Ask Arjun, your AI tutor

How to cite: Addaly (2026) ‘Media columns decode when you touch them’, in Hugging Face, End to End. Edited by M. Mun. Addaly. Available at: https://addaly.com/learn/hugging-face/audio-and-image-datasets (Accessed: 29 November 2026).