|
Download README.md from ariG23498/transformers-code-snippets: direct link, hf CLI and curl.
- Browser
- Download file 1.78 kB
-
https://huggingface.co/spaces/ariG23498/transformers-code-snippets/resolve/main/README.md
- Command line
-
hf download hf://spaces/ariG23498/transformers-code-snippets/README.md
-
curl -L -o README.md https://huggingface.co/spaces/ariG23498/transformers-code-snippets/resolve/main/README.md
1.78 kB
metadata
title: Transformers Playground
emoji: 🛝
colorFrom: yellow
colorTo: gray
sdk: gradio
sdk_version: 6.30.0
app_file: app.py
pinned: false
hf_oauth: true
hf_oauth_expiration_minutes: 480
hf_oauth_scopes:
- jobs
- read-repos
short_description: Copy official transformers snippets or run them on HF Jobs
Transformers Playground
Pick any transformers model on the Hub, get the usage snippets from its
model_doc page (adapted to your checkpoint), copy them, or run them on
Hugging Face Jobs with your own account.
How it works
indexer.pysparse-clonesdocs/source/en/model_docfrom transformers, extracts the<hfoptions id="usage">tabs and usage code blocks, drops training and quantization examples (v1 is inference only), and writessnippets.json.app.pymatches a model'sconfig.jsonmodel_typeto its doc page, swaps the doc's checkpoint for the selected model, adds a genericpipeline()snippet from the model's task, and recommends the cheapest Jobs flavor that fits the weights (live prices fromlist_jobs_hardware).- Runs go through
run_jobwith the user's OAuth token, so each user pays for their own compute. Jobs need a PRO, Team or Enterprise account.
Setup
- Create the Space from these files. On first boot it builds the index itself (about 30 seconds).
- Optional but recommended: publish the index as a dataset and refresh it
nightly, then set a Space variable
INDEX_REPO=<you>/transformers-snippets.
hf jobs scheduled run @daily python:3.12 --secrets HF_TOKEN -- bash -c \
"pip install -q huggingface_hub && \
curl -sL https://huggingface.co/spaces/<you>/transformers-playground/raw/main/indexer.py -o indexer.py && \
python indexer.py --push <you>/transformers-snippets"