TAI BUI
Back to curriculum
BuildPython

Fuel: APIs and Data

Your code doesn't create intelligence — it borrows it, from a model API and from a pile of data you didn't generate yourself. Get sloppy with either one and everything you build on top of it inherits the sloppiness.

TIME: ~75 minutesPREREQUISITES: Phase 0, Lesson 01

Learning Objectives

  • Store API keys securely and make your first LLM call through both an SDK and raw HTTP
  • Diagnose the API errors you'll actually hit, like bad auth and rate limits, before they cost you an afternoon
  • Load, stream, and cache datasets with the Hugging Face `datasets` library, and convert between CSV, JSON, Parquet, and Arrow
  • Build reproducible train/val/test splits and keep large model and data files out of git with .gitignore, Git LFS, or DVC

The Problem

Starting in Phase 11 you call LLM APIs: Anthropic, OpenAI, Google. Starting in Phase 4 you pull in datasets to tokenize, train on, and evaluate against. Neither of these is something your code produces itself. Both are raw material you're borrowing from outside the repo, and both fail in the same boring, avoidable ways if you don't set them up right: a leaked key, a rate limit you didn't see coming, a dataset that won't fit in memory, an experiment nobody else can reproduce because the split wasn't seeded.

You need two things before any of the later phases make sense: a safe way to store and call API keys, and a repeatable workflow for finding, loading, splitting, and versioning data instead of hand-rolling it every time.

Warm-up0/3
1. Why should API keys never be hardcoded directly in source code?Warm-up
A file app.py in a folder my-bot with the Anthropic client created with an api_key string written directly in the code, next to a folder listing app.py and README.md and a note that the project will be put online for classmates.
2. You delete a password from a file and commit the change to a public repository. Why is the password still exposed?Warm-up
Terminal: config.txt now holds only a host line, git log --oneline lists two commits (Add config, then Remove password from config), then git push origin main to a public GitHub repository.
3. A web request fails with a status code in the 400s, such as 404. Which side most likely caused the problem?Warm-up
Terminal where curl -i for https://example.com/reports/2024 prints HTTP/1.1 404 Not Found, above a chain of four boxes: Your browser, Internet provider, Web server, Database.

The Concept

Every AI project pulls in exactly two things from outside your own code: a model API and a dataset. Almost everything else you write either calls one or feeds the other.

Mermaid diagram

Your code never runs the AI model itself. The model lives on a computer that belongs to Anthropic, OpenAI, or Google, sitting in a data center you'll never see. Calling an API means sending a message from your computer to theirs over the internet, then waiting for a message to come back. That round trip out and back is the entirety of what "calling an API" means.

