Hugging Face Ecosystem Cheat Sheet

Hugging Face platform guide — Hub, Transformers, Datasets, Spaces, Inference API, and the HF ecosystem for model discovery, sharing, and deployment.

Last Updated: May 1, 2025

Core Libraries

LibraryPurposeKey API
transformersModel loading + inference + trainingpipeline('text-generation'), AutoModel, AutoTokenizer
datasetsDataset loading + processingload_dataset(), map(), filter(), train_test_split()
accelerateMulti-GPU/distributed trainingAccelerator(), notebook_launcher()
peftParameter-efficient fine-tuningLoraConfig, get_peft_model(), PeftModel
trlRLHF, DPO, reward modelingSFTTrainer, DPOTrainer, RewardTrainer
diffusersImage/audio generationStableDiffusionPipeline, DiffusionPipeline
safetensorsSafe model format (no pickle)save_file(), load_file()

Model Discovery

ItemDescription
Model CardREADME equivalent — architecture, training data, benchmarks, limitations. Read before using.
Downloads & LikesProxy for quality. High downloads + likes = community-validated.
Tags & FiltersFilter by task (text-generation), library (transformers), language, license.
LeaderboardsOpen LLM Leaderboard, LMSys Chatbot Arena — compare models on standardized benchmarks.
GGUF ModelsQuantized for local use — search 'GGUF' tag. TheBloke and QuantFactory are top uploaders.
Model VariantsCheck 'files' tab: safetensors vs pytorch, fp16 vs fp32, GGUF quantizations.

Spaces & Deployment

ItemDescription
Gradio SpacesInteractive demos — drag-and-drop UI. Free CPU, paid GPU. Great for showcasing models.
Static SpacesHost HTML/JS/CSS — documentation, model demos without backend.
Docker SpacesFull container — custom dependencies, APIs. Most flexible.
Inference EndpointsManaged deployment — auto-scaling, per-hour pricing. Production-ready.
Inference API (Serverless)Pay-per-token. Good for prototyping, not production scale.
ZeroGPUFree GPU access for Spaces — shared, queued. Great for open-source demos.

Best Practices

ItemDescription
Use safetensorsNever pickle — security risk. Most new models ship in safetensors format.
Pin versionstransformers==4.40.0 — breaking changes happen. Pin in requirements.txt.
Check licenseApache/MIT = free use. RAIL = responsible use. CC-BY-NC = non-commercial only.
trust_remote_code=FalseDon't run arbitrary code from untrusted models. Review modeling code first.
Model cachingModels downloaded to ~/.cache/huggingface/ — reuse across projects. Set HF_HOME to change.
Pro Tip: The HF Hub is GitHub for ML — 500K+ models, 100K+ datasets. Use the 'like' and filter system to find quality models: sort by downloads, likes, and check the model card for evaluation results.