| --- |
| name: hf-docs |
| description: "Search and fetch current Hugging Face documentation for Transformers, TRL, PEFT, Datasets, Trackio, and other libraries." |
| disable-model-invocation: false |
| --- |
| |
| # hf-docs — Hugging Face Documentation |
|
|
| ## Purpose |
|
|
| Look up current API usage patterns, trainer configs, and library documentation before writing ML code. Do not rely on memory — HF library APIs change frequently. |
|
|
| ## Tools |
|
|
| - `hf_doc_search`: Search HF documentation by product and query. |
| - `hf_doc_fetch`: Fetch the full content of a specific doc page by URL. |
|
|
| ## Products Available |
|
|
| | Product | Use For | |
| |---|---| |
| | transformers | Model loading, tokenizers, trainers, inference | |
| | trl | SFT, DPO, GRPO, PPO trainers | |
| | peft | LoRA, adapters, parameter-efficient fine-tuning | |
| | datasets | Dataset loading, streaming, processing | |
| | accelerate | Distributed training, mixed precision | |
| | hub | Repo operations, auth, upload/download | |
| | trackio | Experiment tracking, metrics, dashboards | |
| | sentence_transformers | Embedding models, training, similarity | |
| | diffusers | Diffusion pipelines, fine-tuning | |
| | optimum | Hardware optimization, model export | |
| |
| ## Workflow |
| |
| 1. Use `hf_doc_search` to find the most relevant current page for the exact library or trainer. |
| 2. Use `hf_doc_fetch` to read the full content of the page before coding. |
| 3. Extract the exact imports, class names, config parameters, and argument names. |
| 4. Cross-check any example against the current library version you are targeting. |
| 5. Use the current API in your implementation, not memory or old snippets. |
| |
| ## Example |
| |
| ``` |
| _hf_doc_search(product="trl", query="SFTConfig parameters") |
| _hf_doc_fetch(url="https://huggingface.co/docs/trl/sft_trainer") |
| ``` |
| |
| ## Docs-First Rule |
| |
| Before writing any training, fine-tuning, inference, or evaluation code: |
| - Find at least one current working implementation pattern from HF docs or a relevant repo. |
| - Verify import paths, trainer class names, and config field names. |
| - Check that the example matches your library version constraints. |
| - If the API changed recently, prefer the docs page over older code examples. |
| |