An API call is four things: an endpoint (a URL), an API key (who's asking), a request body (what you want), and a response body (what you get back). Anthropic, OpenAI, and Google all follow this shape; the field names differ, the pattern doesn't. Step 2 in Build It below turns this exact shape into runnable code.

Mermaid diagram

Data follows its own version of the same discipline: find it, load it, convert it if the format's wrong for your pipeline, split it into train/val/test, cache it so you're not re-downloading gigabytes on every run, and version it so the experiment is reproducible on someone else's machine. The Hugging Face datasets library is the standard tool here because it handles downloading, caching, format conversion, and streaming out of the box, so you're not writing that plumbing yourself.

Check: The Concept0/3
1. What is an API key used for when calling an LLM service?Define
An account page with one API key named laptop, partly hidden and shown in full only at creation, next to a script first_call.py that creates an Anthropic client and calls messages.create.
2. When your code calls an LLM API, what is actually happening?Define
A script hello.py that creates an Anthropic client and calls messages.create with the prompt about a neural network, beside a laptop spec card (16 GB RAM, no GPU, wifi on), and a terminal running the script and printing a one-sentence answer.
3. What are the four parts of an API call?Define
Raw text of one API exchange: a POST to https://api.anthropic.com/v1/messages with three header lines and a JSON body containing model, max_tokens and messages, followed by an HTTP/1.1 200 OK response with a JSON body.

Build It

Step 1: Store API keys safely

Never put API keys in code. Use environment variables instead.

An environment variable is a named value your operating system keeps available to any program you run, not just the one that set it. Set ANTHROPIC_API_KEY once in your shell and every script you run afterward can read it, without that key ever being written into a file you might commit to git.

bash
export ANTHROPIC_API_KEY="sk-ant-..."
export OPENAI_API_KEY="sk-..."

Or use a .env file (add it to .gitignore):

ANTHROPIC_API_KEY=sk-ant-...
OPENAI_API_KEY=sk-...

Step 2: First API call (Python)

python
import anthropic
 
client = anthropic.Anthropic()
 
response = client.messages.create(
    model="claude-sonnet-4-20250514",
    max_tokens=256,
    messages=[{"role": "user", "content": "What is a neural network in one sentence?"}]
)
 
print(response.content[0].text)

Step 3: First API call (TypeScript)

typescript
import Anthropic from "@anthropic-ai/sdk";
 
const client = new Anthropic();
 
const response = await client.messages.create({
  model: "claude-sonnet-4-20250514",
  max_tokens: 256,
  messages: [{ role: "user", content: "What is a neural network in one sentence?" }],
});
 
console.log(response.content[0].text);

Step 4: Raw HTTP, no SDK

Every SDK call in Step 2 and Step 3 is a wrapper around one HTTP request. Seeing that request directly, with no library in between, is what lets you read the raw response yourself when an SDK error message doesn't tell you enough.

python
import os
import urllib.request
import json
 
url = "https://api.anthropic.com/v1/messages"
headers = {
    "Content-Type": "application/json",
    "x-api-key": os.environ["ANTHROPIC_API_KEY"],
    "anthropic-version": "2023-06-01",
}
body = json.dumps({
    "model": "claude-sonnet-4-20250514",
    "max_tokens": 256,
    "messages": [{"role": "user", "content": "What is a neural network in one sentence?"}],
}).encode()
 
req = urllib.request.Request(url, data=body, headers=headers, method="POST")
with urllib.request.urlopen(req) as resp:
    result = json.loads(resp.read())
    print(result["content"][0]["text"])

.encode() turns the JSON text into raw bytes, which is the form data actually travels in over a network connection. json.loads() on the other end does the reverse: bytes back into a Python object.

Step 5: Handle rate limits and errors with backoff

The API calls above assume the request just works. In practice you'll hit two failures constantly: bad auth (HTTP 401, your key is wrong or missing) and rate limits (HTTP 429, you sent too many requests too fast). Both come back as an HTTP status code plus a JSON body describing what went wrong, not a crash.

A 429 response looks roughly like this:

HTTP/1.1 429 Too Many Requests
retry-after: 2

{"error": {"type": "rate_limit_error", "message": "Number of requests has exceeded your rate limit"}}

The fix isn't to give up on the first 429. It's to wait, then try again, and wait longer each time it keeps failing. That pattern is called exponential backoff: the delay doubles (or grows some other multiple) after each failed attempt, so a brief traffic spike clears itself without you hammering the API every millisecond.

python
import time
import anthropic
 
client = anthropic.Anthropic()
 
def call_with_backoff(prompt, max_retries=5):
    delay = 1  # seconds
    for attempt in range(max_retries):
        try:
            return client.messages.create(
                model="claude-sonnet-4-20250514",
                max_tokens=256,
                messages=[{"role": "user", "content": prompt}],
            )
        except anthropic.RateLimitError:
            if attempt == max_retries - 1:
                raise
            time.sleep(delay)
            delay *= 2
 
response = call_with_backoff("What is a neural network in one sentence?")
print(response.content[0].text)

This is a teaching version, not a production retry library. Real systems add jitter (a small random offset) so a fleet of clients doesn't all retry at the exact same moment, and they cap the maximum delay instead of doubling forever. The Anthropic and OpenAI SDKs already retry rate limits and transient server errors for you by default; the pattern above is what's happening inside that retry logic.

Step 6: Install and load a dataset

bash
pip install datasets huggingface_hub
python
from datasets import load_dataset
 
dataset = load_dataset("imdb")
print(dataset)
print(dataset["train"][0])

This downloads the IMDB movie review dataset. After the first download it loads from cache at ~/.cache/huggingface/datasets/.

Step 7: Stream large datasets

Some datasets don't fit on disk, and even the ones that do can be too big to fit in memory all at once. Loading an entire large dataset into RAM before you've processed a single row can exhaust your machine's memory before your program even gets started. Streaming avoids that by loading rows one at a time instead of downloading the full thing up front.

python
dataset = load_dataset("wikimedia/wikipedia", "20220301.en", split="train", streaming=True)
 
for i, example in enumerate(dataset):
    print(example["title"])
    if i >= 4:
        break

Streaming gives you an IterableDataset. You process rows as they arrive, and memory usage stays flat no matter how big the dataset is.

Step 8: Dataset formats

The datasets library uses Apache Arrow under the hood. Convert to other formats depending on what your pipeline needs.

python
dataset = load_dataset("imdb", split="train")
 
dataset.to_csv("imdb_train.csv")
dataset.to_json("imdb_train.json")
dataset.to_parquet("imdb_train.parquet")
FormatSizeRead SpeedBest For
CSVLargeSlowHuman readability, spreadsheets
JSONLargeSlowAPIs, nested data
ParquetSmallFastAnalytics, columnar queries
ArrowSmallFastestIn-memory processing (what datasets uses internally)

Parquet and Arrow are fast for the same underlying reason: they're columnar. CSV and JSON store data row by row, so reading one column means scanning past every other column in every row to find it. A columnar format stores all the values of one column together, so reading just the columns you need out of a huge dataset touches far less data.

Parquet is the storage format I'd default to. Arrow is what you're working with in memory whether you asked for it or not. CSV and JSON exist for interchange with tools that don't speak either.

Step 9: Data splits

Every ML project needs three splits:

  • Train: the model learns from this (typically 80%)
  • Validation: you check progress during training (typically 10%)
  • Test: final evaluation after training is done (typically 10%)

Some datasets come pre-split. When they don't, split them yourself:

python
dataset = load_dataset("imdb", split="train")
 
split = dataset.train_test_split(test_size=0.2, seed=42)
train_val = split["train"].train_test_split(test_size=0.125, seed=42)
 
train_ds = train_val["train"]
val_ds = train_val["test"]
test_ds = split["test"]
 
print(f"Train: {len(train_ds)}, Val: {len(val_ds)}, Test: {len(test_ds)}")

Always set a seed. The same seed produces the same split every time. Without one, you can't reproduce your own results next week.

Step 10: Download and cache models

Models are large files. huggingface_hub handles downloading and caching them the same way datasets handles data.

python
from huggingface_hub import hf_hub_download, snapshot_download
 
model_path = hf_hub_download(
    repo_id="sentence-transformers/all-MiniLM-L6-v2",
    filename="config.json"
)
print(f"Cached at: {model_path}")
 
model_dir = snapshot_download("sentence-transformers/all-MiniLM-L6-v2")
print(f"Full model at: {model_dir}")

Models cache to ~/.cache/huggingface/hub/. Once downloaded, they load instantly on later runs.

Step 11: Keep large files out of git

Model weights and large datasets don't belong in git. Three options, in order of how much machinery they bring with them.

Option A: .gitignore (simplest)

*.bin
*.safetensors
*.pt
*.onnx
data/*.parquet
data/*.csv
models/

Option B: Git LFS (track large files in git)

bash
git lfs install
git lfs track "*.bin"
git lfs track "*.safetensors"
git add .gitattributes

Git LFS stores pointers in your repo and the actual files on a separate server. GitHub gives you 1 GB free.

Option C: DVC (data version control)

bash
pip install dvc
dvc init
dvc add data/training_set.parquet
git add data/training_set.parquet.dvc data/.gitignore
git commit -m "Track training data with DVC"

DVC creates small .dvc files that point to your data. The data itself lives in S3, GCS, or another remote storage backend.

ApproachComplexityBest For
.gitignoreLowPersonal projects, downloaded data you can re-fetch
Git LFSMediumTeams sharing model weights via git
DVCHighReproducible experiments, large datasets, teams

For this course, .gitignore is enough. Reach for DVC when you need to reproduce an exact experiment across machines.

Step 12: Storage patterns

Local storage works for datasets under roughly 10 GB, which the Hugging Face cache handles automatically. Anything bigger, or shared across machines, goes to cloud storage:

python
import os
 
local_path = os.path.expanduser("~/.cache/huggingface/datasets/")
 
# s3_path = "s3://my-bucket/datasets/"
# gcs_path = "gs://my-bucket/datasets/"

DVC integrates with S3 and GCS directly:

bash
dvc remote add -d myremote s3://my-bucket/dvc-store
dvc push

Local storage is sufficient for this course. Cloud storage becomes relevant once you're fine-tuning on remote GPU instances.

Check: Build It0/35
1. What is an environment variable, in the context of storing an API key?Define
Shell session: export ANTHROPIC_API_KEY with a demo value, then a Python one-liner and env | grep ANTHROPIC_API_KEY both print that value, above first_call.py which creates the client with no key written in it.
2. In the context of LLM APIs, what is a token?Define
Part of an example API response: a one-sentence reply of 23 words and a usage block with input_tokens 14 and output_tokens 30.
Example response. The token counts are illustrative.
3. What is a rate limit on an API?Define
Terminal running burst.py, which sends ten requests back to back: requests 01 to 06 return 200 OK and requests 07 to 10 return 429 Too Many Requests, with a card showing a retry-after: 2 header and a rate_limit_error body.
4. What is exponential backoff?Define
A timeline of one client's retries: failed requests (429) at 0, 1, 3 and 7 seconds with waits of 1, 2 and 4 seconds, then an 8 second wait before a successful 200 at 15 seconds, above the lines time.sleep(delay) and delay *= 2.
5. What does streaming=True do when loading a dataset with the Hugging Face datasets library?Define
Two versions of the same load_dataset call for wikimedia/wikipedia 20220301.en, split train: the second adds streaming=True, followed by a for loop printing example["title"].
6. What is a dataset split?Define
Terminal printing load_dataset('imdb'): a DatasetDict with three named entries, train (25000 rows), test (25000 rows) and unsupervised (50000 rows), each with features text and label.
7. What is Parquet?Define
The to_parquet call from Step 8 and the metadata of the resulting file read with pyarrow: 2 columns, 20000 rows, a schema of text (string) and label (int64).
Generated here with the datasets library from synthetic text.
8. What role does Apache Arrow play in the datasets library?Define
Python session on a datasets Dataset built from two columns: type(ds.data) is datasets.table.InMemoryTable, type(ds.data.table) is pyarrow.lib.Table, and the schema shows text as string and label as int64.
Real output from the datasets library.
9. What does Git LFS keep in your repository in place of a large file?Define
Terminal running git lfs install, git lfs track on *.bin, the resulting .gitattributes line, then git add and git commit of model.bin, above three boxes: working folder with model.bin at 2.0 GB, your git repo, and a separate server, the last two marked stores: ?.
10. What is DVC?Define
Terminal with the lesson's DVC commands: pip install dvc, dvc init, dvc add data/training_set.parquet, git add of the .dvc file, a git commit, dvc remote add for s3://my-bucket/dvc-store and dvc push, and a card listing the data folder with training_set.parquet, training_set.parquet.dvc and .gitignore.
11. What is the cache in the Hugging Face workflow?Define
Terminal running load_imdb.py twice, the first run showing a download progress bar and the second loading straight away, above a listing of ~/.cache/huggingface/ with a datasets/imdb folder and a hub/models--sentence-transformers--all-MiniLM-L6-v2 folder.
12. What does an HTTP 401 response mean when calling an LLM API?Define
Terminal running first_call.py and getting back HTTP/1.1 401 Unauthorized with a JSON error body whose details are elided, with a note that it is the Step 2 code.
13. Why is it important to keep separate train, validation, and test splits?Explain
A bar for a dataset of 10,000 rows cut into train (8,000), validation (1,000) and test (1,000) with the stage of use listed beside each: the model learns from train, progress is checked on validation, and final evaluation happens on test.
14. Why does the lesson have you send one request with no SDK?Explain
Two code panels that make the same call: Step 2 uses the Anthropic SDK with client.messages.create, Step 4 builds a urllib.request.Request with url, body and headers and reads the response with json.loads.
15. Why does an environment variable protect a key better than a string in your script?Explain
Two versions of script.py: version A passes an api_key string to Anthropic(), version B calls Anthropic() with no key and relies on a shell export of ANTHROPIC_API_KEY before running, in a repo that will be pushed to GitHub.
16. What is the correct way to handle an HTTP 429 response from an LLM API?Explain
An HTTP/1.1 429 Too Many Requests response with a retry-after: 2 header and a rate_limit_error JSON body, with a note that the script had sent 8 requests in the last second.
17. Why does memory use stay flat when you stream a large dataset?Explain
Four bars of Python heap size measured with tracemalloc after 1,000, 10,000, 50,000 and 100,000 rows of a streamed loop, each a few hundred bytes (between 380 and 508).
18. Why is a columnar format like Parquet typically faster to query than CSV for analytics?Explain
The query SELECT avg(score) FROM reviews above a small table with six columns (id, title, text, score, date, user) and four rows, with only the score column outlined.
19. Step 9 says to always set a seed when splitting. Why?Explain
A script that builds a 1000-row dataset and calls train_test_split(test_size=0.2, seed=42), then prints the first five test ids, with two empty output boxes labelled run 1 and run 2.
20. How does the lesson rank Git LFS against .gitignore and DVC, and what is it best for?Explain
Three cards with the commands of each option for keeping large files out of git: DVC (pip install dvc, dvc init, dvc add), a .gitignore with *.bin, *.safetensors and models/, and Git LFS (git lfs install, git lfs track, git add .gitattributes).
21. When should you use DVC instead of just .gitignore for large files?Explain
Two panels comparing what git tracks for a large data file: with a .gitignore entry git ls-files lists only .gitignore and train.py and the data stays on one disk, with DVC git tracks the .dvc config files, a small .dvc pointer file and a data/.gitignore while the data goes to S3 or GCS.
22. According to the lesson, when does the local Hugging Face cache stop being enough for a dataset?Explain
Bars of four course datasets as listed in the lesson's dataset table (IMDB 84 MB, WikiText 181 MB, SQuAD 35 MB, MNIST 21 MB) with a total of 321 MB, downloaded to the local cache.
23. In the raw HTTP call to Anthropic, which header carries the API key?Apply
Raw HTTP request to /v1/messages on api.anthropic.com with three header lines whose names are blanked: the values are application/json, a partly hidden sk-ant API key, and 2023-06-01, followed by a JSON body.
24. In the raw HTTP example, what does calling .encode() on the JSON string do before the request is sent?Apply
The body = json.dumps({...}).encode() lines from the raw HTTP example and a Python session that prints the JSON text produced by json.dumps, then evaluates text.encode() with the result left as a question mark.
25. call_with_backoff(max_retries=5) starts at delay = 1 and every attempt raises RateLimitError. How many seconds does it sleep before the error reaches the caller?Apply
The call_with_backoff function with max_retries=5 and delay starting at 1, and five boxes attempt 0 to attempt 4, each marked fails, with question marks between them.
26. You run the Step 9 split on a dataset of 1,000 rows. What are the train, val and test sizes?Apply
The Step 9 split code run on a dataset of 1,000 rows, with two train_test_split calls (test_size=0.2 then 0.125, seed 42) and a printed line Train: ?, Val: ?, Test: ?.
27. In the streaming Wikipedia loop that breaks when i >= 4, how many titles are printed?Apply
The streaming Wikipedia loop with enumerate, print(example["title"]) and a break when i >= 4, above a strip of rows labelled row 0 to row 7 with a caption calling them the first eight rows of the stream.
28. A pipeline must read only two columns from a very wide dataset stored on disk, as fast as possible. Which format from the table fits?Apply
The Step 8 format table with Format, Size and Read Speed columns for CSV, JSON, Parquet and Arrow, above a strip of dataset columns c1 to c11 and an ellipsis (of 200 on disk) with c4 and c9 outlined as the two needed.
29. Two teammates report different test scores on the same dataset. Both called train_test_split without a seed. What is the likely cause?Analyze
Two teammates' results for the same code, dataset.train_test_split(test_size=0.2) and an evaluation on the test split: Alice reports test accuracy 0.874 and Bob reports 0.861.
30. A teammate pushed a .env file to a public repo and the key was abused. Which step would have prevented it?Analyze
Terminal: cat .env shows an ANTHROPIC_API_KEY line, git add ., git commit reporting 2 files including .env, and git push origin main to a public GitHub repo.
31. A script retries each failed request immediately in a tight loop and keeps getting 429 responses. What is wrong?Analyze
A call() function that retries in a while True loop with continue on RateLimitError and no pause, and a log of attempts 1 to 6 at 0.04 second spacing, every one returning 429 Too Many Requests.
32. Loading wikimedia/wikipedia in full crashes with out-of-memory before a single row is processed. Which change from the lesson fixes it?Analyze
Terminal running load_wiki.py, which calls load_dataset for wikimedia/wikipedia 20220301.en with split train; after downloading and generating the split the process prints Killed, exit code 137, with a note that no rows were processed.
33. Four teammates must reproduce one exact experiment on separate machines, using a large dataset that changes between versions. Which approach fits?Design
A timeline of three dataset versions (v1 Jan, v2 Mar, v3 Jun) above four boxes for Alice, Bob, Chen and Dana, each marked dataset version: ?, with a note that all four must reproduce the same results from the same code.
34. You work alone and only download public datasets that can be fetched again. Which option keeps large files out of git with the least machinery?Design
Terminal listing data/imdb_train.parquet (400M) and models/model.safetensors (2.0G) and git status --short showing the data/ and models/ folders untracked, above a card saying you work alone and everything can be re-fetched from public sources.
35. Two hundred workers all hit a 429 at the same moment and will retry. Which retry policy fits?Design
A grid of 200 dots (25 by 8), all red, for 200 workers that all got a 429 at the same moment t = 0.0 s, above a timeline labelled time of retries with a question mark.

Use It

You don't need every API or every dataset right now. Set each up when the lesson in front of you actually requires it.

APIWhen you need itFree tier
Anthropic (Claude)Phases 11-16 (agents, tools)$5 credit on signup
OpenAIPhase 11 (comparison)$5 credit on signup
Hugging FacePhases 4-10 (models, datasets)Free

The data side follows the same pattern. This course leans on a handful of well-known datasets, each sized to teach one specific thing:

DatasetLessonsSizeWhat It Teaches
IMDBTokenization, classification84 MBText classification basics
WikiTextLanguage modeling181 MBNext-token prediction
SQuADQA systems35 MBQuestion answering, spans
Common Crawl (subset)EmbeddingsVariesLarge-scale text processing
MNISTVision basics21 MBImage classification fundamentals
COCO (subset)MultimodalVariesImage-text pairs

Run the utility script to verify your setup works end to end:

bash
python code/data_utils.py

This downloads a small dataset, converts it, splits it, and prints a summary. If that runs clean, both halves of this lesson, the API side and the data side, are wired up correctly.

Check: Use It0/2
1. You are building a question-answering exercise and want a dataset from the course's table. Which one fits?Apply
An example exercise: a context passage about Paris, the question Which river runs through Paris?, and the answer given as a span of the context, the river Seine.
2. You start an agents-and-tools lesson in Phase 12. Which API setup does the course say you need?Apply
A strip of course phases 0 to 16 with Phase 12 outlined, and a card saying you are starting a Phase 12 lesson on agents and tools where your code will call an LLM and let it use tools.

Ship It

This lesson produces:

  • code/data_utils.py: reusable data loading, conversion, and caching utility
  • outputs/prompt-api-troubleshooter.md: diagnose common API errors
  • outputs/prompt-data-helper.md: find and load the right dataset for a task
Author's Note

I used to treat "handle my API key" and "handle my dataset" as two unrelated chores: one's a security habit, the other's a data-engineering habit. They're the same habit. Both are about respecting stuff that isn't yours: a key you didn't generate and can't afford to leak, a dataset you didn't create and can't afford to silently corrupt with an unseeded split or a lossy format conversion. The projects that go sideways later almost never do it because of a bad model choice. They do it because someone committed a key to a public repo, or because two people on a team got different train/test splits and spent a week arguing about whose eval number was real.

Exercises

  1. Get an Anthropic API key and make your first API call.
  2. Try the raw HTTP version and compare the response format to the SDK version.
  3. Intentionally use a wrong API key and read the error message.
  4. Load the glue dataset with the mrpc config and inspect the first 5 examples.
  5. Stream the c4 dataset and count how many examples you can process in 10 seconds.
  6. Create a 70/15/15 train/val/test split with a fixed seed, verify the sizes, then convert the train split to Parquet and compare the file size against CSV.

Key Terms

TermWhat people sayWhat it actually means
API key"Password for the API"A unique string that identifies your account and authorizes requests
Rate limit"They're throttling me"Maximum requests per minute/hour to prevent abuse and ensure fair usage
Token"A word" (in API context)A billing unit: input and output tokens are counted and charged separately
Streaming"Real-time" or "lazy loading"Receiving data piece by piece, whether response text or dataset rows, instead of waiting for or downloading the whole thing up front
Dataset split"Training data"A named subset (train/val/test) used at different stages of the ML lifecycle
Parquet"Compressed CSV"A columnar file format optimized for analytical queries and storage efficiency
Arrow"Fast dataframe"An in-memory columnar format used internally by the datasets library for zero-copy reads
Git LFS"Git for big files"An extension that stores large files outside the git repo while keeping pointers in version control
DVC"Git for data"A version control system for datasets and models that integrates with cloud storage
Cache"Already downloaded"A local copy of previously fetched data or models, stored at ~/.cache/huggingface/ by default

Code

Ships With