├── .git-blame-ignore-revs
├── .github
├── ISSUE_TEMPLATE
│ ├── bugs.md
│ ├── documentation-request.md
│ └── feature_request.md
└── workflows
│ ├── api_inference_build_documentation.yml
│ ├── api_inference_build_pr_documentation.yml
│ ├── api_inference_upload_pr_documentation.yml
│ ├── build_documentation.yml
│ ├── build_pr_documentation.yml
│ ├── delete_doc_comment.yml
│ ├── delete_doc_comment_trigger.yml
│ ├── generate_inference_providers_documentation.yml
│ ├── model_card_consistency_reminder.yml
│ ├── sagemaker_build_documentation.yml
│ ├── sagemaker_build_pr_documentation.yml
│ ├── sagemaker_delete_doc_comment.yml
│ ├── sagemaker_upload_pr_documentation.yml
│ ├── trufflehog.yml
│ └── upload_pr_documentation.yml
├── .gitignore
├── LICENSE
├── README.md
├── datasetcard.md
├── docs
├── hub
│ ├── _config.py
│ ├── _redirects.yml
│ ├── _toctree.yml
│ ├── academia-hub.md
│ ├── adapters.md
│ ├── advanced-compute-options.md
│ ├── agents.md
│ ├── allennlp.md
│ ├── api.md
│ ├── asteroid.md
│ ├── audit-logs.md
│ ├── bertopic.md
│ ├── billing.md
│ ├── collections.md
│ ├── datasets-adding.md
│ ├── datasets-argilla.md
│ ├── datasets-audio.md
│ ├── datasets-cards.md
│ ├── datasets-dask.md
│ ├── datasets-data-files-configuration.md
│ ├── datasets-distilabel.md
│ ├── datasets-download-stats.md
│ ├── datasets-downloading.md
│ ├── datasets-duckdb-auth.md
│ ├── datasets-duckdb-combine-and-export.md
│ ├── datasets-duckdb-select.md
│ ├── datasets-duckdb-sql.md
│ ├── datasets-duckdb-vector-similarity-search.md
│ ├── datasets-duckdb.md
│ ├── datasets-fiftyone.md
│ ├── datasets-file-names-and-splits.md
│ ├── datasets-gated.md
│ ├── datasets-image.md
│ ├── datasets-libraries.md
│ ├── datasets-manual-configuration.md
│ ├── datasets-overview.md
│ ├── datasets-pandas.md
│ ├── datasets-polars-auth.md
│ ├── datasets-polars-file-formats.md
│ ├── datasets-polars-operations.md
│ ├── datasets-polars-optimizations.md
│ ├── datasets-polars.md
│ ├── datasets-spark.md
│ ├── datasets-usage.md
│ ├── datasets-video.md
│ ├── datasets-viewer-configure.md
│ ├── datasets-viewer-embed.md
│ ├── datasets-viewer-sql-console.md
│ ├── datasets-viewer.md
│ ├── datasets-webdataset.md
│ ├── datasets.md
│ ├── dduf.md
│ ├── diffusers.md
│ ├── doi.md
│ ├── enterprise-hub-advanced-security.md
│ ├── enterprise-hub-advanced-sso.md
│ ├── enterprise-hub-analytics.md
│ ├── enterprise-hub-datasets.md
│ ├── enterprise-hub-gating-group-collections.md
│ ├── enterprise-hub-network-security.md
│ ├── enterprise-hub-resource-groups.md
│ ├── enterprise-hub-tokens-management.md
│ ├── enterprise-hub.md
│ ├── enterprise-sso.md
│ ├── espnet.md
│ ├── fastai.md
│ ├── flair.md
│ ├── gguf-gpt4all.md
│ ├── gguf-llamacpp.md
│ ├── gguf.md
│ ├── index.md
│ ├── keras.md
│ ├── ml-agents.md
│ ├── mlx-image.md
│ ├── mlx.md
│ ├── model-card-annotated.md
│ ├── model-card-appendix.md
│ ├── model-card-guidebook.md
│ ├── model-card-landscape-analysis.md
│ ├── model-cards-co2.md
│ ├── model-cards-components.md
│ ├── model-cards-user-studies.md
│ ├── model-cards.md
│ ├── model-release-checklist.md
│ ├── models-adding-libraries.md
│ ├── models-advanced.md
│ ├── models-download-stats.md
│ ├── models-downloading.md
│ ├── models-faq.md
│ ├── models-gated.md
│ ├── models-inference.md
│ ├── models-libraries.md
│ ├── models-tasks.md
│ ├── models-the-hub.md
│ ├── models-uploading.md
│ ├── models-widgets-examples.md
│ ├── models-widgets.md
│ ├── models.md
│ ├── moderation.md
│ ├── notebooks.md
│ ├── notifications.md
│ ├── oauth.md
│ ├── ollama.md
│ ├── open_clip.md
│ ├── organizations-cards.md
│ ├── organizations-managing.md
│ ├── organizations-security.md
│ ├── organizations.md
│ ├── other.md
│ ├── paddlenlp.md
│ ├── paper-pages.md
│ ├── peft.md
│ ├── repositories-getting-started.md
│ ├── repositories-licenses.md
│ ├── repositories-next-steps.md
│ ├── repositories-pull-requests-discussions.md
│ ├── repositories-settings.md
│ ├── repositories.md
│ ├── rl-baselines3-zoo.md
│ ├── sample-factory.md
│ ├── search.md
│ ├── security-2fa.md
│ ├── security-git-ssh.md
│ ├── security-gpg.md
│ ├── security-jfrog.md
│ ├── security-malware.md
│ ├── security-pickle.md
│ ├── security-protectai.md
│ ├── security-resource-groups.md
│ ├── security-secrets.md
│ ├── security-sso-azure-oidc.md
│ ├── security-sso-azure-saml.md
│ ├── security-sso-okta-oidc.md
│ ├── security-sso-okta-saml.md
│ ├── security-sso.md
│ ├── security-tokens.md
│ ├── security.md
│ ├── sentence-transformers.md
│ ├── setfit.md
│ ├── spaces-add-to-arxiv.md
│ ├── spaces-advanced.md
│ ├── spaces-changelog.md
│ ├── spaces-circleci.md
│ ├── spaces-config-reference.md
│ ├── spaces-cookie-limitations.md
│ ├── spaces-dependencies.md
│ ├── spaces-dev-mode.md
│ ├── spaces-embed.md
│ ├── spaces-github-actions.md
│ ├── spaces-gpus.md
│ ├── spaces-handle-url-parameters.md
│ ├── spaces-more-ways-to-create.md
│ ├── spaces-oauth.md
│ ├── spaces-organization-cards.md
│ ├── spaces-overview.md
│ ├── spaces-run-with-docker.md
│ ├── spaces-sdks-docker-aim.md
│ ├── spaces-sdks-docker-argilla.md
│ ├── spaces-sdks-docker-chatui.md
│ ├── spaces-sdks-docker-evidence.md
│ ├── spaces-sdks-docker-examples.md
│ ├── spaces-sdks-docker-first-demo.md
│ ├── spaces-sdks-docker-giskard.md
│ ├── spaces-sdks-docker-jupyter.md
│ ├── spaces-sdks-docker-label-studio.md
│ ├── spaces-sdks-docker-langfuse.md
│ ├── spaces-sdks-docker-livebook.md
│ ├── spaces-sdks-docker-marimo.md
│ ├── spaces-sdks-docker-panel.md
│ ├── spaces-sdks-docker-shiny.md
│ ├── spaces-sdks-docker-tabby.md
│ ├── spaces-sdks-docker-zenml.md
│ ├── spaces-sdks-docker.md
│ ├── spaces-sdks-gradio.md
│ ├── spaces-sdks-python.md
│ ├── spaces-sdks-static.md
│ ├── spaces-sdks-streamlit.md
│ ├── spaces-settings.md
│ ├── spaces-storage.md
│ ├── spaces-using-opencv.md
│ ├── spaces-zerogpu.md
│ ├── spaces.md
│ ├── spacy.md
│ ├── span_marker.md
│ ├── speechbrain.md
│ ├── stable-baselines3.md
│ ├── stanza.md
│ ├── storage-backends.md
│ ├── storage-limits.md
│ ├── storage-regions.md
│ ├── tensorboard.md
│ ├── tf-keras.md
│ ├── timm.md
│ ├── transformers-js.md
│ ├── transformers.md
│ ├── unity-sentis.md
│ ├── webhooks-guide-auto-retrain.md
│ ├── webhooks-guide-discussion-bot.md
│ ├── webhooks-guide-metadata-review.md
│ └── webhooks.md
├── inference-providers
│ ├── _redirects.yml
│ ├── _toctree.yml
│ ├── hub-api.md
│ ├── hub-integration.md
│ ├── index.md
│ ├── pricing.md
│ ├── providers
│ │ ├── cerebras.md
│ │ ├── cohere.md
│ │ ├── fal-ai.md
│ │ ├── fireworks-ai.md
│ │ ├── hf-inference.md
│ │ ├── hyperbolic.md
│ │ ├── nebius.md
│ │ ├── novita.md
│ │ ├── nscale.md
│ │ ├── replicate.md
│ │ ├── sambanova.md
│ │ └── together.md
│ ├── register-as-a-provider.md
│ ├── security.md
│ └── tasks
│ │ ├── audio-classification.md
│ │ ├── automatic-speech-recognition.md
│ │ ├── chat-completion.md
│ │ ├── feature-extraction.md
│ │ ├── fill-mask.md
│ │ ├── image-classification.md
│ │ ├── image-segmentation.md
│ │ ├── image-to-image.md
│ │ ├── index.md
│ │ ├── object-detection.md
│ │ ├── question-answering.md
│ │ ├── summarization.md
│ │ ├── table-question-answering.md
│ │ ├── text-classification.md
│ │ ├── text-generation.md
│ │ ├── text-to-image.md
│ │ ├── text-to-video.md
│ │ ├── token-classification.md
│ │ ├── translation.md
│ │ └── zero-shot-classification.md
└── sagemaker
│ ├── Makefile
│ ├── notebooks
│ └── sagemaker-sdk
│ │ ├── deploy-embedding-models
│ │ ├── assets
│ │ │ └── cw.png
│ │ └── sagemaker-notebook.ipynb
│ │ ├── deploy-llama-3-3-70b-inferentia2
│ │ └── sagemaker-notebook.ipynb
│ │ ├── evaluate-llm-lighteval
│ │ └── sagemaker-notebook.ipynb
│ │ └── fine-tune-embedding-models
│ │ ├── assets
│ │ ├── requirements.txt
│ │ └── run_mnr.py
│ │ └── sagemaker-notebook.ipynb
│ ├── scripts
│ ├── auto-generate-examples.py
│ └── auto-update-toctree.py
│ └── source
│ ├── .gitignore
│ ├── _toctree.yml
│ ├── dlcs
│ ├── available.md
│ └── introduction.md
│ ├── index.md
│ ├── reference
│ ├── inference-toolkit.md
│ └── resources.md
│ └── tutorials
│ ├── bedrock
│ └── bedrock-quickstart.md
│ ├── compute-services
│ └── compute-services-quickstart.md
│ ├── index.md
│ ├── jumpstart
│ └── jumpstart-quickstart.md
│ └── sagemaker-sdk
│ ├── deploy-sagemaker-sdk.md
│ ├── sagemaker-sdk-quickstart.md
│ └── training-sagemaker-sdk.md
├── hacktoberfest_challenges
├── datasets_without_language.csv
├── datasets_without_language.md
├── model_license_other.csv
├── model_license_other.md
├── model_no_license.csv
└── model_no_license.md
├── modelcard.md
└── scripts
└── inference-providers
├── .gitignore
├── .prettierignore
├── README.md
├── package.json
├── pnpm-lock.yaml
├── scripts
├── .gitignore
└── generate.ts
├── templates
├── common
│ ├── follow-us-button.handlebars
│ ├── page-header.handlebars
│ ├── provider-header.handlebars
│ ├── provider-logo.handlebars
│ ├── provider-tasks.handlebars
│ ├── snippets-template.handlebars
│ ├── specs-headers.handlebars
│ ├── specs-output.handlebars
│ └── specs-payload.handlebars
├── providers
│ ├── cerebras.handlebars
│ ├── cohere.handlebars
│ ├── fal-ai.handlebars
│ ├── fireworks-ai.handlebars
│ ├── hf-inference.handlebars
│ ├── hyperbolic.handlebars
│ ├── nebius.handlebars
│ ├── novita.handlebars
│ ├── nscale.handlebars
│ ├── replicate.handlebars
│ ├── sambanova.handlebars
│ └── together.handlebars
└── task
│ ├── audio-classification.handlebars
│ ├── automatic-speech-recognition.handlebars
│ ├── chat-completion.handlebars
│ ├── feature-extraction.handlebars
│ ├── fill-mask.handlebars
│ ├── image-classification.handlebars
│ ├── image-segmentation.handlebars
│ ├── image-to-image.handlebars
│ ├── object-detection.handlebars
│ ├── question-answering.handlebars
│ ├── summarization.handlebars
│ ├── table-question-answering.handlebars
│ ├── text-classification.handlebars
│ ├── text-generation.handlebars
│ ├── text-to-image.handlebars
│ ├── text-to-video.handlebars
│ ├── token-classification.handlebars
│ ├── translation.handlebars
│ └── zero-shot-classification.handlebars
└── tsconfig.json
/.git-blame-ignore-revs:
--------------------------------------------------------------------------------
1 | # Format & lint all files see https://github.com/huggingface/hub-docs/pull/924 and https://github.com/huggingface/hub-docs/pull/936
2 | b1a591d6174852341bfd69e9e0be4168c53b2ebb
3 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bugs.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug
3 | about: Report a bug you face in the Hub
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **This repository is focused on the Hub experience and documentation. If you're facing an issue with a specific library, please open an issue in the corresponding GitHub repo. If you're facing an issue with a specific model or dataset, please open an issue in the corresponding HF repo.**
11 |
12 |
13 | **Bug description.**
14 | A clear and concise description of what the problem is. Ex. Clicking this button is not working when [...]
15 |
16 | **Describe the expected behaviour**
17 | A clear and concise description of what you want to happen.
18 |
19 | **Additional context**
20 | Add any other relevant context or screenshots here. Please share details such as browser when appropriate.
21 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/documentation-request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Documentation request
3 | about: Suggest an idea for new docs
4 | title: ''
5 | labels: 'docs'
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Doc request**
11 | A clear and concise description of what you would like to see documented or what is unclear.
12 |
13 | **Additional context**
14 | Add any other context or screenshots about the feature request here.
15 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an idea for this project
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Is your feature request related to a problem? Please describe.**
11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12 |
13 | **Describe the solution you'd like**
14 | A clear and concise description of what you want to happen.
15 |
16 | **Describe alternatives you've considered**
17 | A clear and concise description of any alternative solutions or features you've considered.
18 |
19 | **Additional context**
20 | Add any other context or screenshots about the feature request here.
21 |
--------------------------------------------------------------------------------
/.github/workflows/api_inference_build_documentation.yml:
--------------------------------------------------------------------------------
1 | name: Build Inference Providers documentation
2 |
3 | on:
4 | push:
5 | paths:
6 | - "docs/inference-providers/**"
7 | branches:
8 | - main
9 |
10 | jobs:
11 | build:
12 | uses: huggingface/doc-builder/.github/workflows/build_main_documentation.yml@main
13 | with:
14 | commit_sha: ${{ github.sha }}
15 | package: hub-docs
16 | package_name: inference-providers
17 | path_to_docs: hub-docs/docs/inference-providers/
18 | additional_args: --not_python_module
19 | secrets:
20 | hf_token: ${{ secrets.HF_DOC_BUILD_PUSH }}
21 |
--------------------------------------------------------------------------------
/.github/workflows/api_inference_build_pr_documentation.yml:
--------------------------------------------------------------------------------
1 | name: Build Inference Providers PR Documentation
2 |
3 | on:
4 | pull_request:
5 | paths:
6 | - "docs/inference-providers/**"
7 |
8 | concurrency:
9 | group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
10 | cancel-in-progress: true
11 |
12 | jobs:
13 | build:
14 | uses: huggingface/doc-builder/.github/workflows/build_pr_documentation.yml@main
15 | with:
16 | commit_sha: ${{ github.event.pull_request.head.sha }}
17 | pr_number: ${{ github.event.number }}
18 | package: hub-docs
19 | package_name: inference-providers
20 | path_to_docs: hub-docs/docs/inference-providers/
21 | additional_args: --not_python_module
22 |
--------------------------------------------------------------------------------
/.github/workflows/api_inference_upload_pr_documentation.yml:
--------------------------------------------------------------------------------
1 | name: Upload Inference Providers PR Documentation
2 |
3 | on:
4 | workflow_run:
5 | workflows: ["Build Inference Providers PR Documentation"]
6 | types:
7 | - completed
8 |
9 | jobs:
10 | build:
11 | uses: huggingface/doc-builder/.github/workflows/upload_pr_documentation.yml@main
12 | with:
13 | package_name: inference-providers
14 | secrets:
15 | hf_token: ${{ secrets.HF_DOC_BUILD_PUSH }}
16 | comment_bot_token: ${{ secrets.COMMENT_BOT_TOKEN }}
--------------------------------------------------------------------------------
/.github/workflows/build_documentation.yml:
--------------------------------------------------------------------------------
1 | name: Build documentation
2 |
3 | on:
4 | push:
5 | paths:
6 | - "docs/hub/**"
7 | branches:
8 | - main
9 |
10 | jobs:
11 | build:
12 | uses: huggingface/doc-builder/.github/workflows/build_main_documentation.yml@main
13 | with:
14 | commit_sha: ${{ github.sha }}
15 | package: hub-docs
16 | package_name: hub
17 | path_to_docs: hub-docs/docs/hub/
18 | additional_args: --not_python_module
19 | secrets:
20 | hf_token: ${{ secrets.HF_DOC_BUILD_PUSH }}
21 |
--------------------------------------------------------------------------------
/.github/workflows/build_pr_documentation.yml:
--------------------------------------------------------------------------------
1 | name: Build PR Documentation
2 |
3 | on:
4 | pull_request:
5 | paths:
6 | - "docs/hub/**"
7 |
8 | concurrency:
9 | group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
10 | cancel-in-progress: true
11 |
12 | jobs:
13 | build:
14 | uses: huggingface/doc-builder/.github/workflows/build_pr_documentation.yml@main
15 | with:
16 | commit_sha: ${{ github.event.pull_request.head.sha }}
17 | pr_number: ${{ github.event.number }}
18 | package: hub-docs
19 | package_name: hub
20 | path_to_docs: hub-docs/docs/hub/
21 | additional_args: --not_python_module
22 |
23 |
--------------------------------------------------------------------------------
/.github/workflows/delete_doc_comment.yml:
--------------------------------------------------------------------------------
1 | name: Delete doc comment
2 |
3 | on:
4 | workflow_run:
5 | workflows: ["Delete doc comment trigger", "Delete sagemaker doc comment trigger"]
6 | types:
7 | - completed
8 |
9 |
10 | jobs:
11 | delete:
12 | uses: huggingface/doc-builder/.github/workflows/delete_doc_comment.yml@main
13 | secrets:
14 | comment_bot_token: ${{ secrets.COMMENT_BOT_TOKEN }}
--------------------------------------------------------------------------------
/.github/workflows/delete_doc_comment_trigger.yml:
--------------------------------------------------------------------------------
1 | name: Delete doc comment trigger
2 |
3 | on:
4 | pull_request:
5 | types: [ closed ]
6 |
7 |
8 | jobs:
9 | delete:
10 | uses: huggingface/doc-builder/.github/workflows/delete_doc_comment_trigger.yml@main
11 | with:
12 | pr_number: ${{ github.event.number }}
13 |
14 |
--------------------------------------------------------------------------------
/.github/workflows/model_card_consistency_reminder.yml:
--------------------------------------------------------------------------------
1 | name: Model and Dataset Card consistency reminder
2 |
3 | on:
4 | pull_request:
5 | paths:
6 | - modelcard.md
7 | - datasetcard.md
8 | - docs/hub/datasets-cards.md
9 | - docs/hub/model-cards.md
10 | - docs/hub/model-card-annotated.md
11 |
12 | jobs:
13 | comment:
14 | runs-on: ubuntu-latest
15 | steps:
16 | - name: maintain-comment
17 | uses: actions-cool/maintain-one-comment@v3
18 | with:
19 | body: |
20 | It looks like you've updated documentation related to model or dataset cards in this PR.
21 |
22 | Some content is duplicated among the following files. Please make sure that everything stays consistent.
23 | - [modelcard.md](https://github.com/huggingface/hub-docs/blob/main/modelcard.md)
24 | - [docs/hub/model-cards.md](https://github.com/huggingface/hub-docs/blob/main/docs/hub/model-cards.md)
25 | - [docs/hub/model-card-annotated.md](https://github.com/huggingface/hub-docs/blob/main/docs/hub/model-card-annotated.md)
26 | - [src/.../modelcard_template.md](https://github.com/huggingface/huggingface_hub/blob/main/src/huggingface_hub/templates/modelcard_template.md) (`huggingface_hub` repo)
27 | - [src/.../datasetcard_template.md](https://github.com/huggingface/huggingface_hub/blob/main/src/huggingface_hub/templates/datasetcard_template.md) (`huggingface_hub` repo)
28 | - [src/.../repocard.py](https://github.com/huggingface/huggingface_hub/blob/main/src/huggingface_hub/repocard.py) (`huggingface_hub` repo)
29 | - [datasetcard.md](https://github.com/huggingface/hub-docs/blob/main/datasetcard.md)
30 | - [docs/hub/datasets-cards.md](https://github.com/huggingface/hub-docs/blob/main/docs/hub/datasets-cards.md)
31 | token: ${{ secrets.comment_bot_token }}
32 | body-include: ''
33 |
--------------------------------------------------------------------------------
/.github/workflows/sagemaker_build_documentation.yml:
--------------------------------------------------------------------------------
1 | name: Build SageMaker Documentation
2 |
3 | on:
4 | push:
5 | branches:
6 | - main
7 | - doc-builder*
8 | paths:
9 | - docs/sagemaker/**
10 | - .github/workflows/sagemaker_build_documentation.yaml
11 |
12 | jobs:
13 | build:
14 | uses: huggingface/doc-builder/.github/workflows/build_main_documentation.yml@main
15 | with:
16 | commit_sha: ${{ github.sha }}
17 | package: hub-docs
18 | package_name: sagemaker
19 | path_to_docs: hub-docs/docs/sagemaker/source
20 | additional_args: --not_python_module
21 | pre_command: cd hub-docs/docs/sagemaker && make docs
22 | secrets:
23 | token: ${{ secrets.HUGGINGFACE_PUSH }}
24 | hf_token: ${{ secrets.HF_DOC_BUILD_PUSH }}
25 |
--------------------------------------------------------------------------------
/.github/workflows/sagemaker_build_pr_documentation.yml:
--------------------------------------------------------------------------------
1 | name: Build SageMaker PR Documentation
2 |
3 | on:
4 | pull_request:
5 | paths:
6 | - docs/sagemaker/**
7 | - .github/workflows/sagemaker_build_pr_documentation.yaml
8 |
9 | concurrency:
10 | group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
11 | cancel-in-progress: true
12 |
13 | jobs:
14 | build:
15 | uses: huggingface/doc-builder/.github/workflows/build_pr_documentation.yml@main
16 | with:
17 | commit_sha: ${{ github.event.pull_request.head.sha }}
18 | pr_number: ${{ github.event.number }}
19 | package: hub-docs
20 | package_name: sagemaker
21 | path_to_docs: hub-docs/docs/sagemaker/source
22 | additional_args: --not_python_module
23 | pre_command: cd hub-docs/docs/sagemaker && make docs
24 |
--------------------------------------------------------------------------------
/.github/workflows/sagemaker_delete_doc_comment.yml:
--------------------------------------------------------------------------------
1 | name: Delete SageMaker PR Documentation Comment
2 |
3 | on:
4 | pull_request:
5 | types: [ closed ]
6 |
7 | jobs:
8 | delete:
9 | uses: huggingface/doc-builder/.github/workflows/delete_doc_comment_trigger.yml@main
10 | with:
11 | pr_number: ${{ github.event.number }}
12 |
13 |
--------------------------------------------------------------------------------
/.github/workflows/sagemaker_upload_pr_documentation.yml:
--------------------------------------------------------------------------------
1 | name: Upload SageMaker PR Documentation
2 |
3 | on:
4 | workflow_run:
5 | workflows: ["Build SageMaker PR Documentation"]
6 | types:
7 | - completed
8 |
9 | jobs:
10 | build:
11 | uses: huggingface/doc-builder/.github/workflows/upload_pr_documentation.yml@main
12 | with:
13 | package_name: sagemaker
14 | secrets:
15 | hf_token: ${{ secrets.HF_DOC_BUILD_PUSH }}
16 | comment_bot_token: ${{ secrets.COMMENT_BOT_TOKEN }}
17 |
--------------------------------------------------------------------------------
/.github/workflows/trufflehog.yml:
--------------------------------------------------------------------------------
1 | name: Secret Leaks
2 |
3 | on:
4 | push:
5 |
6 | permissions:
7 | contents: read
8 |
9 | jobs:
10 | trufflehog:
11 | runs-on: ubuntu-latest
12 | steps:
13 | - name: Checkout code
14 | uses: actions/checkout@v4
15 | with:
16 | fetch-depth: 0
17 | - name: Secret Scanning
18 | uses: trufflesecurity/trufflehog@main
19 |
--------------------------------------------------------------------------------
/.github/workflows/upload_pr_documentation.yml:
--------------------------------------------------------------------------------
1 | name: Upload PR Documentation
2 |
3 | on:
4 | workflow_run:
5 | workflows: ["Build PR Documentation"]
6 | types:
7 | - completed
8 |
9 | jobs:
10 | build:
11 | uses: huggingface/doc-builder/.github/workflows/upload_pr_documentation.yml@main
12 | with:
13 | package_name: hub
14 | secrets:
15 | hf_token: ${{ secrets.HF_DOC_BUILD_PUSH }}
16 | comment_bot_token: ${{ secrets.COMMENT_BOT_TOKEN }}
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
2 | __pycache__/
3 | .vscode/
4 | .idea/
5 |
6 | .DS_Store
7 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # hub-docs
2 |
3 | This repository regroups documentation and information that is hosted on the Hugging Face website.
4 |
5 | You can access the Hugging Face Hub documentation in the `docs` folder at [hf.co/docs/hub](https://hf.co/docs/hub).
6 |
7 | For some related components, check out the [Hugging Face Hub JS repository](https://github.com/huggingface/huggingface.js)
8 | - Utilities to interact with the Hub: [huggingface/huggingface.js/packages/hub](https://github.com/huggingface/huggingface.js/tree/main/packages/hub)
9 | - Hub Inference, powered by our Inference Providers: [huggingface/huggingface.js/packages/inference](https://github.com/huggingface/huggingface.js/tree/main/packages/inference)
10 | - Hub Tasks (as visible on the page [hf.co/tasks](https://hf.co/tasks)): [huggingface/huggingface.js/packages/tasks](https://github.com/huggingface/huggingface.js/tree/main/packages/tasks)
11 |
12 | ### How to contribute to the docs
13 |
14 | Just add/edit the Markdown files, commit them, and create a PR.
15 | Then the CI bot will build the preview page and provide a url for you to look at the result!
16 |
17 | For simple edits, you don't need a local build environment.
18 |
19 | ### Previewing locally
20 |
21 | ```bash
22 | # install doc-builder (if not done already)
23 | pip install hf-doc-builder
24 |
25 | # you may also need to install some extra dependencies
26 | pip install black watchdog
27 |
28 | # run `doc-builder preview` cmd
29 | doc-builder preview hub {YOUR_PATH}/hub-docs/docs/hub/ --not_python_module
30 | ```
31 |
--------------------------------------------------------------------------------
/docs/hub/_config.py:
--------------------------------------------------------------------------------
1 | disable_toc_check = True
2 |
--------------------------------------------------------------------------------
/docs/hub/_redirects.yml:
--------------------------------------------------------------------------------
1 | # This first_section was backported from nginx
2 | adding-a-model: models-uploading
3 | model-repos: models
4 | endpoints: api
5 | adding-a-library: models-adding-libraries
6 | libraries: models-libraries
7 | inference: models-inference
8 | org-cards: organizations-cards
9 | adding-a-task: models-tasks
10 | models-cards: model-cards
11 | models-cards-co2: model-cards-co2
12 | how-to-downstream: /docs/huggingface_hub/how-to-downstream
13 | how-to-upstream: /docs/huggingface_hub/how-to-upstream
14 | how-to-inference: /docs/huggingface_hub/how-to-inference
15 | searching-the-hub: /docs/huggingface_hub/searching-the-hub
16 | # end of first_section
17 | api-webhook: webhooks
18 | adapter-transformers: adapters
19 | security-two-fa: security-2fa
20 | repositories-recommendations: storage-limits
21 | xet: storage-backends#xet
22 |
--------------------------------------------------------------------------------
/docs/hub/academia-hub.md:
--------------------------------------------------------------------------------
1 | # Academia Hub
2 |
3 |
4 | Ask your university's IT or Procurement Team to get in touch from a university-affiliated email address to initiate the subscription process.
5 |
6 |
7 | Academia Hub is a paid offering that provides the Hugging Face Hub’s PRO features to every student, researcher, or faculty member of an academic institution. Explore advanced tools, enhanced collaboration, and exclusive resources to accelerate your learning, research, and teaching. The Hugging Face team is able to work with your IT or procurement department to set the product up.
8 |
9 |
10 |
11 |
12 |
13 | #### How does it work
14 |
15 | When Academia Hub is enabled, any affiliated user will need to add their `@your-university-name.edu` email address (or other university domain) to their HF account.
16 |
17 | Academia Hub is designed for:
18 | - **Students:** Unlock powerful features to learn about AI and Machine learning in the most efficient way.
19 | - **Researchers:** Collaborate with peers using the standard AI ecosystem of tools.
20 | - **Faculty members:** Enhance your classes' projects with PRO capabilities.
21 |
22 | Key Features of Academia Hub:
23 |
24 | - **ZeroGPU:** Get 5x usage quota and highest GPU queue priority.
25 | - **Spaces Hosting:** Create ZeroGPU Spaces with H200 hardware.
26 | - **Spaces Dev Mode:** Fast iterations via SSH/VS Code for Spaces.
27 | - **Inference Providers:** Get monthly included credits across all Inference Providers.
28 | - **Dataset Viewer:** Activate it on private datasets.
29 | - **Blog Articles:** Publish articles to the Hugging Face blog.
30 | - **Social Posts:** Share short updates with the community.
31 | - **Seamless Onboarding:** Quick and secure sign-up with your academic email.
32 | - **Enhanced Collaboration:** Connect with peers and mentors.
33 | - **Exclusive Resources:** Access datasets, models, and projects tailored for academia.
34 |
35 | #### Eligibility
36 |
37 | - Must possess a valid university or college email address.
38 | - Open to all students regardless of discipline or level of study.
39 | - Pricing: Academia Hub is priced based on volume of usage and number of active users at your institution.
40 |
41 | #### Subscribe
42 |
43 | Ask your university's IT or Procurement Team to get in touch to initiate the subscription process to the Academia Hub today. Academia Hub can not be initiated by students themselves.
44 |
45 | #### Private storage
46 |
47 | Academia Hub includes 1TB of [private repository storage](./storage-limits) per seat in the subscription, i.e. if your institution has 400 students and faculty, your students and faculty have 400TB included storage across their private models and datasets.
48 |
--------------------------------------------------------------------------------
/docs/hub/advanced-compute-options.md:
--------------------------------------------------------------------------------
1 | # Advanced Compute Options
2 |
3 |
4 | This feature is part of the Enterprise Hub.
5 |
6 |
7 | Enterprise Hub organizations gain access to advanced compute options to accelerate their machine learning journey.
8 |
9 | ## Host ZeroGPU Spaces in your organization
10 |
11 | ZeroGPU is a dynamic GPU allocation system that optimizes AI deployment on Hugging Face Spaces. By automatically allocating and releasing NVIDIA H200 GPU slices (70GB VRAM) as needed, organizations can efficiently serve their AI applications without dedicated GPU instances.
12 |
13 |
14 |

19 |

24 |
25 |
26 | **Key benefits for organizations**
27 |
28 | - **Free GPU Access**: Access powerful NVIDIA H200 GPUs at no additional cost through dynamic allocation
29 | - **Enhanced Resource Management**: Host up to 50 ZeroGPU Spaces for efficient team-wide AI deployment
30 | - **Simplified Deployment**: Easy integration with PyTorch-based models, Gradio apps, and other Hugging Face libraries
31 | - **Enterprise-Grade Infrastructure**: Access to high-performance NVIDIA H200 GPUs with 70GB VRAM per workload
32 |
33 | [Learn more about ZeroGPU →](https://huggingface.co/docs/hub/spaces-zerogpu)
34 |
--------------------------------------------------------------------------------
/docs/hub/audit-logs.md:
--------------------------------------------------------------------------------
1 | # Audit Logs
2 |
3 |
4 | This feature is part of the Enterprise Hub.
5 |
6 |
7 | Audit Logs enable organization admins to easily review actions taken by members, including organization membership, repository settings and billing changes.
8 |
9 |
10 |

15 |

20 |
21 |
22 | ## Accessing Audit Logs
23 |
24 | Audit Logs are accessible through your organization settings. Each log entry includes:
25 |
26 | - Who performed the action
27 | - What type of action was taken
28 | - A description of the change
29 | - Location and anonymized IP address
30 | - Date and time of the action
31 |
32 | You can also download the complete audit log as a JSON file for further analysis.
33 |
34 | ## What Events Are Tracked?
35 |
36 | ### Organization Management & Security
37 |
38 | - Core organization changes
39 | - Creation, deletion, and restoration
40 | - Name changes and settings updates
41 | - Security management
42 | - Security token rotation
43 | - Token approval system (enabling/disabling, authorization requests, approvals, denials, revocations)
44 | - SSO events (logins and joins)
45 |
46 | ### Membership and Access Control
47 |
48 | - Member lifecycle
49 | - Invitations (sending, accepting) and automatic joins
50 | - Adding and removing members
51 | - Role changes and departures
52 | - Join settings
53 | - Domain-based access
54 | - Automatic join configurations
55 |
56 | ### Content and Resource Management
57 |
58 | - Repository administration
59 | - Core actions (creation, deletion, moving, duplication)
60 | - Settings and configuration changes
61 | - Enabling/disabling repositories
62 | - DOI management
63 | - Resource group assignments
64 | - Collections
65 | - Creation and deletion events
66 | - Repository security
67 | - Secrets management (individual and bulk)
68 | - Variables handling (individual and bulk)
69 | - Spaces configuration
70 | - Storage modifications
71 | - Hardware settings
72 | - Sleep time adjustments
73 |
74 | ### Billing and AWS Integration
75 |
76 | - Payment management
77 | - Payment methods (adding/removing)
78 | - Customer account creation
79 | - AWS integration setup and removal
80 | - Subscription lifecycle
81 | - Starting and renewing
82 | - Updates and cancellations
83 | - Cancellation reversals
84 |
85 | ### Resource Groups
86 |
87 | - Administrative actions
88 | - Creation and deletion
89 | - Settings modifications
90 | - Member management
91 | - Adding and removing users
92 | - Role assignments and changes
93 |
--------------------------------------------------------------------------------
/docs/hub/datasets-download-stats.md:
--------------------------------------------------------------------------------
1 | # Datasets Download Stats
2 |
3 | ## How are downloads counted for datasets?
4 |
5 | Counting the number of downloads for datasets is not a trivial task, as a single dataset repository might contain multiple files, from multiple subsets and splits (e.g. train/validation/test) and sometimes with many files in a single split. To solve this issue and avoid counting one person's download multiple times, we treat all files downloaded by a user (based on their IP address) within a 5-minute window as a single dataset download. This counting happens automatically on our servers when files are downloaded (through GET or HEAD requests), with no need to collect any user information or make additional calls.
6 |
7 | ## Before September 2024
8 |
9 | The Hub used to provide download stats only for the datasets loadable via the `datasets` library. To determine the number of downloads, the Hub previously counted every time `load_dataset` was called in Python, excluding Hugging Face's CI tooling on GitHub. No information was sent from the user, and no additional calls were made for this. The count was done server-side as we served files for downloads. This means that:
10 |
11 | * The download count was the same regardless of whether the data is directly stored on the Hub repo or if the repository has a [script](/docs/datasets/dataset_script) to load the data from an external source.
12 | * If a user manually downloaded the data using tools like `wget` or the Hub's user interface (UI), those downloads were not included in the download count.
13 |
--------------------------------------------------------------------------------
/docs/hub/datasets-downloading.md:
--------------------------------------------------------------------------------
1 | # Downloading datasets
2 |
3 | ## Integrated libraries
4 |
5 | If a dataset on the Hub is tied to a [supported library](./datasets-libraries), loading the dataset can be done in just a few lines. For information on accessing the dataset, you can click on the "Use this dataset" button on the dataset page to see how to do so. For example, [`samsum`](https://huggingface.co/datasets/Samsung/samsum?library=datasets) shows how to do so with 🤗 Datasets below.
6 |
7 |
8 |

9 |

10 |
11 |
12 |
13 |

14 |

15 |
16 |
17 | ## Using the Hugging Face Client Library
18 |
19 | You can use the [`huggingface_hub`](/docs/huggingface_hub) library to create, delete, update and retrieve information from repos. For example, to download the `HuggingFaceH4/ultrachat_200k` dataset from the command line, run
20 |
21 | ```bash
22 | huggingface-cli download HuggingFaceH4/ultrachat_200k --repo-type dataset
23 | ```
24 |
25 | See the [huggingface-cli download documentation](https://huggingface.co/docs/huggingface_hub/en/guides/cli#download-a-dataset-or-a-space) for more information.
26 |
27 | You can also integrate this into your own library! For example, you can quickly load a CSV dataset with a few lines using Pandas.
28 | ```py
29 | from huggingface_hub import hf_hub_download
30 | import pandas as pd
31 |
32 | REPO_ID = "YOUR_REPO_ID"
33 | FILENAME = "data.csv"
34 |
35 | dataset = pd.read_csv(
36 | hf_hub_download(repo_id=REPO_ID, filename=FILENAME, repo_type="dataset")
37 | )
38 | ```
39 |
40 | ## Using Git
41 |
42 | Since all datasets on the Hub are Git repositories, you can clone the datasets locally by running:
43 |
44 | ```bash
45 | git lfs install
46 | git clone git@hf.co:datasets/ # example: git clone git@hf.co:datasets/allenai/c4
47 | ```
48 |
49 | If you have write-access to the particular dataset repo, you'll also have the ability to commit and push revisions to the dataset.
50 |
51 | Add your SSH public key to [your user settings](https://huggingface.co/settings/keys) to push changes and/or access private repos.
52 |
--------------------------------------------------------------------------------
/docs/hub/datasets-duckdb-auth.md:
--------------------------------------------------------------------------------
1 | # Authentication for private and gated datasets
2 |
3 | To access private or gated datasets, you need to configure your Hugging Face Token in the DuckDB Secrets Manager.
4 |
5 | Visit [Hugging Face Settings - Tokens](https://huggingface.co/settings/tokens) to obtain your access token.
6 |
7 | DuckDB supports two providers for managing secrets:
8 |
9 | - `CONFIG`: Requires the user to pass all configuration information into the CREATE SECRET statement.
10 | - `CREDENTIAL_CHAIN`: Automatically tries to fetch credentials. For the Hugging Face token, it will try to get it from `~/.cache/huggingface/token`.
11 |
12 | For more information about DuckDB Secrets visit the [Secrets Manager](https://duckdb.org/docs/configuration/secrets_manager.html) guide.
13 |
14 | ## Creating a secret with `CONFIG` provider
15 |
16 | To create a secret using the CONFIG provider, use the following command:
17 |
18 | ```bash
19 | CREATE SECRET hf_token (TYPE HUGGINGFACE, TOKEN 'your_hf_token');
20 | ```
21 |
22 | Replace `your_hf_token` with your actual Hugging Face token.
23 |
24 | ## Creating a secret with `CREDENTIAL_CHAIN` provider
25 |
26 | To create a secret using the CREDENTIAL_CHAIN provider, use the following command:
27 |
28 | ```bash
29 | CREATE SECRET hf_token (TYPE HUGGINGFACE, PROVIDER credential_chain);
30 | ```
31 |
32 | This command automatically retrieves the stored token from `~/.cache/huggingface/token`.
33 |
34 | First you need to [Login with your Hugging Face account](/docs/huggingface_hub/quick-start#login), for example using:
35 |
36 | ```bash
37 | huggingface-cli login
38 | ```
39 |
40 | Alternatively, you can set your Hugging Face token as an environment variable:
41 |
42 | ```bash
43 | export HF_TOKEN="hf_xxxxxxxxxxxxx"
44 | ```
45 |
46 | For more information on authentication, see the [Hugging Face authentication](/docs/huggingface_hub/main/en/quick-start#authentication) documentation.
47 |
--------------------------------------------------------------------------------
/docs/hub/datasets-duckdb.md:
--------------------------------------------------------------------------------
1 | # DuckDB
2 |
3 | [DuckDB](https://github.com/duckdb/duckdb) is an in-process SQL [OLAP](https://en.wikipedia.org/wiki/Online_analytical_processing) database management system.
4 | You can use the Hugging Face paths (`hf://`) to access data on the Hub:
5 |
6 |
7 |

8 |
9 |
10 | The [DuckDB CLI](https://duckdb.org/docs/api/cli/overview.html) (Command Line Interface) is a single, dependency-free executable.
11 | There are also other APIs available for running DuckDB, including Python, C++, Go, Java, Rust, and more. For additional details, visit their [clients](https://duckdb.org/docs/api/overview.html) page.
12 |
13 |
14 |
15 | For installation details, visit the [installation page](https://duckdb.org/docs/installation).
16 |
17 |
18 |
19 | Starting from version `v0.10.3`, the DuckDB CLI includes native support for accessing datasets on the Hugging Face Hub via URLs with the `hf://` scheme. Here are some features you can leverage with this powerful tool:
20 |
21 | - Query public datasets and your own gated and private datasets
22 | - Analyze datasets and perform SQL operations
23 | - Combine datasets and export it to different formats
24 | - Conduct vector similarity search on embedding datasets
25 | - Implement full-text search on datasets
26 |
27 | For a complete list of DuckDB features, visit the DuckDB [documentation](https://duckdb.org/docs/).
28 |
29 | To start the CLI, execute the following command in the installation folder:
30 |
31 | ```bash
32 | ./duckdb
33 | ```
34 |
35 | ## Forging the Hugging Face URL
36 |
37 | To access Hugging Face datasets, use the following URL format:
38 |
39 | ```plaintext
40 | hf://datasets/{my-username}/{my-dataset}/{path_to_file}
41 | ```
42 |
43 | - **my-username**, the user or organization of the dataset, e.g. `ibm`
44 | - **my-dataset**, the dataset name, e.g: `duorc`
45 | - **path_to_parquet_file**, the parquet file path which supports glob patterns, e.g `**/*.parquet`, to query all parquet files
46 |
47 |
48 |
49 |
50 | You can query auto-converted Parquet files using the @~parquet branch, which corresponds to the `refs/convert/parquet` revision. For more details, refer to the documentation at https://huggingface.co/docs/datasets-server/en/parquet#conversion-to-parquet.
51 |
52 | To reference the `refs/convert/parquet` revision of a dataset, use the following syntax:
53 |
54 | ```plaintext
55 | hf://datasets/{my-username}/{my-dataset}@~parquet/{path_to_file}
56 | ```
57 |
58 | Here is a sample URL following the above syntax:
59 |
60 | ```plaintext
61 | hf://datasets/ibm/duorc@~parquet/ParaphraseRC/test/0000.parquet
62 | ```
63 |
64 |
65 |
66 | Let's start with a quick demo to query all the rows of a dataset:
67 |
68 | ```sql
69 | FROM 'hf://datasets/ibm/duorc/ParaphraseRC/*.parquet' LIMIT 3;
70 | ```
71 |
72 | Or using traditional SQL syntax:
73 |
74 | ```sql
75 | SELECT * FROM 'hf://datasets/ibm/duorc/ParaphraseRC/*.parquet' LIMIT 3;
76 | ```
77 | In the following sections, we will cover more complex operations you can perform with DuckDB on Hugging Face datasets.
78 |
--------------------------------------------------------------------------------
/docs/hub/datasets-overview.md:
--------------------------------------------------------------------------------
1 | # Datasets Overview
2 |
3 | ## Datasets on the Hub
4 |
5 | The Hugging Face Hub hosts a [large number of community-curated datasets](https://huggingface.co/datasets) for a diverse range of tasks such as translation, automatic speech recognition, and image classification. Alongside the information contained in the [dataset card](./datasets-cards), many datasets, such as [GLUE](https://huggingface.co/datasets/nyu-mll/glue), include a [Dataset Viewer](./datasets-viewer) to showcase the data.
6 |
7 | Each dataset is a [Git repository](./repositories) that contains the data required to generate splits for training, evaluation, and testing. For information on how a dataset repository is structured, refer to the [Data files Configuration page](./datasets-data-files-configuration). Following the supported repo structure will ensure that the dataset page on the Hub will have a Viewer.
8 |
9 | ## Search for datasets
10 |
11 | Like models and spaces, you can search the Hub for datasets using the search bar in the top navigation or on the [main datasets page](https://huggingface.co/datasets). There's a large number of languages, tasks, and licenses that you can use to filter your results to find a dataset that's right for you.
12 |
13 |
14 |

15 |

16 |
17 |
18 | ## Privacy
19 |
20 | Since datasets are repositories, you can [toggle their visibility between private and public](./repositories-settings#private-repositories) through the Settings tab. If a dataset is owned by an [organization](./organizations), the privacy settings apply to all the members of the organization.
21 |
--------------------------------------------------------------------------------
/docs/hub/datasets-polars-auth.md:
--------------------------------------------------------------------------------
1 | # Authentication
2 |
3 | In order to access private or gated datasets, you need to authenticate first. Authentication works by providing an access token which will be used to authenticate and authorize your access to gated and private datasets. The first step is to create an access token for your account. This can be done by visiting [Hugging Face Settings - Tokens](https://huggingface.co/settings/tokens).
4 |
5 | There are three ways to provide the token: setting an environment variable, passing a parameter to the reader or using the Hugging Face CLI.
6 |
7 | ## Environment variable
8 |
9 | If you set the environment variable `HF_TOKEN`, Polars will automatically use it when requesting datasets from Hugging Face.
10 |
11 | ```bash
12 | export HF_TOKEN="hf_xxxxxxxxxxxxx"
13 | ```
14 |
15 | ## Parameters
16 |
17 | You can also explicitly provide the access token to the reader (e.g. `read_parquet`) through the `storage_options` parameter. For a full overview of all the parameters, check out the [API reference guide](https://docs.pola.rs/api/python/stable/reference/api/polars.read_parquet.html).
18 |
19 | ```python
20 | pl.read_parquet(
21 | "hf://datasets/roneneldan/TinyStories/data/train-*.parquet",
22 | storage_options={"token": ACCESS_TOKEN},
23 | )
24 | ```
25 |
26 | ## CLI
27 |
28 | Alternatively, you can you use the [Hugging Face CLI](/docs/huggingface_hub/en/guides/cli) to authenticate. After successfully logging in with `huggingface-cli login` an access token will be stored in the `HF_HOME` directory which defaults to `~/.cache/huggingface`. Polars will then use this token for authentication.
29 |
30 | If multiple methods are specified, they are prioritized in the following order:
31 |
32 | - Parameters (`storage_options`)
33 | - Environment variable (`HF_TOKEN`)
34 | - CLI
35 |
--------------------------------------------------------------------------------
/docs/hub/datasets-polars-file-formats.md:
--------------------------------------------------------------------------------
1 | # File formats
2 |
3 | Polars supports the following file formats when reading from Hugging Face:
4 |
5 | - [Parquet](https://docs.pola.rs/api/python/stable/reference/api/polars.read_parquet.html)
6 | - [CSV](https://docs.pola.rs/api/python/stable/reference/api/polars.read_csv.html)
7 | - [JSON Lines](https://docs.pola.rs/api/python/stable/reference/api/polars.read_ndjson.html)
8 |
9 | The examples below show the default settings only. Use the links above to view all available parameters in the API reference guide.
10 |
11 | # Parquet
12 |
13 | Parquet is the preferred file format as it stores the schema with type information within the file. This avoids any ambiguity with parsing and speeds up reading. To read a Parquet file in Polars, use the `read_parquet` function:
14 |
15 | ```python
16 | pl.read_parquet("hf://datasets/roneneldan/TinyStories/data/train-00000-of-00004-2d5a1467fff1081b.parquet")
17 | ```
18 |
19 | # CSV
20 |
21 | The `read_csv` function can be used to read a CSV file:
22 |
23 | ```python
24 | pl.read_csv("hf://datasets/lhoestq/demo1/data/train.csv")
25 | ```
26 |
27 | # JSON
28 |
29 | Polars supports reading new line delimited JSON — also known as [json lines](https://jsonlines.org/) — with the `read_ndjson` function:
30 |
31 | ```python
32 | pl.read_ndjson("hf://datasets/proj-persona/PersonaHub/persona.jsonl")
33 | ```
--------------------------------------------------------------------------------
/docs/hub/datasets-polars.md:
--------------------------------------------------------------------------------
1 | # Polars
2 |
3 | [Polars](https://pola.rs/) is an in-memory DataFrame library on top of an [OLAP](https://en.wikipedia.org/wiki/Online_analytical_processing) query engine. It is fast, easy to use, and [open source](https://github.com/pola-rs/polars/).
4 |
5 | Starting from version `1.2.0`, Polars provides _native_ support for the Hugging Face file system. This means that all the benefits of the Polars query optimizer (e.g. predicate and projection pushdown) are applied and Polars will only load the data necessary to complete the query. This significantly speeds up reading, especially for large datasets (see [optimizations](./datasets-polars-optimizations))
6 |
7 | You can use the Hugging Face paths (`hf://`) to access data on the Hub:
8 |
9 |
10 |

11 |
12 |
13 | ## Getting started
14 |
15 | To get started, you can simply `pip install` Polars into your environment:
16 |
17 | ```bash
18 | pip install polars
19 | ```
20 |
21 | Once you have installed Polars, you can directly query a dataset based on a Hugging Face URL. No other dependencies are needed for this.
22 |
23 | ```python
24 | import polars as pl
25 |
26 | pl.read_parquet("hf://datasets/roneneldan/TinyStories/data/train-00000-of-00004-2d5a1467fff1081b.parquet")
27 | ```
28 |
29 |
30 |
31 | Polars provides two APIs: a lazy API (`scan_parquet`) and an eager API (`read_parquet`). We recommend using the eager API for interactive workloads and the lazy API for performance as it allows for better query optimization. For more information on the topic, check out the [Polars user guide](https://docs.pola.rs/user-guide/concepts/lazy-vs-eager/).
32 |
33 |
34 |
35 | Polars supports globbing to download multiple files at once into a single DataFrame.
36 |
37 | ```python
38 | pl.read_parquet("hf://datasets/roneneldan/TinyStories/data/train-*.parquet")
39 | ```
40 |
41 | ### Hugging Face URLs
42 |
43 | A Hugging Face URL can be constructed from the `username` and `dataset` name like this:
44 |
45 | - `hf://datasets/{username}/{dataset}/{path_to_file}`
46 |
47 | The path may include globbing patterns such as `**/*.parquet` to query all the files matching the pattern. Additionally, for any non-supported [file formats](./datasets-polars-file-formats) you can use the auto-converted parquet files that Hugging Face provides using the `@~parquet branch`:
48 |
49 | - `hf://datasets/{my-username}/{my-dataset}@~parquet/{path_to_file}`
50 |
--------------------------------------------------------------------------------
/docs/hub/datasets-usage.md:
--------------------------------------------------------------------------------
1 | # Using 🤗 Datasets
2 |
3 | Once you've found an interesting dataset on the Hugging Face Hub, you can load the dataset using 🤗 Datasets. You can click on the [**Use this dataset** button](https://huggingface.co/datasets/nyu-mll/glue?library=datasets) to copy the code to load a dataset.
4 |
5 | First you need to [Login with your Hugging Face account](/docs/huggingface_hub/quick-start#login), for example using:
6 |
7 | ```
8 | huggingface-cli login
9 | ```
10 |
11 | And then you can load a dataset from the Hugging Face Hub using
12 |
13 | ```python
14 | from datasets import load_dataset
15 |
16 | dataset = load_dataset("username/my_dataset")
17 |
18 | # or load the separate splits if the dataset has train/validation/test splits
19 | train_dataset = load_dataset("username/my_dataset", split="train")
20 | valid_dataset = load_dataset("username/my_dataset", split="validation")
21 | test_dataset = load_dataset("username/my_dataset", split="test")
22 | ```
23 |
24 | You can also upload datasets to the Hugging Face Hub:
25 |
26 | ```python
27 | my_new_dataset.push_to_hub("username/my_new_dataset")
28 | ```
29 |
30 | This creates a dataset repository `username/my_new_dataset` containing your Dataset in Parquet format, that you can reload later.
31 |
32 | For more information about using 🤗 Datasets, check out the [tutorials](/docs/datasets/tutorial) and [how-to guides](/docs/datasets/how_to) available in the 🤗 Datasets documentation.
33 |
--------------------------------------------------------------------------------
/docs/hub/datasets-viewer-configure.md:
--------------------------------------------------------------------------------
1 | # Configure the Dataset Viewer
2 |
3 | The Dataset Viewer supports many [data files formats](./datasets-adding#file-formats), from text to tabular and from image to audio formats.
4 | It also separates the train/validation/test splits based on file and folder names.
5 |
6 | To configure the Dataset Viewer for your dataset, first make sure your dataset is in a [supported data format](./datasets-adding#file-formats).
7 |
8 | ## Configure dropdowns for splits or subsets
9 |
10 | In the Dataset Viewer you can view the [train/validation/test](https://en.wikipedia.org/wiki/Training,_validation,_and_test_data_sets) splits of datasets, and sometimes additionally choose between multiple subsets (e.g. one per language).
11 |
12 | To define those dropdowns, you can name the data files or their folder after their split names (train/validation/test).
13 | It is also possible to customize your splits manually using YAML.
14 |
15 | For more information, feel free to check out the documentation on [Data files Configuration](./datasets-data-files-configuration) and the [collections of example datasets](https://huggingface.co/datasets-examples). The [Image Dataset doc page](./datasets-image) proposes various methods to structure a dataset with images.
16 |
17 | ## Disable the viewer
18 |
19 | The dataset viewer can be disabled. To do this, add a YAML section to the dataset's `README.md` file (create one if it does not already exist) and add a `viewer` property with the value `false`.
20 |
21 | ```yaml
22 | ---
23 | viewer: false
24 | ---
25 | ```
26 |
27 | ## Private datasets
28 |
29 | For **private** datasets, the Dataset Viewer is enabled for [PRO users](https://huggingface.co/pricing) and [Enterprise Hub organizations](https://huggingface.co/enterprise).
30 |
--------------------------------------------------------------------------------
/docs/hub/datasets.md:
--------------------------------------------------------------------------------
1 | # Datasets
2 |
3 | The Hugging Face Hub is home to a growing collection of datasets that span a variety of domains and tasks. These docs will guide you through interacting with the datasets on the Hub, uploading new datasets, exploring the datasets contents, and using datasets in your projects.
4 |
5 | This documentation focuses on the datasets functionality in the Hugging Face Hub and how to use the datasets with supported libraries. For detailed information about the 🤗 Datasets python package, visit the [🤗 Datasets documentation](/docs/datasets/index).
6 |
7 | ## Contents
8 |
9 | - [Datasets Overview](./datasets-overview)
10 | - [Dataset Cards](./datasets-cards)
11 | - [Gated Datasets](./datasets-gated)
12 | - [Uploading Datasets](./datasets-adding)
13 | - [Downloading Datasets](./datasets-downloading)
14 | - [Libraries](./datasets-libraries)
15 | - [Dataset Viewer](./datasets-viewer)
16 | - [Data files Configuration](./datasets-data-files-configuration)
17 |
--------------------------------------------------------------------------------
/docs/hub/enterprise-hub-advanced-security.md:
--------------------------------------------------------------------------------
1 | # Advanced Security
2 |
3 |
4 | This feature is part of the Enterprise Hub.
5 |
6 |
7 | Enterprise Hub organizations can improve their security with advanced security controls for both members and repositories.
8 |
9 |
10 |

11 |

12 |
13 |
14 | ## Members Security
15 |
16 | Configure additional security settings to protect your organization:
17 |
18 | - **Two-Factor Authentication (2FA)**: Require all organization members to enable 2FA for enhanced account security.
19 | - **User Approval**: For organizations with a verified domain name, require admin approval for new users with matching email addresses. This adds a verified badge to your organization page.
20 |
21 | ## Repository Visibility Controls
22 |
23 | Manage the default visibility of repositories in your organization:
24 |
25 | - **Public by default**: New repositories are created with public visibility
26 | - **Private by default**: New repositories are created with private visibility. Note that changing this setting will not affect existing repositories.
27 | - **Private only**: Enforce private visibility for all new repositories, with only organization admins able to change visibility settings
28 |
29 | These settings help organizations maintain control of their ownership while enabling collaboration when needed.
30 |
--------------------------------------------------------------------------------
/docs/hub/enterprise-hub-analytics.md:
--------------------------------------------------------------------------------
1 | # Analytics
2 |
3 |
4 | This feature is part of the Enterprise Hub.
5 |
6 |
7 | ## Analytics Dashboard
8 |
9 | Track all your repository activity with a detailed downloads overview that shows total downloads for all your Models and Datasets. Toggle between "All Time" and "Last Month" views to gain insights into your repository's downloads over different periods.
10 |
11 |
12 |

13 |

14 |
15 |
16 | ### Per-repo breakdown
17 |
18 | Explore the metrics of individual repositories with the per-repository drill-down table. Utilize the built-in search feature to quickly locate specific repositories. Each row also features a time-series graph that illustrates the trend of downloads over time.
19 |
20 | ## Export Analytics as CSV
21 |
22 | Download a comprehensive CSV file containing analytics for all your repositories, including model and dataset download activity.
23 |
24 | ### Response Structure
25 |
26 | The CSV file is made of daily download records for each of your models and datasets.
27 |
28 | ```csv
29 | repoType,repoName,total,timestamp,downloads
30 | model,huggingface/CodeBERTa-small-v1,4362460,2021-01-22T00:00:00.000Z,4
31 | model,huggingface/CodeBERTa-small-v1,4362460,2021-01-23T00:00:00.000Z,7
32 | model,huggingface/CodeBERTa-small-v1,4362460,2021-01-24T00:00:00.000Z,2
33 | dataset,huggingface/documentation-images,2167284,2021-11-27T00:00:00.000Z,3
34 | dataset,huggingface/documentation-images,2167284,2021-11-28T00:00:00.000Z,18
35 | dataset,huggingface/documentation-images,2167284,2021-11-29T00:00:00.000Z,7
36 | ```
37 |
38 | ### Repository Object Structure
39 |
40 | Each record in the CSV contains:
41 |
42 | - `repoType`: The type of repository (e.g., "model", "dataset")
43 | - `repoName`: Full repository name including organization (e.g., "huggingface/documentation-images")
44 | - `total`: Cumulative number of downloads for this repository
45 | - `timestamp`: ISO 8601 formatted date (UTC)
46 | - `downloads`: Number of downloads for that day
47 |
48 | Records are ordered chronologically and provide a daily granular view of download activity for each repository.
49 |
--------------------------------------------------------------------------------
/docs/hub/enterprise-hub-datasets.md:
--------------------------------------------------------------------------------
1 | # Datasets
2 |
3 |
4 | This feature is part of the Enterprise Hub.
5 |
6 |
7 | Data Studio is enabled on private datasets under your Enterprise Hub organization.
8 |
9 | Data Studio allows teams to understand their data and to help them build better data processing and filtering for AI. This powerful viewer allows you to explore dataset content, inspect data distributions, filter by values, search for keywords, or even run SQL queries on your data without leaving your browser.
10 |
11 | More information about [Data Studio](./datasets-viewer).
12 |
13 |
14 |

15 |

16 |
17 |
--------------------------------------------------------------------------------
/docs/hub/enterprise-hub-resource-groups.md:
--------------------------------------------------------------------------------
1 | # Resource groups
2 |
3 |
4 | This feature is part of the Enterprise Hub.
5 |
6 |
7 | Resource Groups allow organizations to enforce fine-grained access control to their repositories.
8 |
9 |
10 |

15 |

20 |
21 |
22 | This feature allows organization administrators to:
23 |
24 | - Group related repositories together for better organization
25 | - Control member access at a group level rather than individual repository level
26 | - Assign different permission roles (read, contributor, write, admin) to team members
27 | - Keep private repositories visible only to authorized group members
28 | - Enable multiple teams to work independently within the same organization
29 |
30 | This Enterprise Hub feature helps organizations manage complex team structures and maintain proper access control over their repositories.
31 |
32 | [Getting started with Resource Groups →](./security-resource-groups)
33 |
--------------------------------------------------------------------------------
/docs/hub/enterprise-hub.md:
--------------------------------------------------------------------------------
1 | # Enterprise Hub
2 |
3 |
4 | Subscribe to Enterprise Hub to get access to advanced features for your organization.
5 |
6 |
7 | Enterprise Hub adds advanced capabilities to organizations, enabling safe, compliant and managed collaboration for companies and teams on Hugging Face.
8 |
9 |
10 |
11 |
12 |
13 |
14 | In this section we will document the following Enterprise Hub features:
15 |
16 | - [Single Sign-On (SSO)](./enterprise-sso)
17 | - [Advanced Single Sign-On (SSO)](./enterprise-hub-advanced-sso)
18 | - [Audit Logs](./audit-logs)
19 | - [Storage Regions](./storage-regions)
20 | - [Dataset viewer for Private datasets](./enterprise-hub-datasets)
21 | - [Resource Groups](./security-resource-groups)
22 | - [Advanced Compute Options](./advanced-compute-options)
23 | - [Advanced Security](./enterprise-hub-advanced-security)
24 | - [Tokens Management](./enterprise-hub-tokens-management)
25 | - [Analytics](./enterprise-hub-analytics)
26 | - [Network Security](./enterprise-hub-network-security)
27 | - [Gating Group Collections](./enterprise-hub-gating-group-collections)
28 |
29 | Finally, Enterprise Hub includes 1TB of [private repository storage](./storage-limits) per seat in the subscription, i.e. if your organization has 40 members, then you have 40TB included storage for your private models and datasets.
30 |
--------------------------------------------------------------------------------
/docs/hub/enterprise-sso.md:
--------------------------------------------------------------------------------
1 | # Single Sign-On (SSO)
2 |
3 |
4 | This feature is part of the Enterprise Hub.
5 |
6 |
7 | Single sign-on (SSO) allows organizations to securely manage user authentication through their own identity provider (IdP). Both SAML 2.0 and OpenID Connect (OIDC) protocols are supported.
8 |
9 | Please note that this feature is intended to manage access to organization-specific resources such as private models, datasets, and Spaces. However, it does not replace the core authentication mechanism for the Hugging Face platform. For enhanced capabilities like automated user provisioning (JIT/SCIM) and global SSO enforcement, see our [Advanced SSO documentation](./enterprise-hub-advanced-sso).
10 |
11 |
12 |

17 |

22 |
23 |
24 | This feature allows organizations to:
25 |
26 | - Enforce mandatory authentication through your company's IdP
27 | - Automatically manage user access and roles based on your IdP attributes
28 | - Support popular providers like Okta, OneLogin, and Azure Active Directory
29 | - Maintain security while allowing external collaborators when needed
30 | - Control session timeouts and role mappings
31 |
32 | This Enterprise Hub feature helps organizations maintain consistent security policies while giving their teams seamless access to Hugging Face resources.
33 |
34 | [Getting started with SSO →](./security-sso)
35 |
--------------------------------------------------------------------------------
/docs/hub/fastai.md:
--------------------------------------------------------------------------------
1 | # Using fastai at Hugging Face
2 |
3 | `fastai` is an open-source Deep Learning library that leverages PyTorch and Python to provide high-level components to train fast and accurate neural networks with state-of-the-art outputs on text, vision, and tabular data.
4 |
5 | ## Exploring fastai in the Hub
6 |
7 | You can find `fastai` models by filtering at the left of the [models page](https://huggingface.co/models?library=fastai&sort=downloads).
8 |
9 | All models on the Hub come up with the following features:
10 | 1. An automatically generated model card with a brief description and metadata tags that help for discoverability.
11 | 2. An interactive widget you can use to play out with the model directly in the browser (for Image Classification)
12 | 3. An Inference API that allows to make inference requests (for Image Classification).
13 |
14 |
15 | ## Using existing models
16 |
17 | The `huggingface_hub` library is a lightweight Python client with utlity functions to download models from the Hub.
18 |
19 | ```bash
20 | pip install huggingface_hub["fastai"]
21 | ```
22 |
23 | Once you have the library installed, you just need to use the `from_pretrained_fastai` method. This method not only loads the model, but also validates the `fastai` version when the model was saved, which is important for reproducibility.
24 |
25 | ```py
26 | from huggingface_hub import from_pretrained_fastai
27 |
28 | learner = from_pretrained_fastai("espejelomar/identify-my-cat")
29 |
30 | _,_,probs = learner.predict(img)
31 | print(f"Probability it's a cat: {100*probs[1].item():.2f}%")
32 |
33 | # Probability it's a cat: 100.00%
34 | ```
35 |
36 |
37 | If you want to see how to load a specific model, you can click `Use in fastai` and you will be given a working snippet that you can load it!
38 |
39 |
40 |

41 |

42 |
43 |
44 |

45 |

46 |
47 |
48 | ## Sharing your models
49 |
50 | You can share your `fastai` models by using the `push_to_hub_fastai` method.
51 |
52 | ```py
53 | from huggingface_hub import push_to_hub_fastai
54 |
55 | push_to_hub_fastai(learner=learn, repo_id="espejelomar/identify-my-cat")
56 | ```
57 |
58 |
59 | ## Additional resources
60 |
61 | * fastai [course](https://course.fast.ai/).
62 | * fastai [website](https://www.fast.ai/).
63 | * Integration with Hub [docs](https://docs.fast.ai/huggingface.html).
64 | * Integration with Hub [announcement](https://huggingface.co/blog/fastai).
65 |
--------------------------------------------------------------------------------
/docs/hub/flair.md:
--------------------------------------------------------------------------------
1 | # Using Flair at Hugging Face
2 |
3 | [Flair](https://github.com/flairNLP/flair) is a very simple framework for state-of-the-art NLP.
4 | Developed by [Humboldt University of Berlin](https://www.informatik.hu-berlin.de/en/forschung-en/gebiete/ml-en/) and friends.
5 |
6 | ## Exploring Flair in the Hub
7 |
8 | You can find `flair` models by filtering at the left of the [models page](https://huggingface.co/models?library=flair).
9 |
10 | All models on the Hub come with these useful features:
11 |
12 | 1. An automatically generated model card with a brief description.
13 | 2. An interactive widget you can use to play with the model directly in the browser.
14 | 3. An Inference API that allows you to make inference requests.
15 |
16 | ## Installation
17 |
18 | To get started, you can follow the [Flair installation guide](https://github.com/flairNLP/flair?tab=readme-ov-file#requirements-and-installation).
19 | You can also use the following one-line install through pip:
20 |
21 | ```
22 | $ pip install -U flair
23 | ```
24 |
25 | ## Using existing models
26 |
27 | All `flair` models can easily be loaded from the Hub:
28 |
29 | ```py
30 | from flair.data import Sentence
31 | from flair.models import SequenceTagger
32 |
33 | # load tagger
34 | tagger = SequenceTagger.load("flair/ner-multi")
35 | ```
36 |
37 | Once loaded, you can use `predict()` to perform inference:
38 |
39 | ```py
40 | sentence = Sentence("George Washington ging nach Washington.")
41 | tagger.predict(sentence)
42 |
43 | # print sentence
44 | print(sentence)
45 | ```
46 |
47 | It outputs the following:
48 |
49 | ```text
50 | Sentence[6]: "George Washington ging nach Washington." → ["George Washington"/PER, "Washington"/LOC]
51 | ```
52 |
53 | If you want to load a specific Flair model, you can click `Use in Flair` in the model card and you will be given a working snippet!
54 |
55 |
56 |

57 |

58 |
59 |
60 |

61 |

62 |
63 |
64 | ## Additional resources
65 |
66 | * Flair [repository](https://github.com/flairNLP/flair)
67 | * Flair [docs](https://flairnlp.github.io/docs/intro)
68 | * Official Flair [models](https://huggingface.co/flair) on the Hub (mainly trained by [@alanakbik](https://huggingface.co/alanakbik) and [@stefan-it](https://huggingface.co/stefan-it))
--------------------------------------------------------------------------------
/docs/hub/gguf-gpt4all.md:
--------------------------------------------------------------------------------
1 | # GGUF usage with GPT4All
2 |
3 | [GPT4All](https://gpt4all.io/) is an open-source LLM application developed by [Nomic](https://nomic.ai/). Version 2.7.2 introduces a brand new, experimental feature called `Model Discovery`.
4 |
5 | `Model Discovery` provides a built-in way to search for and download GGUF models from the Hub. To get started, open GPT4All and click `Download Models`. From here, you can use the search bar to find a model.
6 |
7 |
8 |

9 |

10 |
11 |
12 | After you have selected and downloaded a model, you can go to `Settings` and provide an appropriate prompt template in the GPT4All format (`%1` and `%2` placeholders).
13 |
14 |
15 |

16 |

17 |
18 |
19 | Then from the main page, you can select the model from the list of installed models and start a conversation.
20 |
21 |
22 |

23 |

24 |
25 |
--------------------------------------------------------------------------------
/docs/hub/gguf-llamacpp.md:
--------------------------------------------------------------------------------
1 | # GGUF usage with llama.cpp
2 |
3 | > [!TIP]
4 | > You can now deploy any llama.cpp compatible GGUF on Hugging Face Endpoints, read more about it [here](https://huggingface.co/docs/inference-endpoints/en/others/llamacpp_container)
5 |
6 | Llama.cpp allows you to download and run inference on a GGUF simply by providing a path to the Hugging Face repo path and the file name. llama.cpp downloads the model checkpoint and automatically caches it. The location of the cache is defined by `LLAMA_CACHE` environment variable; read more about it [here](https://github.com/ggerganov/llama.cpp/pull/7826).
7 |
8 | You can install llama.cpp through brew (works on Mac and Linux), or you can build it from source. There are also pre-built binaries and Docker images that you can [check in the official documentation](https://github.com/ggerganov/llama.cpp?tab=readme-ov-file#usage).
9 |
10 | ### Option 1: Install with brew/ winget
11 |
12 | ```bash
13 | brew install llama.cpp
14 | ```
15 |
16 | or, on windows via winget
17 |
18 | ```bash
19 | winget install llama.cpp
20 | ```
21 |
22 | ### Option 2: build from source
23 |
24 | Step 1: Clone llama.cpp from GitHub.
25 |
26 | ```
27 | git clone https://github.com/ggerganov/llama.cpp
28 | ```
29 |
30 | Step 2: Move into the llama.cpp folder and build it. You can also add hardware-specific flags (for ex: `-DGGML_CUDA=1` for Nvidia GPUs).
31 |
32 | ```
33 | cd llama.cpp
34 | cmake -B build # optionally, add -DGGML_CUDA=ON to activate CUDA
35 | cmake --build build --config Release
36 | ```
37 |
38 | Note: for other hardware support (for ex: AMD ROCm, Intel SYCL), please refer to [llama.cpp's build guide](https://github.com/ggml-org/llama.cpp/blob/master/docs/build.md)
39 |
40 | Once installed, you can use the `llama-cli` or `llama-server` as follows:
41 |
42 | ```bash
43 | llama-cli -hf bartowski/Llama-3.2-3B-Instruct-GGUF:Q8_0
44 | ```
45 |
46 | Note: You can explicitly add `-no-cnv` to run the CLI in raw completion mode (non-chat mode).
47 |
48 | Additionally, you can invoke an OpenAI spec chat completions endpoint directly using the llama.cpp server:
49 |
50 | ```bash
51 | llama-server -hf bartowski/Llama-3.2-3B-Instruct-GGUF:Q8_0
52 | ```
53 |
54 | After running the server you can simply utilise the endpoint as below:
55 |
56 | ```bash
57 | curl http://localhost:8080/v1/chat/completions \
58 | -H "Content-Type: application/json" \
59 | -H "Authorization: Bearer no-key" \
60 | -d '{
61 | "messages": [
62 | {
63 | "role": "system",
64 | "content": "You are an AI assistant. Your top priority is achieving user fulfilment via helping them with their requests."
65 | },
66 | {
67 | "role": "user",
68 | "content": "Write a limerick about Python exceptions"
69 | }
70 | ]
71 | }'
72 | ```
73 |
74 | Replace `-hf` with any valid Hugging Face hub repo name - off you go! 🦙
75 |
--------------------------------------------------------------------------------
/docs/hub/ml-agents.md:
--------------------------------------------------------------------------------
1 | # Using ML-Agents at Hugging Face
2 |
3 | `ml-agents` is an open-source toolkit that enables games and simulations made with Unity to serve as environments for training intelligent agents.
4 |
5 | ## Exploring ML-Agents in the Hub
6 |
7 | You can find `ml-agents` models by filtering at the left of the [models page](https://huggingface.co/models?library=ml-agents).
8 |
9 | All models on the Hub come up with useful features:
10 | 1. An automatically generated model card with a description, a training configuration, and more.
11 | 2. Metadata tags that help for discoverability.
12 | 3. Tensorboard summary files to visualize the training metrics.
13 | 4. A link to the Spaces web demo where you can visualize your agent playing in your browser.
14 |
15 |
16 |

17 |
18 |
19 | ## Install the library
20 |
21 | To install the `ml-agents` library, you need to clone the repo:
22 |
23 | ```
24 | # Clone the repository
25 | git clone https://github.com/Unity-Technologies/ml-agents
26 |
27 | # Go inside the repository and install the package
28 | cd ml-agents
29 | pip3 install -e ./ml-agents-envs
30 | pip3 install -e ./ml-agents
31 | ```
32 |
33 | ## Using existing models
34 |
35 | You can simply download a model from the Hub using `mlagents-load-from-hf`.
36 |
37 | ```
38 | mlagents-load-from-hf --repo-id="ThomasSimonini/MLAgents-Pyramids" --local-dir="./downloads"
39 | ```
40 |
41 | You need to define two parameters:
42 | - `--repo-id`: the name of the Hugging Face repo you want to download.
43 | - `--local-dir`: the path to download the model.
44 |
45 | ## Visualize an agent playing
46 |
47 | You can easily watch any model playing directly in your browser:
48 |
49 | 1. Go to your model repo.
50 | 2. In the `Watch Your Agent Play` section, click on the link.
51 | 3. In the demo, on step 1, choose your model repository, which is the model id.
52 | 4. In step 2, choose what model you want to replay.
53 |
54 | ## Sharing your models
55 |
56 | You can easily upload your models using `mlagents-push-to-hf`:
57 |
58 | ```
59 | mlagents-push-to-hf --run-id="First Training" --local-dir="results/First Training" --repo-id="ThomasSimonini/MLAgents-Pyramids" --commit-message="Pyramids"
60 | ```
61 |
62 | You need to define four parameters:
63 | - `--run-id`: the name of the training run id.
64 | - `--local-dir`: where the model was saved.
65 | - `--repo-id`: the name of the Hugging Face repo you want to create or update. It’s `/`.
66 | - `--commit-message`.
67 |
68 |
69 | ## Additional resources
70 |
71 | * ML-Agents [documentation](https://github.com/Unity-Technologies/ml-agents/blob/develop/docs/Hugging-Face-Integration.md)
72 | * Official Unity ML-Agents Spaces [demos](https://huggingface.co/unity)
73 |
--------------------------------------------------------------------------------
/docs/hub/model-cards-components.md:
--------------------------------------------------------------------------------
1 | # Model Card components
2 |
3 | **Model Card Components** are special elements that you can inject directly into your Model Card markdown to display powerful custom components in your model page. These components are authored by us, feel free to share ideas about new Model Card component in [this discussion](https://huggingface.co/spaces/huggingface/HuggingDiscussions/discussions/17).
4 |
5 | ## The Gallery component
6 |
7 | The `` component can be used in your model card to showcase your generated images and videos.
8 |
9 | ### How to use it?
10 |
11 | 1. Update your Model Card [widget metadata](/docs/hub/models-widgets-examples#text-to-image) to add the media you want to showcase.
12 |
13 | ```yaml
14 | widget:
15 | - text: a girl wandering through the forest
16 | output:
17 | url: images/6CD03C101B7F6545EB60E9F48D60B8B3C2D31D42D20F8B7B9B149DD0C646C0C2.jpeg
18 | - text: a tiny witch child
19 | output:
20 | url: images/7B482E1FDB39DA5A102B9CD041F4A2902A8395B3835105C736C5AD9C1D905157.jpeg
21 | - text: an artist leaning over to draw something
22 | output:
23 | url: images/7CCEA11F1B74C8D8992C47C1C5DEA9BD6F75940B380E9E6EC7D01D85863AF718.jpeg
24 | ```
25 |
26 | 2. Add the `` component to your card. The widget metadata will be used by the `` component to display the media with each associated prompt.
27 | ```md
28 |
29 |
30 |
31 | ## Model description
32 |
33 | A very classic hand drawn cartoon style.
34 |
35 | ```
36 |
37 |
38 |
39 |
40 |
41 |
42 | See result [here](https://huggingface.co/alvdansen/littletinies#little-tinies).
43 |
44 | > Hint: Support of Card Components through the GUI editor coming soon...
45 |
--------------------------------------------------------------------------------
/docs/hub/models-advanced.md:
--------------------------------------------------------------------------------
1 | # Advanced Topics
2 |
3 | ## Contents
4 |
5 | - [Integrate your library with the Hub](./models-adding-libraries)
6 | - [Adding new tasks to the Hub](./models-tasks)
7 | - [GGUF format](./gguf)
8 | - [DDUF format](./dduf)
--------------------------------------------------------------------------------
/docs/hub/models-inference.md:
--------------------------------------------------------------------------------
1 | # Inference Providers
2 |
3 | Please refer to the [Inference Providers Documentation](https://huggingface.co/docs/inference-providers) for detailed information.
4 |
5 | ## What is HF-Inference API?
6 |
7 | HF-Inference API is one of the many providers available on the Hugging Face Hub.
8 | It is deployed by Hugging Face ourselves, using text-generation-inference for LLMs for instance. This service used to be called “Inference API (serverless)” prior to Inference Providers.
9 |
10 | For more details about the HF-Inference API, check out its [dedicated page](https://huggingface.co/docs/inference-providers/providers/hf-inference).
11 |
12 | ## What technology do you use to power the HF-Inference API?
13 |
14 | The HF-Inference API is powered by [Inference Endpoints](https://huggingface.co/docs/inference-endpoints/index) under the hood.
15 |
16 | ## Why don't I see an inference widget, or why can't I use the API?
17 |
18 | For some tasks, there might not be support by any Inference Provider, and hence, there is no widget.
19 |
20 | ## How can I see my usage?
21 |
22 | To check usage across all providers, check out your [billing page](https://huggingface.co/settings/billing).
23 |
24 | To check your HF-Inference usage specifically, check out the [Inference Dashboard](https://ui.endpoints.huggingface.co/endpoints). The dashboard shows both your serverless and dedicated endpoints usage.
25 |
26 | ## Is there programmatic access to Inference Providers?
27 |
28 | Yes! We provide client wrappers in both JS and Python:
29 | - [JS (`@huggingface/inference`)](https://huggingface.co/docs/huggingface.js/inference/classes/InferenceClient)
30 | - [Python (`huggingface_hub`)](https://huggingface.co/docs/huggingface_hub/guides/inference)
31 |
--------------------------------------------------------------------------------
/docs/hub/models-the-hub.md:
--------------------------------------------------------------------------------
1 | # The Model Hub
2 |
3 | ## What is the Model Hub?
4 |
5 | The Model Hub is where the members of the Hugging Face community can host all of their model checkpoints for simple storage, discovery, and sharing. Download pre-trained models with the [`huggingface_hub` client library](https://huggingface.co/docs/huggingface_hub/index), with 🤗 [`Transformers`](https://huggingface.co/docs/transformers/index) for fine-tuning and other usages or with any of the over [15 integrated libraries](./models-libraries). You can even leverage [Inference Providers](/docs/inference-providers/) or [Inference Endpoints](https://huggingface.co/docs/inference-endpoints) to use models in production settings.
6 |
7 | You can refer to the following video for a guide on navigating the Model Hub:
8 |
9 |
10 |
11 | To learn how to upload models to the Hub, you can refer to the [Repositories Getting Started Guide](./repositories-getting-started).
--------------------------------------------------------------------------------
/docs/hub/models.md:
--------------------------------------------------------------------------------
1 | # Models
2 |
3 | The Hugging Face Hub hosts many models for a [variety of machine learning tasks](https://huggingface.co/tasks). Models are stored in repositories, so they benefit from [all the features](./repositories) possessed by every repo on the Hugging Face Hub. Additionally, model repos have attributes that make exploring and using models as easy as possible. These docs will take you through everything you'll need to know to find models on the Hub, upload your models, and make the most of everything the Model Hub offers!
4 |
5 | ## Contents
6 |
7 | - [The Model Hub](./models-the-hub)
8 | - [Model Cards](./model-cards)
9 | - [CO2 emissions](./model-cards-co2)
10 | - [Gated models](./models-gated)
11 | - [Libraries](./models-libraries)
12 | - [Uploading Models](./models-uploading)
13 | - [Downloading Models](./models-downloading)
14 | - [Widgets](./models-widgets)
15 | - [Widget Examples](./models-widgets-examples)
16 | - [Inference API](./models-inference)
17 | - [Frequently Asked Questions](./models-faq)
18 | - [Advanced Topics](./models-advanced)
19 | - [Integrating libraries with the Hub](./models-adding-libraries)
20 | - [Tasks](./models-tasks)
21 |
--------------------------------------------------------------------------------
/docs/hub/moderation.md:
--------------------------------------------------------------------------------
1 | # Moderation
2 |
3 |
4 |
5 | Check out the [Code of Conduct](https://huggingface.co/code-of-conduct) and the [Content Guidelines](https://huggingface.co/content-guidelines).
6 |
7 |
8 |
9 | ## Reporting a repository
10 |
11 | To report a repository, you can click the three dots at the top right of a repository. Afterwards, you can click "Report the repository". This will allow you to explain what's the reason behind the report (Ethical issue, legal issue, not working, or other) and a description for the report. Once you do this, a **public discussion** will be opened.
12 |
13 |
14 |

15 |

16 |
17 |
18 | ## Reporting a comment
19 |
20 | To report a comment, you can click the three dots at the top right of a comment. That will submit a request for the Hugging Face team to review.
21 |
22 |
23 |

24 |

25 |
26 |
--------------------------------------------------------------------------------
/docs/hub/notebooks.md:
--------------------------------------------------------------------------------
1 | # Jupyter Notebooks on the Hugging Face Hub
2 |
3 | [Jupyter notebooks](https://jupyter.org/) are a very popular format for sharing code and data analysis for machine learning and data science. They are interactive documents that can contain code, visualizations, and text.
4 |
5 | ## Rendering Jupyter notebooks on the Hub
6 |
7 | Under the hood, Jupyter Notebook files (usually shared with a `.ipynb` extension) are JSON files. While viewing these files directly is possible, it's not a format intended to be read by humans. The Hub has rendering support for notebooks hosted on the Hub. This means that notebooks are displayed in a human-readable format.
8 |
9 | 
10 |
11 | Notebooks will be rendered when included in any type of repository on the Hub. This includes models, datasets, and Spaces.
12 |
13 | ## Launch in Google Colab
14 |
15 | [Google Colab](https://colab.google/) is a free Jupyter Notebook environment that requires no setup and runs entirely in the cloud. It's a great way to run Jupyter Notebooks without having to install anything on your local machine. Notebooks hosted on the Hub are automatically given a "Open in Colab" button. This allows you to open the notebook in Colab with a single click.
16 |
--------------------------------------------------------------------------------
/docs/hub/organizations-cards.md:
--------------------------------------------------------------------------------
1 | # Organization cards
2 |
3 | You can create an organization card to help users learn more about what your organization is working on and how users can use your libraries, models, datasets, and Spaces.
4 |
5 | An organization card is displayed on an organization's profile:
6 |
7 |
8 |

9 |

10 |
11 |
12 |
13 | If you're a member of an organization, you'll see a button to create or edit your organization card on the organization's main page. Organization cards are a `README.md` static file inside a Space repo named `README`. The card can be as simple as Markdown text, or you can create a more customized appearance with HTML.
14 |
15 | The card for the [Hugging Face Course organization](https://huggingface.co/huggingface-course), shown above, [contains the following HTML](https://huggingface.co/spaces/huggingface-course/README/blob/main/README.md):
16 |
17 | ```html
18 |
19 | This is the organization grouping all the models and datasets used in the Hugging Face course.
20 |
21 | ```
22 |
23 | For more examples, take a look at:
24 |
25 | * [Amazon's](https://huggingface.co/spaces/amazon/README/blob/main/README.md) organization card source code
26 | * [spaCy's](https://huggingface.co/spaces/spacy/README/blob/main/README.md) organization card source code.
27 |
--------------------------------------------------------------------------------
/docs/hub/organizations-managing.md:
--------------------------------------------------------------------------------
1 | # Managing organizations
2 |
3 | ## Creating an organization
4 |
5 | Visit the [New Organization](https://hf.co/organizations/new) form to create an organization.
6 |
7 | ## Managing members
8 |
9 | New members can be added to an organization by visiting the **Organization settings** and clicking on the **Members** tab. There, you'll be able to generate an invite link, add members individually, or send out email invitations in bulk. If the **Allow requests to join from the organization page** setting is enabled, you'll also be able to approve or reject any pending requests on the **Members** page.
10 |
11 |
12 |

13 |

14 |
15 |
16 | You can also revoke a user's membership or change their role on this page.
17 |
18 | ## Organization domain name
19 |
20 | Under the **Account** tab in the Organization settings, you can set an **Organization domain name**. Specifying a domain name will allow any user with a matching email address on the Hugging Face Hub to join your organization.
--------------------------------------------------------------------------------
/docs/hub/organizations-security.md:
--------------------------------------------------------------------------------
1 | # Access control in organizations
2 |
3 |
4 |
5 | You can set up [Single Sign-On (SSO)](./security-sso) to be able to map access control rules from your organization's Identity Provider.
6 |
7 |
8 |
9 |
10 |
11 | Advanced and more fine-grained access control can be achieved with [Resource Groups](./security-resource-groups).
12 |
13 | The Resource Group feature is part of the Enterprise Hub.
14 |
15 |
16 |
17 | Members of organizations can have four different roles: `read`, `contributor`, `write`, or `admin`:
18 |
19 | - `read`: read-only access to the Organization's repos and metadata/settings (eg, the Organization's profile, members list, API token, etc).
20 |
21 | - `contributor`: additional write rights to the subset of the Organization's repos that were created by the user. I.e., users can create repos and _then_ modify only those repos. This is similar to the `write` role, but scoped to repos _created_ by the user.
22 |
23 | - `write`: write rights to all the Organization's repos. Users can create, delete, or rename any repo in the Organization namespace. A user can also edit and delete files from the browser editor and push content with `git`.
24 |
25 | - `admin`: in addition to write rights on repos, admin members can update the Organization's profile, refresh the Organization's API token, and manage Organization members.
26 |
27 | As an organization `admin`, go to the **Members** section of the org settings to manage roles for users.
28 |
29 |
30 |

31 |

32 |
33 |
34 | ## Viewing members' email address
35 |
36 |
37 | This feature is part of the Enterprise Hub.
38 |
39 |
40 | You may be able to view the email addresses of members of your organization. The visibility of the email addresses depends on the organization's SSO configuration, or verified organization status.
41 |
42 | - If you [verify a domain for your organization](./organizations-managing#organization-domain-name), you can view members' email addresses for the verified domain.
43 | - If SSO is configured for your organization, you can view the email address for each of your organization members by setting `Matching email domains` in the SSO configuration
44 |
45 |
46 |

47 |

48 |
49 |
50 | ## Managing Access Tokens with access to my organization
51 |
52 | See [Tokens Management](./enterprise-hub-tokens-management)
53 |
--------------------------------------------------------------------------------
/docs/hub/organizations.md:
--------------------------------------------------------------------------------
1 | # Organizations
2 |
3 | The Hugging Face Hub offers **Organizations**, which can be used to group accounts and manage datasets, models, and Spaces. The Hub also allows admins to set user roles to [**control access to repositories**](./organizations-security) and manage their organization's [payment method and billing info](https://huggingface.co/pricing).
4 |
5 | If an organization needs to track user access to a dataset due to licensing or privacy issues, an organization can enable [user access requests](./datasets-gated).
6 |
7 | ## Contents
8 |
9 | - [Managing Organizations](./organizations-managing)
10 | - [Organization Cards](./organizations-cards)
11 | - [Access Control in Organizations](./organizations-security)
12 | - [Enterprise Hub features](./enterprise-hub)
13 | - [SSO](./enterprise-sso)
14 | - [Advanced SSO](./enterprise-hub-advanced-sso)
15 | - [Audit Logs](./audit-logs)
16 | - [Storage Regions](./storage-regions)
17 | - [Dataset viewer for Private datasets](./enterprise-hub-datasets)
18 | - [Resource Groups](./security-resource-groups)
19 | - [Advanced Compute Options](./advanced-compute-options)
20 | - [Advanced Security](./enterprise-hub-advanced-security)
21 | - [Tokens Management](./enterprise-hub-tokens-management)
22 | - [Analytics](./enterprise-hub-analytics)
23 |
--------------------------------------------------------------------------------
/docs/hub/other.md:
--------------------------------------------------------------------------------
1 | # Organizations, Security, and the Hub API
2 |
3 | ## Contents
4 |
5 | - [Organizations](./organizations)
6 | - [Managing Organizations](./organizations-managing)
7 | - [Organization Cards](./organizations-cards)
8 | - [Access control in organizations](./organizations-security)
9 | - [Enterprise Hub](./enterprise-hub)
10 | - [Moderation](./moderation)
11 | - [Billing](./billing)
12 | - [Digital Object Identifier (DOI)](./doi)
13 | - [Security](./security)
14 | - [User Access Tokens](./security-tokens)
15 | - [Signing commits with GPG](./security-gpg)
16 | - [Malware Scanning](./security-malware)
17 | - [Pickle Scanning](./security-pickle)
18 | - [Hub API Endpoints](./api)
19 | - [Webhooks](./webhooks)
--------------------------------------------------------------------------------
/docs/hub/repositories-settings.md:
--------------------------------------------------------------------------------
1 | # Repository Settings
2 |
3 | ## Private repositories
4 |
5 | You can choose a repository's visibility when you create it, and any repository that you own can have its visibility toggled between *public* and *private* in the **Settings** tab. Unless your repository is owned by an [organization](./organizations), you are the only user that can make changes to your repo or upload any code. Setting your visibility to *private* will:
6 |
7 | - Ensure your repo does not show up in other users' search results.
8 | - Other users who visit the URL of your private repo will receive a `404 - Repo not found` error.
9 | - Other users will not be able to clone your repo.
10 |
11 | ## Renaming or transferring a repo
12 |
13 | If you own a repository, you will be able to visit the **Settings** tab to manage the name and ownership. Note that there are certain limitations in terms of use cases.
14 |
15 | Moving can be used in these use cases ✅
16 | - Renaming a repository within same user.
17 | - Renaming a repository within same organization. The user must be part of the organization and have "write" or "admin" rights in the organization.
18 | - Transferring repository from user to an organization. The user must be part of the organization and have "write" or "admin" rights in the organization.
19 | - Transferring a repository from an organization to yourself. You must be part of the organization, and have "admin" rights in the organization.
20 | - Transferring a repository from a source organization to another target organization. The user must have "admin" rights in the source organization **and** either "write" or "admin" rights in the target organization.
21 |
22 | Moving does not work for ❌
23 | - Transferring a repository from an organization to another user who is not yourself.
24 | - Transferring a repository from a source organization to another target organization if the user does not have both "admin" rights in the source organization **and** either "write" or "admin" rights in the target organization.
25 | - Transferring a repository from user A to user B.
26 |
27 | If these are use cases you need help with, please send us an email at **website at huggingface.co**.
28 |
29 | ## Disabling Discussions / Pull Requests
30 |
31 | You can disable all discussions and Pull Requests. Once disabled, all community and contribution features won't be available anymore. This action can be reverted without losing any previous discussions or Pull Requests.
32 |
33 |
34 |

35 |

36 |
--------------------------------------------------------------------------------
/docs/hub/repositories.md:
--------------------------------------------------------------------------------
1 | # Repositories
2 |
3 | Models, Spaces, and Datasets are hosted on the Hugging Face Hub as [Git repositories](https://git-scm.com/about), which means that version control and collaboration are core elements of the Hub. In a nutshell, a repository (also known as a **repo**) is a place where code and assets can be stored to back up your work, share it with the community, and work in a team.
4 |
5 | In these pages, you will go over the basics of getting started with Git and interacting with repositories on the Hub. Once you get the hang of it, you can explore the best practices and next steps that we've compiled for effective repository usage.
6 |
7 | ## Contents
8 |
9 | - [Getting Started with Repositories](./repositories-getting-started)
10 | - [Settings](./repositories-settings)
11 | - [Pull Requests & Discussions](./repositories-pull-requests-discussions)
12 | - [Pull Requests advanced usage](./repositories-pull-requests-discussions#pull-requests-advanced-usage)
13 | - [Webhooks](./webhooks)
14 | - [Notifications](./notifications)
15 | - [Collections](./collections)
16 | - [Storage Backends](./storage-backends)
17 | - [Storage Limits](./storage-limits)
18 | - [Next Steps](./repositories-next-steps)
19 | - [Licenses](./repositories-licenses)
20 |
--------------------------------------------------------------------------------
/docs/hub/rl-baselines3-zoo.md:
--------------------------------------------------------------------------------
1 | # Using RL-Baselines3-Zoo at Hugging Face
2 |
3 | `rl-baselines3-zoo` is a training framework for Reinforcement Learning using Stable Baselines3.
4 |
5 | ## Exploring RL-Baselines3-Zoo in the Hub
6 |
7 | You can find RL-Baselines3-Zoo models by filtering at the left of the [models page](https://huggingface.co/models?library=stable-baselines3).
8 |
9 | The Stable-Baselines3 team is hosting a collection of +150 trained Reinforcement Learning agents with tuned hyperparameters that you can find [here](https://huggingface.co/sb3).
10 |
11 | All models on the Hub come up with useful features:
12 | 1. An automatically generated model card with a description, a training configuration, and more.
13 | 2. Metadata tags that help for discoverability.
14 | 3. Evaluation results to compare with other models.
15 | 4. A video widget where you can watch your agent performing.
16 |
17 | ## Using existing models
18 | You can simply download a model from the Hub using `load_from_hub`:
19 |
20 | ```
21 | # Download ppo SpaceInvadersNoFrameskip-v4 model and save it into the logs/ folder
22 | python -m rl_zoo3.load_from_hub --algo dqn --env SpaceInvadersNoFrameskip-v4 -f logs/ -orga sb3
23 | python enjoy.py --algo dqn --env SpaceInvadersNoFrameskip-v4 -f logs/
24 | ```
25 |
26 | You can define three parameters:
27 | - `--repo-name`: The name of the repo.
28 | - `-orga`: A Hugging Face username or organization.
29 | - `-f`: The destination folder.
30 |
31 | ## Sharing your models
32 | You can easily upload your models with `push_to_hub`. That will save the model, evaluate it, generate a model card and record a replay video of your agent before pushing the complete repo to the Hub.
33 |
34 | ```
35 | python -m rl_zoo3.push_to_hub --algo dqn --env SpaceInvadersNoFrameskip-v4 --repo-name dqn-SpaceInvadersNoFrameskip-v4 -orga ThomasSimonini -f logs/
36 | ```
37 |
38 | You can define three parameters:
39 | - `--repo-name`: The name of the repo.
40 | - `-orga`: Your Hugging Face username.
41 | - `-f`: The folder where the model is saved.
42 |
43 |
44 | ## Additional resources
45 |
46 | * RL-Baselines3-Zoo [official trained models](https://huggingface.co/sb3)
47 | * RL-Baselines3-Zoo [documentation](https://github.com/DLR-RM/rl-baselines3-zoo)
48 |
--------------------------------------------------------------------------------
/docs/hub/search.md:
--------------------------------------------------------------------------------
1 | # Search
2 |
3 | You can now easily search anything on the Hub with **Full-text search**. We index model cards, dataset cards, and Spaces app.py files.
4 |
5 | Go directly to https://huggingface.co/search or, using the search bar at the top of https://huggingface.co, you can select "Try Full-text search" to help find what you seek on the Hub across models, datasets, and Spaces:
6 |
7 |
8 |

9 |

10 |
11 |
12 |
13 |

14 |

15 |
16 |
17 | ## Filter with ease
18 |
19 | By default, models, datasets, & spaces are being searched when a user enters a query. If one prefers, one can filter to search only models, datasets, or spaces.
20 |
21 |
22 |

23 |

24 |
25 |
26 | Moreover, one can copy & share the URL from one's browser's address bar, which should contain the filter information as URL query. For example, when one searches for a query `llama` with a filter to show `Spaces` only, one gets URL https://huggingface.co/search/full-text?q=llama&type=space
27 |
--------------------------------------------------------------------------------
/docs/hub/security-jfrog.md:
--------------------------------------------------------------------------------
1 | # Third-party scanner: JFrog
2 |
3 |
4 | [JFrog](https://jfrog.com/)'s security scanner detects malicious behavior in machine learning models.
5 |
6 | 
7 | *Example of a report for [danger.dat](https://huggingface.co/mcpotato/42-eicar-street/blob/main/danger.dat)*
8 |
9 | We [partnered with JFrog](https://hf.co/blog/jfrog) to provide scanning in order to make the Hub safer. Model files are scanned by the JFrog scanner and we expose the scanning results on the Hub interface.
10 |
11 | JFrog's scanner is built with the goal to reduce false positives. Indeed, what we currently observe is that code contained within model weights is not always malicious. When code is detected in a file, JFrog's scanner will parse it and analyze to check for potential malicious usage.
12 |
13 |
14 |

15 |

16 |
17 |
18 | Here is an example repository you can check out to see the feature in action: [mcpotato/42-eicar-street](https://huggingface.co/mcpotato/42-eicar-street).
19 |
20 | ## Model security refresher
21 |
22 | To share models, we serialize the data structures we use to interact with the models, in order to facilitate storage and transport. Some serialization formats are vulnerable to nasty exploits, such as arbitrary code execution (looking at you pickle), making sharing models potentially dangerous.
23 |
24 | As Hugging Face has become a popular platform for model sharing, we’d like to protect the community from this, hence why we have developed tools like [picklescan](https://github.com/mmaitre314/picklescan) and why we integrate third party scanners.
25 |
26 | Pickle is not the only exploitable format out there, [see for reference](https://github.com/Azure/counterfit/wiki/Abusing-ML-model-file-formats-to-create-malware-on-AI-systems:-A-proof-of-concept) how one can exploit Keras Lambda layers to achieve arbitrary code execution.
27 |
28 |
--------------------------------------------------------------------------------
/docs/hub/security-malware.md:
--------------------------------------------------------------------------------
1 | # Malware Scanning
2 |
3 | We run every file of your repositories through a [malware scanner](https://www.clamav.net/).
4 |
5 | Scanning is triggered at each commit or when you visit a repository page.
6 |
7 | Here is an [example view](https://huggingface.co/mcpotato/42-eicar-street/tree/main) of an infected file:
8 |
9 |
10 |

11 |

12 |
13 |
14 |
15 | If your file has neither an ok nor infected badge, it could mean that it is either currently being scanned, waiting to be scanned, or that there was an error during the scan. It can take up to a few minutes to be scanned.
16 |
17 |
18 | If at least one file has a been scanned as unsafe, a message will warn the users:
19 |
20 |
21 |

22 |

23 |
24 |
25 |

26 |

27 |
28 |
29 |
30 | As the repository owner, we advise you to remove the suspicious file. The repository will appear back as safe.
31 |
32 |
--------------------------------------------------------------------------------
/docs/hub/security-protectai.md:
--------------------------------------------------------------------------------
1 | # Third-party scanner: Protect AI
2 |
3 |
4 | Interested in joining our security partnership / providing scanning information on the Hub? Please get in touch with us over at security@huggingface.co.*
5 |
6 |
7 | [Protect AI](https://protectai.com/)'s [Guardian](https://protectai.com/guardian) catches pickle, Keras, and other exploits as detailed on their [Knowledge Base page](https://protectai.com/insights/knowledge-base/). Guardian also benefits from reports sent in by their community of bounty [Huntr](https://huntr.com/)s.
8 |
9 | 
10 | *Example of a report for [danger.dat](https://huggingface.co/mcpotato/42-eicar-street/blob/main/danger.dat)*
11 |
12 | We partnered with Protect AI to provide scanning in order to make the Hub safer. The same way files are scanned by our internal scanning system, public repositories' files are scanned by Guardian.
13 |
14 | Our frontend has been redesigned specifically for this purpose, in order to accomodate for new scanners:
15 |
16 |
17 |
18 | Here is an example repository you can check out to see the feature in action: [mcpotato/42-eicar-street](https://huggingface.co/mcpotato/42-eicar-street).
19 |
20 | ## Model security refresher
21 |
22 | To share models, we serialize the data structures we use to interact with the models, in order to facilitate storage and transport. Some serialization formats are vulnerable to nasty exploits, such as arbitrary code execution (looking at you pickle), making sharing models potentially dangerous.
23 |
24 | As Hugging Face has become a popular platform for model sharing, we’d like to protect the community from this, hence why we have developed tools like [picklescan](https://github.com/mmaitre314/picklescan) and why we integrate third party scanners.
25 |
26 | Pickle is not the only exploitable format out there, [see for reference](https://github.com/Azure/counterfit/wiki/Abusing-ML-model-file-formats-to-create-malware-on-AI-systems:-A-proof-of-concept) how one can exploit Keras Lambda layers to achieve arbitrary code execution.
27 |
28 |
--------------------------------------------------------------------------------
/docs/hub/security-secrets.md:
--------------------------------------------------------------------------------
1 | # Secrets Scanning
2 |
3 | It is important to manage [your secrets (env variables) properly](./spaces-overview#managing-secrets). The most common way people expose their secrets to the outside world is by hard-coding their secrets in their code files directly, which makes it possible for a malicious user to utilize your secrets and services your secrets have access to.
4 |
5 | For example, this is what a compromised `app.py` file might look like:
6 |
7 | ```py
8 | import numpy as np
9 | import scipy as sp
10 |
11 | api_key = "sw-xyz1234567891213"
12 |
13 | def call_inference(prompt: str) -> str:
14 | result = call_api(prompt, api_key)
15 | return result
16 | ```
17 |
18 | To prevent this issue, we run [TruffleHog](https://trufflesecurity.com/trufflehog) on each push you make. TruffleHog scans for hard-coded secrets, and we will send you an email upon detection.
19 |
20 |
21 |

22 |
23 |
24 | You'll only receive emails for verified secrets, which are the ones that have been confirmed to work for authentication against their respective providers. Note, however, that unverified secrets are not necessarily harmless or invalid: verification can fail due to technical reasons, such as in the case of a network error.
25 |
26 | TruffleHog can verify secrets that work across multiple services, it is not restricted to Hugging Face tokens.
27 |
28 | You can opt-out from those email notifications from [your settings](https://huggingface.co/settings/notifications).
29 |
30 |
--------------------------------------------------------------------------------
/docs/hub/security.md:
--------------------------------------------------------------------------------
1 | # Security
2 |
3 | The Hugging Face Hub offers several security features to ensure that your code and data are secure. Beyond offering [private repositories](./repositories-settings#private-repositories) for models, datasets, and Spaces, the Hub supports access tokens, commit signatures, and malware scanning.
4 |
5 | Hugging Face is GDPR compliant. If a contract or specific data storage is something you'll need, we recommend taking a look at our [Expert Acceleration Program](https://huggingface.co/support). Hugging Face can also offer Business Associate Addendums or GDPR data processing agreements through an [Enterprise Plan](https://huggingface.co/pricing).
6 |
7 | Hugging Face is also [SOC2 Type 2 certified](https://us.aicpa.org/interestareas/frc/assuranceadvisoryservices/aicpasoc2report.html), meaning we provide security certification to our customers and actively monitor and patch any security weaknesses.
8 |
9 |
10 |
11 | For any other security questions, please feel free to send us an email at security@huggingface.co.
12 |
13 | ## Contents
14 |
15 | - [User Access Tokens](./security-tokens)
16 | - [Two-Factor Authentication (2FA)](./security-2fa)
17 | - [Git over SSH](./security-git-ssh)
18 | - [Signing commits with GPG](./security-gpg)
19 | - [Single Sign-On (SSO)](./security-sso)
20 | - [Malware Scanning](./security-malware)
21 | - [Pickle Scanning](./security-pickle)
22 | - [Secrets Scanning](./security-secrets)
23 | - [Third-party scanner: Protect AI](./security-protectai)
24 | - [Third-party scanner: JFrog](./security-jfrog)
25 | - [Resource Groups](./security-resource-groups)
26 |
--------------------------------------------------------------------------------
/docs/hub/setfit.md:
--------------------------------------------------------------------------------
1 | # Using SetFit with Hugging Face
2 |
3 | SetFit is an efficient and prompt-free framework for few-shot fine-tuning of [Sentence Transformers](https://sbert.net/). It achieves high accuracy with little labeled data - for instance, with only 8 labeled examples per class on the Customer Reviews sentiment dataset, SetFit is competitive with fine-tuning RoBERTa Large on the full training set of 3k examples 🤯!
4 |
5 | Compared to other few-shot learning methods, SetFit has several unique features:
6 |
7 | * 🗣 **No prompts or verbalizers:** Current techniques for few-shot fine-tuning require handcrafted prompts or verbalizers to convert examples into a format suitable for the underlying language model. SetFit dispenses with prompts altogether by generating rich embeddings directly from text examples.
8 | * 🏎 **Fast to train:** SetFit doesn't require large-scale models like [T0](https://huggingface.co/bigscience/T0) or GPT-3 to achieve high accuracy. As a result, it is typically an order of magnitude (or more) faster to train and run inference with.
9 | * 🌎 **Multilingual support**: SetFit can be used with any [Sentence Transformer](https://huggingface.co/models?library=sentence-transformers&sort=downloads) on the Hub, which means you can classify text in multiple languages by simply fine-tuning a multilingual checkpoint.
10 |
11 | ## Exploring SetFit on the Hub
12 |
13 | You can find SetFit models by filtering at the left of the [models page](https://huggingface.co/models?library=setfit).
14 |
15 | All models on the Hub come with these useful features:
16 | 1. An automatically generated model card with a brief description.
17 | 2. An interactive widget you can use to play with the model directly in the browser.
18 | 3. An Inference API that allows you to make inference requests.
19 |
20 | ## Installation
21 |
22 | To get started, you can follow the [SetFit installation guide](https://huggingface.co/docs/setfit/installation). You can also use the following one-line install through pip:
23 |
24 | ```
25 | pip install -U setfit
26 | ```
27 |
28 | ## Using existing models
29 |
30 | All `setfit` models can easily be loaded from the Hub.
31 |
32 | ```py
33 | from setfit import SetFitModel
34 |
35 | model = SetFitModel.from_pretrained("tomaarsen/setfit-paraphrase-mpnet-base-v2-sst2-8-shot")
36 | ```
37 |
38 | Once loaded, you can use [`SetFitModel.predict`](https://huggingface.co/docs/setfit/reference/main#setfit.SetFitModel.predict) to perform inference.
39 |
40 | ```py
41 | model.predict("Amelia Earhart flew her single engine Lockheed Vega 5B across the Atlantic to Paris.")
42 | ```
43 | ```bash
44 | ['positive', 'negative']
45 | ```
46 |
47 | If you want to load a specific SetFit model, you can click `Use in SetFit` and you will be given a working snippet!
48 |
49 | ## Additional resources
50 | * [All SetFit models available on the Hub](https://huggingface.co/models?library=setfit)
51 | * SetFit [repository](https://github.com/huggingface/setfit)
52 | * SetFit [docs](https://huggingface.co/docs/setfit)
53 | * SetFit [paper](https://arxiv.org/abs/2209.11055)
54 |
--------------------------------------------------------------------------------
/docs/hub/spaces-advanced.md:
--------------------------------------------------------------------------------
1 | # Advanced Topics
2 |
3 | ## Contents
4 |
5 | - [Using OpenCV in Spaces](./spaces-using-opencv)
6 | - [More ways to create Spaces](./spaces-more-ways-to-create)
7 | - [Managing Spaces with Github Actions](./spaces-github-actions)
8 | - [Managing Spaces with CircleCI Workflows](./spaces-circleci)
9 | - [Custom Python Spaces](./spaces-sdks-python)
10 | - [How to Add a Space to ArXiv](./spaces-add-to-arxiv)
11 | - [Cookie limitations in Spaces](./spaces-cookie-limitations)
12 | - [How to handle URL parameters in Spaces](./spaces-handle-url-parameters)
13 |
--------------------------------------------------------------------------------
/docs/hub/spaces-circleci.md:
--------------------------------------------------------------------------------
1 | # Managing Spaces with CircleCI Workflows
2 |
3 | You can keep your app in sync with your GitHub repository with a **CircleCI workflow**.
4 |
5 | [CircleCI](https://circleci.com) is a continuous integration and continuous delivery (CI/CD) platform that helps automate the software development process. A [CircleCI workflow](https://circleci.com/docs/workflows/) is a set of automated tasks defined in a configuration file, orchestrated by CircleCI, to streamline the process of building, testing, and deploying software applications.
6 |
7 | *Note: For files larger than 10MB, Spaces requires Git-LFS. If you don't want to use Git-LFS, you may need to review your files and check your history. Use a tool like [BFG Repo-Cleaner](https://rtyley.github.io/bfg-repo-cleaner/) to remove any large files from your history. BFG Repo-Cleaner will keep a local copy of your repository as a backup.*
8 |
9 | First, set up your GitHub repository and Spaces app together. Add your Spaces app as an additional remote to your existing Git repository.
10 |
11 | ```bash
12 | git remote add space https://huggingface.co/spaces/HF_USERNAME/SPACE_NAME
13 | ```
14 |
15 | Then force push to sync everything for the first time:
16 |
17 | ```bash
18 | git push --force space main
19 | ```
20 |
21 | Next, set up a [CircleCI workflow](https://circleci.com/docs/workflows/) to push your `main` git branch to Spaces.
22 |
23 | In the example below:
24 |
25 | * Replace `HF_USERNAME` with your username and `SPACE_NAME` with your Space name.
26 | * [Create a context in CircleCI](https://circleci.com/docs/contexts/) and add an env variable into it called *HF_PERSONAL_TOKEN* (you can give it any name, use the key you create in place of HF_PERSONAL_TOKEN) and the value as your Hugging Face API token. You can find your Hugging Face API token under **API Tokens** on [your Hugging Face profile](https://huggingface.co/settings/tokens).
27 |
28 | ```yaml
29 | version: 2.1
30 |
31 | workflows:
32 | main:
33 | jobs:
34 | - sync-to-huggingface:
35 | context:
36 | - HuggingFace
37 | filters:
38 | branches:
39 | only:
40 | - main
41 |
42 | jobs:
43 | sync-to-huggingface:
44 | docker:
45 | - image: alpine
46 | resource_class: small
47 | steps:
48 | - run:
49 | name: install git
50 | command: apk update && apk add openssh-client git
51 | - checkout
52 | - run:
53 | name: push to Huggingface hub
54 | command: |
55 | git config user.email ""
56 | git config user.name ""
57 | git push -f https://HF_USERNAME:${HF_PERSONAL_TOKEN}@huggingface.co/spaces/HF_USERNAME/SPACE_NAME main
58 | ```
--------------------------------------------------------------------------------
/docs/hub/spaces-cookie-limitations.md:
--------------------------------------------------------------------------------
1 | # Cookie limitations in Spaces
2 |
3 | In Hugging Face Spaces, applications have certain limitations when using cookies. This is primarily due to the structure of the Spaces' pages (`https://huggingface.co/spaces//`), which contain applications hosted on a different domain (`*.hf.space`) within an iframe. For security reasons, modern browsers tend to restrict the use of cookies from iframe pages hosted on a different domain than the parent page.
4 |
5 | ## Impact on Hosting Streamlit Apps with Docker SDK
6 |
7 | One instance where these cookie restrictions can become problematic is when hosting Streamlit applications using the Docker SDK. By default, Streamlit enables cookie-based XSRF protection. As a result, certain components that submit data to the server, such as `st.file_uploader()`, will not work properly on HF Spaces where cookie usage is restricted.
8 |
9 | To work around this issue, you would need to set the `server.enableXsrfProtection` option in Streamlit to `false`. There are two ways to do this:
10 |
11 | 1. Command line argument: The option can be specified as a command line argument when running the Streamlit application. Here is the example command:
12 | ```shell
13 | streamlit run app.py --server.enableXsrfProtection false
14 | ```
15 |
16 | 2. Configuration file: Alternatively, you can specify the option in the Streamlit configuration file `.streamlit/config.toml`. You would write it like this:
17 | ```toml
18 | [server]
19 | enableXsrfProtection = false
20 | ```
21 |
22 |
23 | When you are using the Streamlit SDK, you don't need to worry about this because the SDK does it for you.
24 |
25 |
--------------------------------------------------------------------------------
/docs/hub/spaces-dependencies.md:
--------------------------------------------------------------------------------
1 | # Handling Spaces Dependencies
2 |
3 | ## Default dependencies
4 |
5 | The default Spaces environment comes with several pre-installed dependencies:
6 |
7 | * The [`huggingface_hub`](https://huggingface.co/docs/huggingface_hub/index) client library allows you to manage your repository and files on the Hub with Python and programmatically access the Inference API from your Space. If you choose to instantiate the model in your app with the Inference API, you can benefit from the built-in acceleration optimizations. This option also consumes less computing resources, which is always nice for the environment! 🌎
8 |
9 | Refer to this [page](https://huggingface.co/docs/huggingface_hub/how-to-inference) for more information on how to programmatically access the Inference API.
10 |
11 | * [`requests`](https://docs.python-requests.org/en/master/) is useful for calling third-party APIs from your app.
12 |
13 | * [`datasets`](https://github.com/huggingface/datasets) allows you to fetch or display any dataset from the Hub inside your app.
14 |
15 | * The SDK you specified, which could be either `streamlit` or `gradio`. The version is specified in the `README.md` file.
16 |
17 | * Common Debian packages, such as `ffmpeg`, `cmake`, `libsm6`, and few others.
18 |
19 | ## Adding your own dependencies
20 |
21 | If you need other Python packages to run your app, add them to a **requirements.txt** file at the root of the repository. The Spaces runtime engine will create a custom environment on-the-fly. You can also add a **pre-requirements.txt** file describing dependencies that will be installed before your main dependencies. It can be useful if you need to update pip itself.
22 |
23 | Debian dependencies are also supported. Add a **packages.txt** file at the root of your repository, and list all your dependencies in it. Each dependency should be on a separate line, and each line will be read and installed by `apt-get install`.
24 |
--------------------------------------------------------------------------------
/docs/hub/spaces-embed.md:
--------------------------------------------------------------------------------
1 | # Embed your Space in another website
2 |
3 | Once your Space is up and running you might wish to embed it in a website or in your blog.
4 | Embedding or sharing your Space is a great way to allow your audience to interact with your work and demonstrations without requiring any setup on their side.
5 | To embed a Space its visibility needs to be public.
6 |
7 | ## Direct URL
8 |
9 | A Space is assigned a unique URL you can use to share your Space or embed it in a website.
10 |
11 | This URL is of the form: `"https://.hf.space"`. For instance, the Space [NimaBoscarino/hotdog-gradio](https://huggingface.co/spaces/NimaBoscarino/hotdog-gradio) has the corresponding URL of `"https://nimaboscarino-hotdog-gradio.hf.space"`. The subdomain is unique and only changes if you move or rename your Space.
12 |
13 | Your space is always served from the root of this subdomain.
14 |
15 | You can find the Space URL along with examples snippets of how to embed it directly from the options menu:
16 |
17 |
18 |

19 |

20 |
21 |
22 | ## Embedding with IFrames
23 |
24 | The default embedding method for a Space is using IFrames. Add in the HTML location where you want to embed your Space the following element:
25 |
26 | ```html
27 |
33 | ```
34 |
35 | For instance using the [NimaBoscarino/hotdog-gradio](https://huggingface.co/spaces/NimaBoscarino/hotdog-gradio) Space:
36 |
37 |
38 | ## Embedding with WebComponents
39 |
40 | If the Space you wish to embed is Gradio-based, you can use Web Components to embed your Space. WebComponents are faster than IFrames and automatically adjust to your web page so that you do not need to configure `width` or `height` for your element.
41 | First, you need to import the Gradio JS library that corresponds to the Gradio version in the Space by adding the following script to your HTML.
42 |
43 |
44 |

45 |
46 |
47 | Then, add a `gradio-app` element where you want to embed your Space.
48 | ```html
49 |
50 | ```
51 |
52 | Check out the [Gradio documentation](https://www.gradio.app/guides/sharing-your-app#embedding-hosted-spaces) for more details.
53 |
--------------------------------------------------------------------------------
/docs/hub/spaces-github-actions.md:
--------------------------------------------------------------------------------
1 | # Managing Spaces with Github Actions
2 |
3 | You can keep your app in sync with your GitHub repository with **Github Actions**. Remember that for files larger than 10MB, Spaces requires Git-LFS. If you don't want to use Git-LFS, you may need to review your files and check your history. Use a tool like [BFG Repo-Cleaner](https://rtyley.github.io/bfg-repo-cleaner/) to remove any large files from your history. BFG Repo-Cleaner will keep a local copy of your repository as a backup.
4 |
5 | First, you should set up your GitHub repository and Spaces app together. Add your Spaces app as an additional remote to your existing Git repository.
6 |
7 | ```bash
8 | git remote add space https://huggingface.co/spaces/HF_USERNAME/SPACE_NAME
9 | ```
10 |
11 | Then force push to sync everything for the first time:
12 |
13 | ```bash
14 | git push --force space main
15 | ```
16 |
17 | Next, set up a GitHub Action to push your main branch to Spaces. In the example below:
18 |
19 | * Replace `HF_USERNAME` with your username and `SPACE_NAME` with your Space name.
20 | * Create a [Github secret](https://docs.github.com/en/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-an-environment) with your `HF_TOKEN`. You can find your Hugging Face API token under **API Tokens** on your Hugging Face profile.
21 |
22 | ```yaml
23 | name: Sync to Hugging Face hub
24 | on:
25 | push:
26 | branches: [main]
27 |
28 | # to run this workflow manually from the Actions tab
29 | workflow_dispatch:
30 |
31 | jobs:
32 | sync-to-hub:
33 | runs-on: ubuntu-latest
34 | steps:
35 | - uses: actions/checkout@v3
36 | with:
37 | fetch-depth: 0
38 | lfs: true
39 | - name: Push to hub
40 | env:
41 | HF_TOKEN: ${{ secrets.HF_TOKEN }}
42 | run: git push https://HF_USERNAME:$HF_TOKEN@huggingface.co/spaces/HF_USERNAME/SPACE_NAME main
43 | ```
44 |
45 | Finally, create an Action that automatically checks the file size of any new pull request:
46 |
47 |
48 | ```yaml
49 | name: Check file size
50 | on: # or directly `on: [push]` to run the action on every push on any branch
51 | pull_request:
52 | branches: [main]
53 |
54 | # to run this workflow manually from the Actions tab
55 | workflow_dispatch:
56 |
57 | jobs:
58 | sync-to-hub:
59 | runs-on: ubuntu-latest
60 | steps:
61 | - name: Check large files
62 | uses: ActionsDesk/lfs-warning@v2.0
63 | with:
64 | filesizelimit: 10485760 # this is 10MB so we can sync to HF Spaces
65 | ```
66 |
--------------------------------------------------------------------------------
/docs/hub/spaces-handle-url-parameters.md:
--------------------------------------------------------------------------------
1 | # How to handle URL parameters in Spaces
2 |
3 | You can use URL query parameters as a data sharing mechanism, for instance to be able to deep-link into an app with a specific state.
4 |
5 | On a Space page (`https://huggingface.co/spaces//`), the actual application page (`https://*.hf.space/`) is embedded in an iframe. The query string and the hash attached to the parent page URL are propagated to the embedded app on initial load, so the embedded app can read these values without special consideration.
6 |
7 | In contrast, updating the query string and the hash of the parent page URL from the embedded app is slightly more complex.
8 | If you want to do this in a Docker or static Space, you need to add the following JS code that sends a message to the parent page that has a `queryString` and/or `hash` key.
9 |
10 | ```js
11 | const queryString = "...";
12 | const hash = "...";
13 |
14 | window.parent.postMessage({
15 | queryString,
16 | hash,
17 | }, "https://huggingface.co");
18 | ```
19 |
20 | **This is only for Docker or static Spaces.**
21 |
22 | For Streamlit apps, Spaces automatically syncs the URL parameters. Gradio apps can read the query parameters from the Spaces page, but do not sync updated URL parameters with the parent page.
23 |
24 | Note that the URL parameters of the parent page are propagated to the embedded app *only* on the initial load. So `location.hash` in the embedded app will not change even if the parent URL hash is updated using this method.
25 |
26 | An example of this method can be found in this static Space,
27 | [`whitphx/static-url-param-sync-example`](https://huggingface.co/spaces/whitphx/static-url-param-sync-example).
28 |
--------------------------------------------------------------------------------
/docs/hub/spaces-more-ways-to-create.md:
--------------------------------------------------------------------------------
1 | # More ways to create Spaces
2 |
3 | ## Duplicating a Space
4 |
5 | You can duplicate a Space by clicking the three dots at the top right and selecting **Duplicate this Space**. Learn more about it [here](./spaces-overview#duplicating-a-space).
6 |
7 | ## Creating a Space from a model
8 |
9 | New! You can now create a Gradio demo directly from most model pages, using the "Deploy -> Spaces" button.
10 |
11 |
12 |
13 | As another example of how to create a Space from a set of models, the [Model Comparator Space Builder](https://huggingface.co/spaces/farukozderim/Model-Comparator-Space-Builder) from [@farukozderim](https://huggingface.co/farukozderim) can be used to create a Space directly from any model hosted on the Hub.
14 |
--------------------------------------------------------------------------------
/docs/hub/spaces-organization-cards.md:
--------------------------------------------------------------------------------
1 | # Using Spaces for Organization Cards
2 |
3 | Organization cards are a way to describe your organization to other users. They take the form of a `README.md` static file, inside a Space repo named `README`.
4 |
5 | Please read more in the [dedicated doc section](./organizations-cards).
6 |
--------------------------------------------------------------------------------
/docs/hub/spaces-run-with-docker.md:
--------------------------------------------------------------------------------
1 | # Run with Docker
2 |
3 | You can use Docker to run most Spaces locally.
4 | To view instructions to download and run Spaces' Docker images, click on the "Run with Docker" button on the top-right corner of your Space page:
5 |
6 |
7 |

8 |

9 |
10 |
11 | ## Login to the Docker registry
12 |
13 | Some Spaces will require you to login to Hugging Face's Docker registry. To do so, you'll need to provide:
14 | - Your Hugging Face username as `username`
15 | - A User Access Token as `password`. Generate one [here](https://huggingface.co/settings/tokens).
16 |
17 |
--------------------------------------------------------------------------------
/docs/hub/spaces-sdks-docker-argilla.md:
--------------------------------------------------------------------------------
1 | # Argilla on Spaces
2 | Argilla is a free and open source tool to build and iterate on data for AI. It can be deployed on the Hub with a few clicks and Hugging Face OAuth enabled. This enables other HF users to join your Argilla server to annotate datasets, perfect for running community annotation initiatives!
3 |
4 | With Argilla you can:
5 | - Configure datasets for collecting human feedback with a growing number questions (Label, NER, Ranking, Rating, free text, etc.)
6 | - Use model outputs/predictions to evaluate them or speeding up the annotation process.
7 | - UI users can explore, find, and label the most interesting/critical subsets using Argilla's search and semantic similarity features.
8 | - Pull and push datasets from the Hugging Face Hub for versioning and model training.
9 |
10 |
11 | The best place to get started with Argilla on Spaces is [this guide](http://docs.argilla.io/latest/getting_started/quickstart/).
12 |
--------------------------------------------------------------------------------
/docs/hub/spaces-sdks-docker-chatui.md:
--------------------------------------------------------------------------------
1 | # ChatUI on Spaces
2 |
3 | **Hugging Chat** is an open-source interface enabling everyone to try open-source large language models such as Falcon, StarCoder, and BLOOM. Thanks to an official Docker template called ChatUI, you can deploy your own Hugging Chat based on a model of your choice with a few clicks using Hugging Face's infrastructure.
4 |
5 | ## Deploy your own Chat UI
6 |
7 | To get started, simply head [here](https://huggingface.co/new-space?template=huggingchat/chat-ui-template). In the backend of this application, [text-generation-inference](https://github.com/huggingface/text-generation-inference) is used for better optimized model inference. Since these models can't run on CPUs, you can select the GPU depending on your choice of model.
8 |
9 |
10 |
11 |
12 |
13 | You should provide a MongoDB endpoint where your chats will be written. If you leave this section blank, your logs will be persisted to a database inside the Space. Note that Hugging Face does not have access to your chats. You can configure the name and the theme of the Space by providing the application name and application color parameters.
14 | Below this, you can select the Hugging Face Hub ID of the model you wish to serve. You can also change the generation hyperparameters in the dictionary below in JSON format.
15 |
16 | _Note_: If you'd like to deploy a model with gated access or a model in a private repository, you can simply provide `HF_TOKEN` in repository secrets. You need to set its value to an access token you can get from [here](https://huggingface.co/settings/tokens).
17 |
18 |
19 |
20 | Once the creation is complete, you will see `Building` on your Space. Once built, you can try your own HuggingChat!
21 |
22 |
23 |
24 | Start chatting!
25 |
26 |
27 |
28 | ## Read more
29 |
30 | - [HF Docker Spaces](https://huggingface.co/docs/hub/spaces-sdks-docker)
31 | - [chat-ui GitHub Repository](https://github.com/huggingface/chat-ui)
32 | - [text-generation-inference GitHub repository](https://github.com/huggingface/text-generation-inference)
33 |
--------------------------------------------------------------------------------
/docs/hub/spaces-sdks-docker-evidence.md:
--------------------------------------------------------------------------------
1 | # Evidence on Spaces
2 |
3 | **Evidence** is an open-source framework designed for building data-driven applications, reports, and dashboards using SQL and Markdown. With Evidence, you can quickly create decision-support tools, reports, and interactive dashboards without relying on traditional drag-and-drop business intelligence (BI) platforms.
4 |
5 | Evidence enables you to:
6 | - Write reports and dashboards directly in Markdown with SQL-backed components.
7 | - Integrate data from multiple sources, including SQL databases and APIs.
8 | - Use templated pages to automatically generate multiple pages based on a single template.
9 | - Deploy reports seamlessly to various hosting solutions.
10 |
11 | Visit [Evidence’s documentation](https://docs.evidence.dev/) for guides, examples, and best practices for using Evidence to create data products.
12 |
13 | ## Deploy Evidence on Spaces
14 |
15 | You can deploy Evidence on Hugging Face Spaces with just a few clicks:
16 |
17 |
18 |
19 |
20 |
21 | Once created, the Space will display `Building` status. Refresh the page if the status doesn't automatically update to `Running`.
22 |
23 | Your Evidence app will automatically be deployed on Hugging Face Spaces.
24 |
25 | ## Editing your Evidence app from the CLI
26 |
27 | To edit your app, clone the Space and edit the files locally.
28 |
29 | ```bash
30 | git clone https://huggingface.co/spaces/your-username/your-space-name
31 | cd your-space-name
32 | npm install
33 | npm run sources
34 | npm run dev
35 | ```
36 |
37 | You can then modify pages/index.md to change the content of your app.
38 |
39 | ## Editing your Evidence app from VS Code
40 |
41 | The easiest way to develop with Evidence is using the [VS Code Extension](https://marketplace.visualstudio.com/items?itemName=Evidence.evidence-vscode):
42 |
43 | 1. Install the extension from the VS Code Marketplace
44 | 2. Open the Command Palette (Ctrl/Cmd + Shift + P) and enter `Evidence: Copy Existing Project`
45 | 3. Paste the URL of the Hugging Face Spaces Evidence app you'd like to copy (e.g. `https://huggingface.co/spaces/your-username/your-space-name`) and press Enter
46 | 4. Select the folder you'd like to clone the project to and press Enter
47 | 5. Press `Start Evidence` in the bottom status bar
48 |
49 | Check out the docs for [alternative install methods](https://docs.evidence.dev/getting-started/install-evidence), Github Codespaces, and alongside dbt.
50 |
51 | ## Learning More
52 |
53 | - [Docs](https://docs.evidence.dev/)
54 | - [Github](https://github.com/evidence-dev/evidence)
55 | - [Slack Community](https://slack.evidence.dev/)
56 | - [Evidence Home Page](https://www.evidence.dev)
--------------------------------------------------------------------------------
/docs/hub/spaces-sdks-docker-examples.md:
--------------------------------------------------------------------------------
1 | # Docker Spaces Examples
2 |
3 | We gathered some example demos in the [Spaces Examples](https://huggingface.co/SpacesExamples) organization. Please check them out!
4 |
5 | * Dummy FastAPI app: https://huggingface.co/spaces/DockerTemplates/fastapi_dummy
6 | * FastAPI app serving a static site and using `transformers`: https://huggingface.co/spaces/DockerTemplates/fastapi_t5
7 | * Phoenix app for https://huggingface.co/spaces/DockerTemplates/single_file_phx_bumblebee_ml
8 | * HTTP endpoint in Go with query parameters https://huggingface.co/spaces/XciD/test-docker-go?q=Adrien
9 | * Shiny app written in Python https://huggingface.co/spaces/elonmuskceo/shiny-orbit-simulation
10 | * Genie.jl app in Julia https://huggingface.co/spaces/nooji/GenieOnHuggingFaceSpaces
11 | * Argilla app for data labelling and curation: https://huggingface.co/spaces/argilla/live-demo and [write-up about hosting Argilla on Spaces](./spaces-sdks-docker-argilla) by [@dvilasuero](https://huggingface.co/dvilasuero) 🎉
12 | * JupyterLab and VSCode: https://huggingface.co/spaces/DockerTemplates/docker-examples by [@camenduru](https://twitter.com/camenduru) and [@nateraw](https://hf.co/nateraw).
13 | * Zeno app for interactive model evaluation: https://huggingface.co/spaces/zeno-ml/diffusiondb and [instructions for setup](https://zenoml.com/docs/deployment#hugging-face-spaces)
14 | * Gradio App: https://huggingface.co/spaces/sayakpaul/demo-docker-gradio
15 |
--------------------------------------------------------------------------------
/docs/hub/spaces-sdks-docker-jupyter.md:
--------------------------------------------------------------------------------
1 | # JupyterLab on Spaces
2 |
3 | [JupyterLab](https://jupyter.org/) is a web-based interactive development environment for Jupyter notebooks, code, and data. It is a great tool for data science and machine learning, and it is widely used by the community. With Hugging Face Spaces, you can deploy your own JupyterLab instance and use it for development directly from the Hugging Face website.
4 |
5 | ## ⚡️ Deploy a JupyterLab instance on Spaces
6 |
7 | You can deploy JupyterLab on Spaces with just a few clicks. First, go to [this link](https://huggingface.co/new-space?template=SpacesExamples/jupyterlab) or click the button below:
8 |
9 |
10 |
11 |
12 |
13 | Spaces requires you to define:
14 |
15 | * An **Owner**: either your personal account or an organization you're a
16 | part of.
17 |
18 | * A **Space name**: the name of the Space within the account
19 | you're creating the Space.
20 |
21 | * The **Visibility**: _private_ if you want the
22 | Space to be visible only to you or your organization, or _public_ if you want
23 | it to be visible to other users.
24 |
25 | * The **Hardware**: the hardware you want to use for your JupyterLab instance. This goes from CPUs to H100s.
26 |
27 | * You can optionally configure a `JUPYTER_TOKEN` password to protect your JupyterLab workspace. When unspecified, defaults to `huggingface`. We strongly recommend setting this up if your Space is public or if the Space is in an organization.
28 |
29 |
30 |
31 | Storage in Hugging Face Spaces is ephemeral, and the data you store in the default configuration can be lost in a reboot or reset of the Space. We recommend to save your work to a remote location or to use persistent storage for your data.
32 |
33 |
34 |
35 | ### Setting up persistent storage
36 |
37 | To set up persistent storage on the Space, you go to the Settings page of your Space and choose one of the options: `small`, `medium` and `large`. Once persistent storage is set up, the JupyterLab image gets mounted in `/data`.
38 |
39 |
40 | ## Read more
41 |
42 | - [HF Docker Spaces](https://huggingface.co/docs/hub/spaces-sdks-docker)
43 |
44 | If you have any feedback or change requests, please don't hesitate to reach out to the owners on the [Feedback Discussion](https://huggingface.co/spaces/SpacesExamples/jupyterlab/discussions/3).
45 |
46 | ## Acknowledgments
47 |
48 | This template was created by [camenduru](https://twitter.com/camenduru) and [nateraw](https://huggingface.co/nateraw), with contributions from [osanseviero](https://huggingface.co/osanseviero) and [azzr](https://huggingface.co/azzr).
49 |
--------------------------------------------------------------------------------
/docs/hub/spaces-sdks-python.md:
--------------------------------------------------------------------------------
1 | # Custom Python Spaces
2 |
3 |
4 |
5 | Spaces now support arbitrary Dockerfiles so you can host any Python app directly using [Docker Spaces](./spaces-sdks-docker).
6 |
7 |
8 |
9 | While not an official workflow, you are able to run your own Python + interface stack in Spaces by selecting Gradio as your SDK and serving a frontend on port `7860`. See the [templates](https://huggingface.co/templates#spaces) for examples.
10 |
11 | Spaces are served in iframes, which by default restrict links from opening in the parent page. The simplest solution is to open them in a new window:
12 |
13 | ```HTML
14 | Spaces
15 | ```
16 |
17 | Usually, the height of Spaces is automatically adjusted when using the Gradio library interface. However, if you provide your own frontend in the Gradio SDK and the content height is larger than the viewport, you'll need to add an [iFrame Resizer script](https://cdnjs.com/libraries/iframe-resizer), so the content is scrollable in the iframe:
18 |
19 | ```HTML
20 |
21 | ```
22 | As an example, here is the same Space with and without the script:
23 | - https://huggingface.co/spaces/ronvolutional/http-server
24 | - https://huggingface.co/spaces/ronvolutional/iframe-test
25 |
--------------------------------------------------------------------------------
/docs/hub/spaces-sdks-static.md:
--------------------------------------------------------------------------------
1 | # Static HTML Spaces
2 |
3 | Spaces also accommodate custom HTML for your app instead of using Streamlit or Gradio. Set `sdk: static` inside the `YAML` block at the top of your Spaces **README.md** file. Then you can place your HTML code within an **index.html** file.
4 |
5 | Here are some examples of Spaces using custom HTML:
6 |
7 | * [Smarter NPC](https://huggingface.co/spaces/mishig/smarter_npc): Display a PlayCanvas project with an iframe in Spaces.
8 | * [Huggingfab](https://huggingface.co/spaces/pierreant-p/huggingfab): Display a Sketchfab model in Spaces.
9 | * [Diffuse the rest](https://huggingface.co/spaces/huggingface-projects/diffuse-the-rest): Draw and diffuse the rest
10 |
11 | ## Adding a build step before serving
12 |
13 | Static Spaces support adding a custom build step before serving your static assets. This is useful for frontend frameworks like React, Svelte and Vue that require a build process before serving the application. The build command runs automatically when your Space is updated.
14 |
15 | Add `app_build_command` inside the `YAML` block at the top of your Spaces **README.md** file, and `app_file`.
16 |
17 | For example:
18 | - `app_build_command: npm run build`
19 | - `app_file: dist/index.html`
20 |
21 | Example spaces:
22 |
23 | - [Svelte App](https://huggingface.co/spaces/julien-c/vite-svelte)
24 | - [React App](https://huggingface.co/spaces/coyotte508/static-vite)
25 |
26 |
27 | Under the hood, it will [launch a build](https://huggingface.co/spaces/huggingface/space-build), storing the generated files in a special `refs/convert/build` ref.
28 |
29 | ## Space variables
30 |
31 | Custom [environment variables](./spaces-overview#managing-secrets) can be passed to your Space. OAuth information such as the client ID and scope are also available as environment variables, if you have [enabled OAuth](./spaces-oauth) for your Space.
32 |
33 | To use these variables in JavaScript, you can use the `window.huggingface.variables` object. For example, to access the `OAUTH_CLIENT_ID` variable, you can use `window.huggingface.variables.OAUTH_CLIENT_ID`.
34 |
35 | Here is an example of a Space using custom environment variables and oauth enabled and displaying the variables in the HTML:
36 |
37 | * [Static Variables](https://huggingface.co/spaces/huggingfacejs/static-variables)
--------------------------------------------------------------------------------
/docs/hub/spaces-settings.md:
--------------------------------------------------------------------------------
1 | # Spaces Settings
2 |
3 | You can configure your Space's appearance and other settings inside the `YAML` block at the top of the **README.md** file at the root of the repository. For example, if you want to create a Space with Gradio named `Demo Space` with a yellow to orange gradient thumbnail:
4 |
5 | ```yaml
6 | ---
7 | title: Demo Space
8 | emoji: 🤗
9 | colorFrom: yellow
10 | colorTo: orange
11 | sdk: gradio
12 | app_file: app.py
13 | pinned: false
14 | ---
15 | ```
16 |
17 | For additional settings, refer to the [Reference](./spaces-config-reference) section.
18 |
--------------------------------------------------------------------------------
/docs/hub/spaces-using-opencv.md:
--------------------------------------------------------------------------------
1 | # Using OpenCV in Spaces
2 |
3 | In order to use OpenCV in your Gradio or Streamlit Spaces, you'll need to make the Space install both the Python and Debian dependencies
4 |
5 | This means adding `python3-opencv` to the `packages.txt` file, and adding `opencv-python` to the `requirements.txt` file. If those files don't exist, you'll need to create them.
6 |
7 | To see an example, [see this Gradio project](https://huggingface.co/spaces/templates/gradio_opencv/tree/main).
8 |
--------------------------------------------------------------------------------
/docs/hub/spaces.md:
--------------------------------------------------------------------------------
1 | # Spaces
2 |
3 | [Hugging Face Spaces](https://huggingface.co/spaces) offer a simple way to host ML demo apps directly on your profile or your organization's profile. This allows you to create your ML portfolio, showcase your projects at conferences or to stakeholders, and work collaboratively with other people in the ML ecosystem.
4 |
5 | We have built-in support for two awesome SDKs that let you build cool apps in Python in a matter of minutes: **[Streamlit](https://streamlit.io/)** and **[Gradio](https://gradio.app/)**, but you can also unlock the whole power of Docker and host an arbitrary Dockerfile. Finally, you can create static Spaces using JavaScript and HTML.
6 |
7 | You'll also be able to upgrade your Space to run [on a GPU or other accelerated hardware](./spaces-gpus). ⚡️
8 |
9 | ## Contents
10 |
11 | - [Spaces Overview](./spaces-overview)
12 | - [Handling Spaces Dependencies](./spaces-dependencies)
13 | - [Spaces Settings](./spaces-settings)
14 | - [Using OpenCV in Spaces](./spaces-using-opencv)
15 | - [Using Spaces for Organization Cards](./spaces-organization-cards)
16 | - [More ways to create Spaces](./spaces-more-ways-to-create)
17 | - [Managing Spaces with Github Actions](./spaces-github-actions)
18 | - [How to Add a Space to ArXiv](./spaces-add-to-arxiv)
19 | - [Spaces Dev Mode](./spaces-dev-mode)
20 | - [Spaces GPU Upgrades](./spaces-gpus)
21 | - [Spaces Persistent Storage](./spaces-storage)
22 | - [Gradio Spaces](./spaces-sdks-gradio)
23 | - [Streamlit Spaces](./spaces-sdks-streamlit)
24 | - [Docker Spaces](./spaces-sdks-docker)
25 | - [Static HTML Spaces](./spaces-sdks-static)
26 | - [Custom Python Spaces](./spaces-sdks-python)
27 | - [Embed your Space](./spaces-embed)
28 | - [Run your Space with Docker](./spaces-run-with-docker)
29 | - [Reference](./spaces-config-reference)
30 | - [Changelog](./spaces-changelog)
31 |
32 | ## Contact
33 |
34 | Feel free to ask questions on the [forum](https://discuss.huggingface.co/c/spaces/24) if you need help with making a Space, or if you run into any other issues on the Hub.
35 |
36 | If you're interested in infra challenges, custom demos, advanced GPUs, or something else, please reach out to us by sending an email to **website at huggingface.co**.
37 |
38 | You can also tag us [on Twitter](https://twitter.com/huggingface)! 🤗
39 |
--------------------------------------------------------------------------------
/docs/hub/speechbrain.md:
--------------------------------------------------------------------------------
1 | # Using SpeechBrain at Hugging Face
2 |
3 | `speechbrain` is an open-source and all-in-one conversational toolkit for audio/speech. The goal is to create a single, flexible, and user-friendly toolkit that can be used to easily develop state-of-the-art speech technologies, including systems for speech recognition, speaker recognition, speech enhancement, speech separation, language identification, multi-microphone signal processing, and many others.
4 |
5 | ## Exploring SpeechBrain in the Hub
6 |
7 | You can find `speechbrain` models by filtering at the left of the [models page](https://huggingface.co/models?library=speechbrain).
8 |
9 | All models on the Hub come up with the following features:
10 | 1. An automatically generated model card with a brief description.
11 | 2. Metadata tags that help for discoverability with information such as the language, license, paper, and more.
12 | 3. An interactive widget you can use to play out with the model directly in the browser.
13 | 4. An Inference API that allows to make inference requests.
14 |
15 | ## Using existing models
16 |
17 | `speechbrain` offers different interfaces to manage pretrained models for different tasks, such as `EncoderClassifier`, `EncoderClassifier`, `SepformerSeperation`, and `SpectralMaskEnhancement`. These classes have a `from_hparams` method you can use to load a model from the Hub
18 |
19 | Here is an example to run inference for sound recognition in urban sounds.
20 |
21 | ```py
22 | import torchaudio
23 | from speechbrain.pretrained import EncoderClassifier
24 |
25 | classifier = EncoderClassifier.from_hparams(
26 | source="speechbrain/urbansound8k_ecapa"
27 | )
28 | out_prob, score, index, text_lab = classifier.classify_file('speechbrain/urbansound8k_ecapa/dog_bark.wav')
29 | ```
30 |
31 | If you want to see how to load a specific model, you can click `Use in speechbrain` and you will be given a working snippet that you can load it!
32 |
33 |
34 |

35 |

36 |
37 |
38 |

39 |

40 |
41 |
42 | ## Additional resources
43 |
44 | * SpeechBrain [website](https://speechbrain.github.io/).
45 | * SpeechBrain [docs](https://speechbrain.readthedocs.io/en/latest/index.html).
46 |
--------------------------------------------------------------------------------
/docs/hub/stanza.md:
--------------------------------------------------------------------------------
1 | # Using Stanza at Hugging Face
2 |
3 | `stanza` is a collection of accurate and efficient tools for the linguistic analysis of many human languages. Starting from raw text to syntactic analysis and entity recognition, Stanza brings state-of-the-art NLP models to languages of your choosing.
4 |
5 | ## Exploring Stanza in the Hub
6 |
7 | You can find `stanza` models by filtering at the left of the [models page](https://huggingface.co/models?library=stanza&sort=downloads). You can find over 70 models for different languages!
8 |
9 | All models on the Hub come up with the following features:
10 | 1. An automatically generated model card with a brief description and metadata tags that help for discoverability.
11 | 2. An interactive widget you can use to play out with the model directly in the browser (for named entity recognition and part of speech).
12 | 3. An Inference API that allows to make inference requests (for named entity recognition and part of speech).
13 |
14 |
15 | ## Using existing models
16 |
17 | The `stanza` library automatically downloads models from the Hub. You can use `stanza.Pipeline` to download the model from the Hub and do inference.
18 |
19 | ```python
20 | import stanza
21 |
22 | nlp = stanza.Pipeline('en') # download th English model and initialize an English neural pipeline
23 | doc = nlp("Barack Obama was born in Hawaii.") # run annotation over a sentence
24 | ```
25 |
26 |
27 | ## Sharing your models
28 |
29 | To add new official Stanza models, you can follow the process to [add a new language](https://stanfordnlp.github.io/stanza/new_language.html) and then [share your models with the Stanza team](https://stanfordnlp.github.io/stanza/new_language.html#contributing-back-to-stanza). You can also find the official script to upload models to the Hub [here](https://github.com/stanfordnlp/huggingface-models/blob/main/hugging_stanza.py).
30 |
31 | ## Additional resources
32 |
33 | * `stanza` [docs](https://stanfordnlp.github.io/stanza/).
--------------------------------------------------------------------------------
/docs/hub/tensorboard.md:
--------------------------------------------------------------------------------
1 | # Using TensorBoard
2 |
3 | TensorBoard provides tooling for tracking and visualizing metrics as well as visualizing models. All repositories that contain TensorBoard traces have an automatic tab with a hosted TensorBoard instance for anyone to check it out without any additional effort!
4 |
5 | ## Exploring TensorBoard models on the Hub
6 |
7 | Over 52k repositories have TensorBoard traces on the Hub. You can find them by filtering at the left of the [models page](https://huggingface.co/models?filter=tensorboard). As an example, if you go to the [aubmindlab/bert-base-arabertv02](https://huggingface.co/aubmindlab/bert-base-arabertv02) repository, there is a **Metrics** tab. If you select it, you'll view a TensorBoard instance.
8 |
9 |
10 |

11 |

12 |
13 |
14 | ## Adding your TensorBoard traces
15 |
16 | The Hub automatically detects TensorBoard traces (such as `tfevents`). Once you push your TensorBoard files to the Hub, they will automatically start an instance.
17 |
18 |
19 | ## Additional resources
20 |
21 | * TensorBoard [documentation](https://www.tensorflow.org/tensorboard).
--------------------------------------------------------------------------------
/docs/hub/tf-keras.md:
--------------------------------------------------------------------------------
1 | ## TF-Keras (legacy)
2 |
3 | `tf-keras` is the name given to Keras 2.x version. It is now hosted as a separate GitHub repo [here](https://github.com/keras-team/tf-keras). Though it's a legacy framework, there are still [4.5k+ models](https://huggingface.co/models?library=tf-keras&sort=trending) hosted on the Hub. These models can be loaded using the `huggingface_hub` library. You **must** have either `tf-keras` or `keras<3.x` installed on your machine.
4 |
5 | If you are interested in Keras 3.x support, check out [this guide](./keras).
6 |
7 | Once installed, you just need to use the `from_pretrained_keras` method to load a model from the Hub. Read more about `from_pretrained_keras` [here](https://huggingface.co/docs/huggingface_hub/main/en/package_reference/mixins#huggingface_hub.from_pretrained_keras).
8 |
9 | ```py
10 | from huggingface_hub import from_pretrained_keras
11 |
12 | model = from_pretrained_keras("keras-io/mobile-vit-xxs")
13 | prediction = model.predict(image)
14 | prediction = tf.squeeze(tf.round(prediction))
15 | print(f'The image is a {classes[(np.argmax(prediction))]}!')
16 |
17 | # The image is a sunflower!
18 | ```
19 |
20 | You can also host your `tf-keras` model on the Hub. However, keep in mind that `tf-keras` is a legacy framework. To reach a maximum number of users, we recommend to create your model using Keras 3.x and share it natively as described above. For more details about uploading `tf-keras` models, check out [`push_to_hub_keras` documentation](https://huggingface.co/docs/huggingface_hub/main/en/package_reference/mixins#huggingface_hub.push_to_hub_keras).
21 |
22 | ```py
23 | from huggingface_hub import push_to_hub_keras
24 |
25 | push_to_hub_keras(model,
26 | "your-username/your-model-name",
27 | "your-tensorboard-log-directory",
28 | tags = ["object-detection", "some_other_tag"],
29 | **model_save_kwargs,
30 | )
31 | ```
32 |
33 | ## Additional resources
34 |
35 | - [GitHub repo](https://github.com/keras-team/tf-keras)
36 | * Blog post [Putting Keras on 🤗 Hub for Collaborative Training and Reproducibility](https://merveenoyan.medium.com/putting-keras-on-hub-for-collaborative-training-and-reproducibility-9018301de877) (April 2022)
37 |
--------------------------------------------------------------------------------
/docs/hub/transformers-js.md:
--------------------------------------------------------------------------------
1 | # Using `Transformers.js` at Hugging Face
2 |
3 | Transformers.js is a JavaScript library for running 🤗 Transformers directly in your browser, with no need for a server! It is designed to be functionally equivalent to the original [Python library](https://github.com/huggingface/transformers), meaning you can run the same pretrained models using a very similar API.
4 |
5 | ## Exploring `transformers.js` in the Hub
6 |
7 | You can find `transformers.js` models by filtering by library in the [models page](https://huggingface.co/models?library=transformers.js).
8 |
9 |
10 |
11 | ## Quick tour
12 |
13 |
14 | It's super simple to translate from existing code! Just like the Python library, we support the `pipeline` API. Pipelines group together a pretrained model with preprocessing of inputs and postprocessing of outputs, making it the easiest way to run models with the library.
15 |
16 |
17 |
18 | Python (original) |
19 | Javascript (ours) |
20 |
21 |
22 |
23 |
24 | ```python
25 | from transformers import pipeline
26 |
27 | # Allocate a pipeline for sentiment-analysis
28 | pipe = pipeline('sentiment-analysis')
29 |
30 | out = pipe('I love transformers!')
31 | # [{'label': 'POSITIVE', 'score': 0.999806941}]
32 | ```
33 |
34 | |
35 |
36 |
37 | ```javascript
38 | import { pipeline } from '@huggingface/transformers';
39 |
40 | // Allocate a pipeline for sentiment-analysis
41 | let pipe = await pipeline('sentiment-analysis');
42 |
43 | let out = await pipe('I love transformers!');
44 | // [{'label': 'POSITIVE', 'score': 0.999817686}]
45 | ```
46 |
47 | |
48 |
49 |
50 |
51 |
52 | You can also use a different model by specifying the model id or path as the second argument to the `pipeline` function. For example:
53 | ```javascript
54 | // Use a different model for sentiment-analysis
55 | let pipe = await pipeline('sentiment-analysis', 'nlptown/bert-base-multilingual-uncased-sentiment');
56 | ```
57 |
58 | Refer to the [documentation](https://huggingface.co/docs/transformers.js) for the full list of supported tasks and models.
59 |
60 | ## Installation
61 |
62 | To install via [NPM](https://www.npmjs.com/package/@huggingface/transformers), run:
63 | ```bash
64 | npm i @huggingface/transformers
65 | ```
66 |
67 | For more information, including how to use it in vanilla JS (without any bundler) via a CDN or static hosting, refer to the [README](https://github.com/huggingface/transformers.js/blob/main/README.md#installation).
68 |
69 |
70 | ## Additional resources
71 |
72 | * Transformers.js [repository](https://github.com/huggingface/transformers.js)
73 | * Transformers.js [docs](https://huggingface.co/docs/transformers.js)
74 | * Transformers.js [demo](https://huggingface.github.io/transformers.js/)
75 |
--------------------------------------------------------------------------------
/docs/inference-providers/_redirects.yml:
--------------------------------------------------------------------------------
1 | quicktour: index
2 | detailed_parameters: tasks/index
3 | parameters: tasks/index
4 | parallelism: index
5 | usage: index
6 | faq: index
7 | rate-limits: pricing
8 |
--------------------------------------------------------------------------------
/docs/inference-providers/_toctree.yml:
--------------------------------------------------------------------------------
1 | - title: Get Started
2 | sections:
3 | - local: index
4 | title: Inference Providers
5 | - local: pricing
6 | title: Pricing and Billing
7 | - local: hub-integration
8 | title: Hub integration
9 | - local: register-as-a-provider
10 | title: Register as an Inference Provider
11 | - local: security
12 | title: Security
13 |
14 | - title: Providers
15 | sections:
16 | - local: providers/cerebras
17 | title: Cerebras
18 | - local: providers/cohere
19 | title: Cohere
20 | - local: providers/fal-ai
21 | title: Fal AI
22 | - local: providers/fireworks-ai
23 | title: Fireworks
24 | - local: providers/hyperbolic
25 | title: Hyperbolic
26 | - local: providers/hf-inference
27 | title: HF Inference
28 | - local: providers/nebius
29 | title: Nebius
30 | - local: providers/novita
31 | title: Novita
32 | - local: providers/nscale
33 | title: Nscale
34 | - local: providers/replicate
35 | title: Replicate
36 | - local: providers/sambanova
37 | title: SambaNova
38 | - local: providers/together
39 | title: Together
40 | - title: API Reference
41 | sections:
42 | - local: tasks/index
43 | title: Index
44 | - local: hub-api
45 | title: Hub API
46 | - title: Popular Tasks
47 | sections:
48 | - local: tasks/chat-completion
49 | title: Chat Completion
50 | - local: tasks/feature-extraction
51 | title: Feature Extraction
52 | - local: tasks/text-to-image
53 | title: Text to Image
54 | - local: tasks/text-to-video
55 | title: Text to Video
56 | - title: Other Tasks
57 | isExpanded: false
58 | sections:
59 | - local: tasks/audio-classification
60 | title: Audio Classification
61 | - local: tasks/automatic-speech-recognition
62 | title: Automatic Speech Recognition
63 | - local: tasks/fill-mask
64 | title: Fill Mask
65 | - local: tasks/image-classification
66 | title: Image Classification
67 | - local: tasks/image-segmentation
68 | title: Image Segmentation
69 | - local: tasks/image-to-image
70 | title: Image to Image
71 | - local: tasks/object-detection
72 | title: Object Detection
73 | - local: tasks/question-answering
74 | title: Question Answering
75 | - local: tasks/summarization
76 | title: Summarization
77 | - local: tasks/table-question-answering
78 | title: Table Question Answering
79 | - local: tasks/text-classification
80 | title: Text Classification
81 | - local: tasks/text-generation
82 | title: Text Generation
83 | - local: tasks/token-classification
84 | title: Token Classification
85 | - local: tasks/translation
86 | title: Translation
87 | - local: tasks/zero-shot-classification
88 | title: Zero Shot Classification
--------------------------------------------------------------------------------
/docs/inference-providers/providers/cerebras.md:
--------------------------------------------------------------------------------
1 |
19 |
20 | # Cerebras
21 |
22 |
28 |
29 |
35 |
36 | Cerebras stands alone as the world’s fastest AI inference and training platform. Organizations across fields like medical research, cryptography, energy, and agentic AI use our CS-2 and CS-3 systems to build on-premise supercomputers, while developers and enterprises everywhere can access the power of Cerebras through our pay-as-you-go cloud offerings.
37 |
38 | ## Supported tasks
39 |
40 |
41 | ### Chat Completion (LLM)
42 |
43 | Find out more about Chat Completion (LLM) [here](../tasks/chat-completion).
44 |
45 |
49 |
50 |
51 | ### Chat Completion (VLM)
52 |
53 | Find out more about Chat Completion (VLM) [here](../tasks/chat-completion).
54 |
55 |
59 |
60 |
--------------------------------------------------------------------------------
/docs/inference-providers/providers/cohere.md:
--------------------------------------------------------------------------------
1 |
19 |
20 | # Cohere
21 |
22 |
28 |
29 |
35 |
36 | Cohere brings you cutting-edge multilingual models, advanced retrieval, and an AI workspace tailored for the modern enterprise — all within a single, secure platform.
37 |
38 | Cohere is the first model creator to share and serve their models directly on the Hub as an Inference Provider.
39 |
40 | ## Supported tasks
41 |
42 |
43 | ### Chat Completion (LLM)
44 |
45 | Find out more about Chat Completion (LLM) [here](../tasks/chat-completion).
46 |
47 |
51 |
52 |
53 | ### Chat Completion (VLM)
54 |
55 | Find out more about Chat Completion (VLM) [here](../tasks/chat-completion).
56 |
57 |
61 |
62 |
--------------------------------------------------------------------------------
/docs/inference-providers/providers/fal-ai.md:
--------------------------------------------------------------------------------
1 |
19 |
20 | # Fal
21 |
22 |
28 |
29 |
35 |
36 | Founded in 2021 by [Burkay Gur](https://huggingface.co/burkaygur) and [Gorkem Yurtseven](https://huggingface.co/gorkemyurt), fal.ai was born out of a shared passion for AI and a desire to address the challenges in AI infrastructure observed during their tenures at Coinbase and Amazon.
37 |
38 | ## Supported tasks
39 |
40 |
41 | ### Automatic Speech Recognition
42 |
43 | Find out more about Automatic Speech Recognition [here](../tasks/automatic_speech_recognition).
44 |
45 |
49 |
50 |
51 | ### Text To Image
52 |
53 | Find out more about Text To Image [here](../tasks/text_to_image).
54 |
55 |
59 |
60 |
61 | ### Text To Video
62 |
63 | Find out more about Text To Video [here](../tasks/text_to_video).
64 |
65 |
69 |
70 |
--------------------------------------------------------------------------------
/docs/inference-providers/providers/fireworks-ai.md:
--------------------------------------------------------------------------------
1 |
19 |
20 | # Fireworks AI
21 |
22 |
28 |
29 |
35 |
36 | Fireworks AI is a developer-centric platform that delivers high-performance generative AI solutions, enabling efficient deployment and fine-tuning of large language models (LLMs) and image models.
37 | ## Supported tasks
38 |
39 |
40 | ### Chat Completion (LLM)
41 |
42 | Find out more about Chat Completion (LLM) [here](../tasks/chat-completion).
43 |
44 |
48 |
49 |
50 | ### Chat Completion (VLM)
51 |
52 | Find out more about Chat Completion (VLM) [here](../tasks/chat-completion).
53 |
54 |
58 |
59 |
--------------------------------------------------------------------------------
/docs/inference-providers/providers/replicate.md:
--------------------------------------------------------------------------------
1 |
19 |
20 | # Replicate
21 |
22 |
28 |
29 |
35 |
36 | Replicate is building tools so all software engineers can use AI as if it were normal software. You should be able to import an image generator the same way you import an npm package. You should be able to customize a model as easily as you can fork something on GitHub.
37 |
38 | ## Supported tasks
39 |
40 |
41 | ### Text To Image
42 |
43 | Find out more about Text To Image [here](../tasks/text_to_image).
44 |
45 |
49 |
50 |
51 | ### Text To Video
52 |
53 | Find out more about Text To Video [here](../tasks/text_to_video).
54 |
55 |
59 |
60 |
--------------------------------------------------------------------------------
/docs/inference-providers/security.md:
--------------------------------------------------------------------------------
1 | # Security & Compliance
2 |
3 | ## Data Security/Privacy
4 |
5 | Hugging Face does not store any user data for training purposes. We do not store the request body or response when routing requests through Hugging Face. Logs are kept for debugging purposes for up to 30 days, but no user data or tokens are stored.
6 |
7 | For more information on how your data is handled, please refer to the Data Security Policies of each provider.
8 |
9 | Inference Provider routing uses TLS/SSL to encrypt data in transit.
10 |
11 | ## Hub Security
12 |
13 | The Hugging Face Hub, which Inference Providers is a feature of, is SOC2 Type 2 certified. For more on Hub security: https://huggingface.co/docs/hub/security. External providers are responsible for their own security measures, so please refer to their respective security policies for more details.
14 |
15 |
16 |
--------------------------------------------------------------------------------
/docs/sagemaker/Makefile:
--------------------------------------------------------------------------------
1 | .PHONY: docs clean help
2 |
3 | docs: clean
4 | @echo "Processing README.md files from examples/gke, examples/cloud-run, and examples/vertex-ai..."
5 | @mkdir -p source/examples
6 | @echo "Converting Jupyter Notebooks to MDX..."
7 | @doc-builder notebook-to-mdx notebooks/sagemaker-sdk/
8 | @echo "Auto-generating example files for documentation..."
9 | @python scripts/auto-generate-examples.py
10 | @echo "Cleaning up generated Markdown Notebook files..."
11 | @find notebooks/sagemaker-sdk -name "sagemaker-notebook.md" -type f -delete
12 | @echo "Generating YAML tree structure and appending to _toctree.yml..."
13 | @python scripts/auto-update-toctree.py
14 | @echo "YAML tree structure appended to docs/source/_toctree.yml"
15 | @echo "Documentation setup complete."
16 |
17 | clean:
18 | @echo "Cleaning up generated documentation..."
19 | @rm -rf source/examples
20 | @awk '/^# GENERATED CONTENT DO NOT EDIT!/,/^# END GENERATED CONTENT/{next} {print}' source/_toctree.yml > source/_toctree.yml.tmp && mv source/_toctree.yml.tmp source/_toctree.yml
21 | @echo "Cleaning up generated Markdown Notebook files (if any)..."
22 | @find notebooks/sagemaker-sdk -name "sagemaker-notebook.md" -type f -delete
23 | @echo "Cleanup complete."
24 |
25 | serve:
26 | @echo "Serving documentation via doc-builder"
27 | doc-builder preview sagemaker source/ --not_python_module
28 |
29 | help:
30 | @echo "Usage:"
31 | @echo " make docs - Auto-generate the examples for the docs"
32 | @echo " make clean - Remove the auto-generated docs"
33 | @echo " make help - Display this help message"
34 |
35 |
--------------------------------------------------------------------------------
/docs/sagemaker/notebooks/sagemaker-sdk/deploy-embedding-models/assets/cw.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huggingface/hub-docs/1204a9db04239eb0b9a8264bdd07294d639331e0/docs/sagemaker/notebooks/sagemaker-sdk/deploy-embedding-models/assets/cw.png
--------------------------------------------------------------------------------
/docs/sagemaker/notebooks/sagemaker-sdk/fine-tune-embedding-models/assets/requirements.txt:
--------------------------------------------------------------------------------
1 | transformers==4.41.2
2 | accelerate==0.31.0
3 | sentence-transformers==3.0.0
4 | datasets==2.18.0
5 | torch==2.1.2
6 |
--------------------------------------------------------------------------------
/docs/sagemaker/scripts/auto-update-toctree.py:
--------------------------------------------------------------------------------
1 | import glob
2 | import os
3 | import re
4 | from pathlib import Path
5 |
6 |
7 | def update_toctree_yaml():
8 | input_file = "source/_toctree.yml"
9 | output_file = "source/_toctree.yml"
10 | dirnames = ["sagemaker-sdk"]
11 |
12 | # Read the existing content
13 | with open(input_file, "r") as f:
14 | content = f.read()
15 |
16 | # Find the position between tutorials and reference sections
17 | tutorials_end = content.find("- sections:\n - local: reference/inference-toolkit")
18 | if tutorials_end == -1:
19 | print("Error: Could not find the reference section in the file")
20 | return
21 |
22 | # Generate the new content
23 | new_content = []
24 | new_content.append("# GENERATED CONTENT DO NOT EDIT!")
25 | new_content.append("- title: Examples")
26 | new_content.append(" sections:")
27 |
28 | for dirname in dirnames:
29 | # Get sorted files excluding index
30 | files = sorted(glob.glob(f"source/examples/{dirname}-*.mdx"))
31 | files = [f for f in files if not f.endswith(f"{dirname}-index.mdx")]
32 |
33 | file_entries = []
34 | for file_path in files:
35 | with open(file_path, "r") as mdx_file:
36 | first_line = mdx_file.readline().strip()
37 | if first_line.startswith("# "):
38 | title = first_line[2:].strip()
39 | base_name = Path(file_path).stem
40 | file_entries.append((base_name, title))
41 | else:
42 | print(f"⚠️ Skipping {Path(file_path).name} - missing H1 title")
43 | continue
44 |
45 | # Write directory section
46 | new_content.append(" - title: SageMaker SDK")
47 | new_content.append(" isExpanded: false")
48 |
49 | for idx, (base, title) in enumerate(file_entries):
50 | if idx == 0:
51 | new_content.append(" sections:")
52 | new_content.append(f" - local: examples/{base}")
53 | new_content.append(f' title: "{title}"')
54 |
55 | new_content.append("# END GENERATED CONTENT")
56 |
57 | # Insert the new content
58 | updated_content = content[:tutorials_end] + "\n" + "\n".join(new_content) + "\n" + content[tutorials_end:]
59 |
60 | # Write the updated content back to the file
61 | with open(output_file, "w") as f:
62 | f.write(updated_content)
63 |
64 |
65 | if __name__ == "__main__":
66 | update_toctree_yaml()
67 |
--------------------------------------------------------------------------------
/docs/sagemaker/source/.gitignore:
--------------------------------------------------------------------------------
1 | examples/
2 |
--------------------------------------------------------------------------------
/docs/sagemaker/source/_toctree.yml:
--------------------------------------------------------------------------------
1 | - sections:
2 | - local: index
3 | title: Hugging Face on AWS
4 | title: Get Started
5 | isExpanded: true
6 | - sections:
7 | - local: dlcs/introduction
8 | title: Introduction
9 | - local: dlcs/available
10 | title: Available DLCs on AWS
11 | title: Deep Learning Containers (DLCs)
12 | isExpanded: true
13 | - sections:
14 | - local: tutorials/index
15 | title: Introduction
16 | - sections:
17 | - local: tutorials/sagemaker-sdk/sagemaker-sdk-quickstart
18 | title: SageMaker SDK Quickstart
19 | - local: tutorials/sagemaker-sdk/training-sagemaker-sdk
20 | title: Train models with SageMaker SDK
21 | - local: tutorials/sagemaker-sdk/deploy-sagemaker-sdk
22 | title: Deploy models with SageMaker SDK
23 | title: SageMaker SDK
24 | isExpanded: false
25 | - sections:
26 | - local: tutorials/jumpstart/jumpstart-quickstart
27 | title: Jumpstart Quickstart
28 | title: Jumpstart
29 | isExpanded: false
30 | - sections:
31 | - local: tutorials/bedrock/bedrock-quickstart
32 | title: Bedrock Quickstart
33 | title: Bedrock
34 | isExpanded: false
35 | - sections:
36 | - local: tutorials/compute-services/compute-services-quickstart
37 | title: EC2, ECS and EKS Quickstart
38 | title: EC2, ECS and EKS
39 | isExpanded: false
40 | title: Tutorials
41 | isExpanded: false
42 |
43 | # GENERATED CONTENT DO NOT EDIT!
44 | - title: Examples
45 | sections:
46 | - title: SageMaker SDK
47 | isExpanded: false
48 | sections:
49 | - local: examples/sagemaker-sdk-deploy-embedding-models
50 | title: "How to deploy Embedding Models to Amazon SageMaker using new Hugging Face Embedding DLC"
51 | - local: examples/sagemaker-sdk-deploy-llama-3-3-70b-inferentia2
52 | title: "Deploy Llama 3.3 70B on AWS Inferentia2"
53 | - local: examples/sagemaker-sdk-evaluate-llm-lighteval
54 | title: "Evaluate LLMs with Hugging Face Lighteval on Amazon SageMaker"
55 | - local: examples/sagemaker-sdk-fine-tune-embedding-models
56 | title: "Fine-tune and deploy embedding models with Amazon SageMaker"
57 | # END GENERATED CONTENT
58 | - sections:
59 | - local: reference/inference-toolkit
60 | title: Inference Toolkit API
61 | - local: reference/resources
62 | title: Other Resources
63 | title: Reference
64 | isExpanded: false
65 |
--------------------------------------------------------------------------------
/docs/sagemaker/source/tutorials/compute-services/compute-services-quickstart.md:
--------------------------------------------------------------------------------
1 | # EC2, ECS and EKS Quickstart
2 |
3 | This page is under construction, bear with us!
--------------------------------------------------------------------------------
/docs/sagemaker/source/tutorials/index.md:
--------------------------------------------------------------------------------
1 | # How to
2 |
3 | Take a look at our tutorials about using Hugging Face models on AWS.
4 |
5 | ## Sagemaker SDK
6 |
7 | - [Sagemaker SDK Quickstart](https://huggingface.co/docs/sagemaker/main/en/tutorials/sagemaker-sdk/sagemaker-sdk-quickstart)
8 | - [Train models with Sagemaker SDK](https://huggingface.co/docs/sagemaker/main/en/tutorials/sagemaker-sdk/training-sagemaker-sdk)
9 | - [Deploy models with Sagemaker SDK](https://huggingface.co/docs/sagemaker/main/en/tutorials/sagemaker-sdk/deploy-sagemaker-sdk)
10 |
11 | ## Jumpstart
12 |
13 | - [Sagemaker Jumpstart Quickstart](https://huggingface.co/docs/sagemaker/main/en/tutorials/jumpstart/jumpstart-quickstart)
14 |
15 | ## Bedrock
16 |
17 | - [AWS Bedrock Quickstart](https://huggingface.co/docs/sagemaker/main/en/tutorials/bedrock/bedrock-quickstart)
18 |
19 | ## EC2, ECS and EKS
20 |
21 | - [EC2, ECS and EKS Quickstart](https://huggingface.co/docs/sagemaker/main/en/tutorials/compute-services/compute-services-quickstart)
22 |
--------------------------------------------------------------------------------
/scripts/inference-providers/.gitignore:
--------------------------------------------------------------------------------
1 | dist
--------------------------------------------------------------------------------
/scripts/inference-providers/.prettierignore:
--------------------------------------------------------------------------------
1 | pnpm-lock.yaml
2 | # In order to avoid code samples to have tabs, they don't display well on npm
3 | README.md
4 | dist
5 | *.handlebars
--------------------------------------------------------------------------------
/scripts/inference-providers/README.md:
--------------------------------------------------------------------------------
1 | Install dependencies.
2 |
3 | ```sh
4 | pnpm install
5 | ```
6 |
7 | Generate documentation.
8 |
9 | ```sh
10 | pnpm run generate
11 | ```
--------------------------------------------------------------------------------
/scripts/inference-providers/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "inference-providers-generator",
3 | "packageManager": "pnpm@9.7.1",
4 | "version": "1.0.0",
5 | "description": "",
6 | "main": "index.js",
7 | "type": "module",
8 | "scripts": {
9 | "format": "prettier --write .",
10 | "format:check": "prettier --check .",
11 | "generate": "tsx scripts/generate.ts"
12 | },
13 | "keywords": [],
14 | "author": "",
15 | "license": "ISC",
16 | "dependencies": {
17 | "@huggingface/inference": "^4.0.2",
18 | "@huggingface/tasks": "^0.19.11",
19 | "@types/node": "^22.5.0",
20 | "handlebars": "^4.7.8",
21 | "node": "^20.17.0",
22 | "prettier": "^3.3.3",
23 | "ts-node": "^10.9.2",
24 | "tsx": "^4.17.0",
25 | "type-fest": "^4.25.0",
26 | "typescript": "^5.5.4"
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/scripts/inference-providers/scripts/.gitignore:
--------------------------------------------------------------------------------
1 | *.js
--------------------------------------------------------------------------------
/scripts/inference-providers/templates/common/follow-us-button.handlebars:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/scripts/inference-providers/templates/common/page-header.handlebars:
--------------------------------------------------------------------------------
1 | This markdown file has been generated from a script. Please do not edit it directly.
2 | For more details, check out:
3 | - the `generate.ts` script: https://github.com/huggingface/hub-docs/blob/main/scripts/inference-providers/scripts/generate.ts
4 | - the task template defining the sections in the page: https://github.com/huggingface/hub-docs/tree/main/scripts/inference-providers/templates/task/{{task}}.handlebars
5 | - the input jsonschema specifications used to generate the input markdown table: https://github.com/huggingface/huggingface.js/blob/main/packages/tasks/src/tasks/{{task}}/spec/input.json
6 | - the output jsonschema specifications used to generate the output markdown table: https://github.com/huggingface/huggingface.js/blob/main/packages/tasks/src/tasks/{{task}}/spec/output.json
7 | - the snippets used to generate the example:
8 | - curl: https://github.com/huggingface/huggingface.js/blob/main/packages/tasks/src/snippets/curl.ts
9 | - python: https://github.com/huggingface/huggingface.js/blob/main/packages/tasks/src/snippets/python.ts
10 | - javascript: https://github.com/huggingface/huggingface.js/blob/main/packages/tasks/src/snippets/js.ts
11 | - the "tasks" content for recommended models: https://huggingface.co/api/tasks
--------------------------------------------------------------------------------
/scripts/inference-providers/templates/common/provider-header.handlebars:
--------------------------------------------------------------------------------
1 | WARNING
2 |
3 | This markdown file has been generated from a script. Please do not edit it directly.
4 |
5 | ### Template
6 |
7 | If you want to update the content related to {{provider}}'s description, please edit the template file under `https://github.com/huggingface/hub-docs/tree/main/scripts/inference-providers/templates/providers/{{provider}}.handlebars`.
8 |
9 | ### Logos
10 |
11 | If you want to update {{provider}}'s logo, upload a file by opening a PR on https://huggingface.co/datasets/huggingface/documentation-images/tree/main/inference-providers/logos. Ping @wauplin and @celinah on the PR to let them know you uploaded a new logo.
12 | Logos must be in .png format and be named `{{provider}}-light.png` and `{{provider}}-dark.png`. Visit https://huggingface.co/settings/theme to switch between light and dark mode and check that the logos are displayed correctly.
13 |
14 | ### Generation script
15 |
16 | For more details, check out the `generate.ts` script: https://github.com/huggingface/hub-docs/blob/main/scripts/inference-providers/scripts/generate.ts.
--------------------------------------------------------------------------------
/scripts/inference-providers/templates/common/provider-logo.handlebars:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/scripts/inference-providers/templates/common/provider-tasks.handlebars:
--------------------------------------------------------------------------------
1 | ## Supported tasks
2 |
3 | {{#each tasks}}
4 |
5 | ### {{title}}
6 |
7 | Find out more about {{title}} [here](../tasks/{{linkAnchor}}).
8 |
9 |
13 |
14 | {{/each}}
15 |
--------------------------------------------------------------------------------
/scripts/inference-providers/templates/common/snippets-template.handlebars:
--------------------------------------------------------------------------------
1 | {{#if hasSnippets }}
2 |
3 |
7 |
8 | {{else}}
9 |
10 | There are currently no snippet examples for the **{{ task }}** task, as no providers support it yet.
11 |
12 | {{/if}}
--------------------------------------------------------------------------------
/scripts/inference-providers/templates/common/specs-headers.handlebars:
--------------------------------------------------------------------------------
1 | | Headers | | |
2 | | :--- | :--- | :--- |
3 | | **authorization** | _string_ | Authentication header in the form `'Bearer: hf_****'` when `hf_****` is a personal user access token with "Inference Providers" permission. You can generate one from [your settings page](https://huggingface.co/settings/tokens/new?ownUserPermissions=inference.serverless.write&tokenType=fineGrained). |
4 |
--------------------------------------------------------------------------------
/scripts/inference-providers/templates/common/specs-output.handlebars:
--------------------------------------------------------------------------------
1 | | Body | |
2 | | :--- | :--- | :--- |
3 | {{#each schema}}
4 | {{#if type}}
5 | | **{{{name}}}** | _{{type}}_ | {{{description}}} |
6 | {{else}}
7 | | **{{{name}}}** | | {{{description}}} |
8 | {{/if}}
9 | {{/each}}
--------------------------------------------------------------------------------
/scripts/inference-providers/templates/common/specs-payload.handlebars:
--------------------------------------------------------------------------------
1 | | Payload | | |
2 | | :--- | :--- | :--- |
3 | {{#each schema}}
4 | {{#if type}}
5 | | **{{{name}}}{{#if required}}*{{/if}}** | _{{type}}_ | {{{description}}} |
6 | {{else}}
7 | | **{{{name}}}** | | {{{description}}} |
8 | {{/if}}
9 | {{/each}}
--------------------------------------------------------------------------------
/scripts/inference-providers/templates/providers/cerebras.handlebars:
--------------------------------------------------------------------------------
1 | # Cerebras
2 |
3 | {{{logoSection}}}
4 |
5 | {{{followUsSection}}}
6 |
7 | Cerebras stands alone as the world’s fastest AI inference and training platform. Organizations across fields like medical research, cryptography, energy, and agentic AI use our CS-2 and CS-3 systems to build on-premise supercomputers, while developers and enterprises everywhere can access the power of Cerebras through our pay-as-you-go cloud offerings.
8 |
9 | {{{tasksSection}}}
--------------------------------------------------------------------------------
/scripts/inference-providers/templates/providers/cohere.handlebars:
--------------------------------------------------------------------------------
1 | # Cohere
2 |
3 | {{{logoSection}}}
4 |
5 | {{{followUsSection}}}
6 |
7 | Cohere brings you cutting-edge multilingual models, advanced retrieval, and an AI workspace tailored for the modern enterprise — all within a single, secure platform.
8 |
9 | Cohere is the first model creator to share and serve their models directly on the Hub as an Inference Provider.
10 |
11 | {{{tasksSection}}}
--------------------------------------------------------------------------------
/scripts/inference-providers/templates/providers/fal-ai.handlebars:
--------------------------------------------------------------------------------
1 | # Fal
2 |
3 | {{{logoSection}}}
4 |
5 | {{{followUsSection}}}
6 |
7 | Founded in 2021 by [Burkay Gur](https://huggingface.co/burkaygur) and [Gorkem Yurtseven](https://huggingface.co/gorkemyurt), fal.ai was born out of a shared passion for AI and a desire to address the challenges in AI infrastructure observed during their tenures at Coinbase and Amazon.
8 |
9 | {{{tasksSection}}}
--------------------------------------------------------------------------------
/scripts/inference-providers/templates/providers/fireworks-ai.handlebars:
--------------------------------------------------------------------------------
1 | # Fireworks AI
2 |
3 | {{{logoSection}}}
4 |
5 | {{{followUsSection}}}
6 |
7 | Fireworks AI is a developer-centric platform that delivers high-performance generative AI solutions, enabling efficient deployment and fine-tuning of large language models (LLMs) and image models.
8 | {{{tasksSection}}}
--------------------------------------------------------------------------------
/scripts/inference-providers/templates/providers/hf-inference.handlebars:
--------------------------------------------------------------------------------
1 | # HF Inference
2 |
3 | {{{logoSection}}}
4 |
5 | {{{followUsSection}}}
6 |
7 | HF Inference is the serverless Inference API powered by Hugging Face. This service used to be called "Inference API (serverless)" prior to Inference Providers.
8 | If you are interested in deploying models to a dedicated and autoscaling infrastructure managed by Hugging Face, check out [Inference Endpoints](https://huggingface.co/docs/inference-endpoints/index) instead.
9 |
10 | {{{tasksSection}}}
--------------------------------------------------------------------------------
/scripts/inference-providers/templates/providers/hyperbolic.handlebars:
--------------------------------------------------------------------------------
1 | # Hyperbolic: The On-Demand AI Cloud
2 |
3 | {{{logoSection}}}
4 |
5 | {{{followUsSection}}}
6 |
7 | ## Join 165,000+ developers building with on-demand GPUs and running inference on the latest models — at 75% less than legacy clouds.
8 |
9 | Hyperbolic is the infrastructure powering the world’s leading AI projects. Trusted by Hugging Face, Vercel, Google, Quora, Chatbot Arena, Open Router, Black Forest Labs, Reve.art, Stanford, UC Berkeley and more.
10 |
11 | ---
12 |
13 | ## Products and Services
14 |
15 | ### **GPU Marketplace**
16 | Hyperbolic provides a global network of compute to unlock on-demand GPU rentals at the lowest prices. Start in seconds, and keep running.
17 |
18 | ### **Bulk Rentals**
19 | Reserve dedicated GPUs with guaranteed uptime and discounted prepaid pricing — perfect for 24/7 inference, LLM tooling, training, and scaling production workloads without peak-time shortages.
20 |
21 | ### **Serverless Inference**
22 | Run the latest models while staying fully API-compatible with OpenAI and many other ecosystems.
23 |
24 | ### **Dedicated Hosting**
25 | Run LLMs, VLMs, or diffusion models on single-tenant GPUs with private endpoints. Bring your own weights or use open models. Full control, hourly pricing. Ideal for 24/7 inference or 100K+ tokens/min workloads.
26 |
27 | ---
28 |
29 | ## Pricing
30 |
31 | - Rent GPUs starting at **$0.16/gpu/hr**
32 | - Access inference at **3–10x cheaper** than competitors
33 |
34 | For the latest pricing, visit our [pricing page](https://hyperbolic.xyz/pricing?utm_source=hf_docs).
35 |
36 | ---
37 |
38 | ## Resources
39 |
40 | - **Launch App**: [app.hyperbolic.xyz](https://hyperbolic.xyz/?utm_source=hf_docs)
41 | - **Website**: [hyperbolic.xyz](https://hyperbolic.xyz/?utm_source=hf_doc)
42 | - **X (Twitter)**: [@hyperbolic_labs](https://x.com/hyperbolic_labs)
43 | - **LinkedIn**: [Hyperbolic Labs](https://www.linkedin.com/company/hyperbolic-labs/)
44 | - **Discord**: [Join our community](https://discord.com/invite/hyperbolic)
45 | - **YouTube**: [@hyperbolic-labs](https://www.youtube.com/@hyperbolic-labs)
46 |
47 | {{{tasksSection}}}
48 |
--------------------------------------------------------------------------------
/scripts/inference-providers/templates/providers/nebius.handlebars:
--------------------------------------------------------------------------------
1 | # Nebius
2 |
3 | {{{logoSection}}}
4 |
5 | {{{followUsSection}}}
6 |
7 | Nebius AI is a technology company specializing in AI-centric cloud platforms, offering scalable GPU clusters, managed services, and developer tools designed for intensive AI workloads. Headquartered in Amsterdam, Nebius provides flexible architecture and high-performance infrastructure to support AI model training and inference at any scale.
8 |
9 | {{{tasksSection}}}
--------------------------------------------------------------------------------
/scripts/inference-providers/templates/providers/novita.handlebars:
--------------------------------------------------------------------------------
1 | # Novita
2 |
3 | {{{logoSection}}}
4 |
5 | {{{followUsSection}}}
6 |
7 | [Novita](https://novita.ai) is the go-to inference platform for AI developers seeking a low-cost, reliable, and simple solution for shipping AI models.
8 |
9 | Offering 200+ APIs (LLMs, image, video, audio) with fully managed deployment — enterprise-grade, scalable, and maintenance-free.
10 |
11 | {{{tasksSection}}}
--------------------------------------------------------------------------------
/scripts/inference-providers/templates/providers/nscale.handlebars:
--------------------------------------------------------------------------------
1 | # Nscale
2 |
3 | {{{logoSection}}}
4 |
5 | {{{followUsSection}}}
6 |
7 | Nscale is a vertically integrated AI cloud that delivers bespoke, sovereign AI infrastructure at scale.
8 |
9 | Built on this foundation, Nscale's inference service empowers developers with a wide range of models and ready-to-use inference services that integrate into workflows without the need to manage the underlying infrastructure.
10 |
11 | {{{tasksSection}}}
--------------------------------------------------------------------------------
/scripts/inference-providers/templates/providers/replicate.handlebars:
--------------------------------------------------------------------------------
1 | # Replicate
2 |
3 | {{{logoSection}}}
4 |
5 | {{{followUsSection}}}
6 |
7 | Replicate is building tools so all software engineers can use AI as if it were normal software. You should be able to import an image generator the same way you import an npm package. You should be able to customize a model as easily as you can fork something on GitHub.
8 |
9 | {{{tasksSection}}}
--------------------------------------------------------------------------------
/scripts/inference-providers/templates/providers/sambanova.handlebars:
--------------------------------------------------------------------------------
1 | # SambaNova
2 |
3 | {{{logoSection}}}
4 |
5 | {{{followUsSection}}}
6 |
7 | SambaNova's AI platform is the technology backbone for the next decade of AI innovation.
8 | Customers are turning to SambaNova to quickly deploy state-of-the-art AI and deep learning capabilities that help them outcompete their peers.
9 |
10 | {{{tasksSection}}}
--------------------------------------------------------------------------------
/scripts/inference-providers/templates/providers/together.handlebars:
--------------------------------------------------------------------------------
1 | # Together
2 |
3 | {{{logoSection}}}
4 |
5 | {{{followUsSection}}}
6 |
7 | Together decentralized cloud services empower developers and researchers at organizations of all sizes to train, fine-tune, and deploy generative AI models.
8 |
9 | {{{tasksSection}}}
--------------------------------------------------------------------------------
/scripts/inference-providers/templates/task/audio-classification.handlebars:
--------------------------------------------------------------------------------
1 | ## Audio Classification
2 |
3 | Audio classification is the task of assigning a label or class to a given audio.
4 |
5 | Example applications:
6 | * Recognizing which command a user is giving
7 | * Identifying a speaker
8 | * Detecting the genre of a song
9 |
10 | {{{tips.linksToTaskPage.audio-classification}}}
11 |
12 | ### Recommended models
13 |
14 | {{#each recommendedModels.audio-classification}}
15 | - [{{this.id}}](https://huggingface.co/{{this.id}}): {{this.description}}
16 | {{/each}}
17 |
18 | {{{tips.listModelsLink.audio-classification}}}
19 |
20 | ### Using the API
21 |
22 | {{{snippets.audio-classification}}}
23 |
24 | ### API specification
25 |
26 | #### Request
27 |
28 | {{{constants.specsHeaders}}}
29 |
30 | {{{specs.audio-classification.input}}}
31 |
32 | #### Response
33 |
34 | {{{specs.audio-classification.output}}}
35 |
--------------------------------------------------------------------------------
/scripts/inference-providers/templates/task/automatic-speech-recognition.handlebars:
--------------------------------------------------------------------------------
1 | ## Automatic Speech Recognition
2 |
3 | Automatic Speech Recognition (ASR), also known as Speech to Text (STT), is the task of transcribing a given audio to text.
4 |
5 | Example applications:
6 | * Transcribing a podcast
7 | * Building a voice assistant
8 | * Generating subtitles for a video
9 |
10 | {{{tips.linksToTaskPage.automatic-speech-recognition}}}
11 |
12 | ### Recommended models
13 |
14 | {{#each recommendedModels.automatic-speech-recognition}}
15 | - [{{this.id}}](https://huggingface.co/{{this.id}}): {{this.description}}
16 | {{/each}}
17 |
18 | {{{tips.listModelsLink.automatic-speech-recognition}}}
19 |
20 | ### Using the API
21 |
22 | {{{snippets.automatic-speech-recognition}}}
23 |
24 | ### API specification
25 |
26 | #### Request
27 |
28 | {{{constants.specsHeaders}}}
29 |
30 | {{{specs.automatic-speech-recognition.input}}}
31 |
32 | #### Response
33 |
34 | {{{specs.automatic-speech-recognition.output}}}
35 |
--------------------------------------------------------------------------------
/scripts/inference-providers/templates/task/chat-completion.handlebars:
--------------------------------------------------------------------------------
1 | ## Chat Completion
2 |
3 | Generate a response given a list of messages in a conversational context, supporting both conversational Language Models (LLMs) and conversational Vision-Language Models (VLMs).
4 | This is a subtask of [`text-generation`](https://huggingface.co/docs/inference-providers/tasks/text-generation) and [`image-text-to-text`](https://huggingface.co/docs/inference-providers/tasks/image-text-to-text).
5 |
6 | ### Recommended models
7 |
8 | #### Conversational Large Language Models (LLMs)
9 |
10 | {{#each recommendedModels.chat-completion}}
11 | - [{{this.id}}](https://huggingface.co/{{this.id}}): {{this.description}}
12 | {{/each}}
13 |
14 | #### Conversational Vision-Language Models (VLMs)
15 |
16 | {{#each recommendedModels.conversational-image-text-to-text}}
17 | - [{{this.id}}](https://huggingface.co/{{this.id}}): {{this.description}}
18 | {{/each}}
19 |
20 | ### API Playground
21 |
22 | For Chat Completion models, we provide an interactive UI Playground for easier testing:
23 |
24 | - Quickly iterate on your prompts from the UI.
25 | - Set and override system, assistant and user messages.
26 | - Browse and select models currently available on the Inference API.
27 | - Compare the output of two models side-by-side.
28 | - Adjust requests parameters from the UI.
29 | - Easily switch between UI view and code snippets.
30 |
31 |
32 |
33 | Access the Inference UI Playground and start exploring: [https://huggingface.co/playground](https://huggingface.co/playground)
34 |
35 | ### Using the API
36 |
37 | The API supports:
38 |
39 | * Using the chat completion API compatible with the OpenAI SDK.
40 | * Using grammars, constraints, and tools.
41 | * Streaming the output
42 |
43 | #### Code snippet example for conversational LLMs
44 |
45 | {{{snippets.chat-completion}}}
46 |
47 | #### Code snippet example for conversational VLMs
48 |
49 | {{{snippets.conversational-image-text-to-text}}}
50 |
51 | ### API specification
52 |
53 | #### Request
54 |
55 | {{{constants.specsHeaders}}}
56 |
57 | {{{specs.chat-completion.input}}}
58 |
59 | #### Response
60 |
61 | Output type depends on the `stream` input parameter.
62 | If `stream` is `false` (default), the response will be a JSON object with the following fields:
63 |
64 | {{{specs.chat-completion.output}}}
65 |
66 | If `stream` is `true`, generated tokens are returned as a stream, using Server-Sent Events (SSE).
67 | For more information about streaming, check out [this guide](https://huggingface.co/docs/text-generation-inference/conceptual/streaming).
68 |
69 | {{{specs.chat-completion.stream_output}}}
70 |
71 |
--------------------------------------------------------------------------------
/scripts/inference-providers/templates/task/feature-extraction.handlebars:
--------------------------------------------------------------------------------
1 | ## Feature Extraction
2 |
3 | Feature extraction is the task of converting a text into a vector (often called "embedding").
4 |
5 | Example applications:
6 | * Retrieving the most relevant documents for a query (for RAG applications).
7 | * Reranking a list of documents based on their similarity to a query.
8 | * Calculating the similarity between two sentences.
9 |
10 | {{{tips.linksToTaskPage.feature-extraction}}}
11 |
12 | ### Recommended models
13 |
14 | {{#each recommendedModels.feature-extraction}}
15 | - [{{this.id}}](https://huggingface.co/{{this.id}}): {{this.description}}
16 | {{/each}}
17 |
18 | {{{tips.listModelsLink.feature-extraction}}}
19 |
20 | ### Using the API
21 |
22 | {{{snippets.feature-extraction}}}
23 |
24 | ### API specification
25 |
26 | #### Request
27 |
28 | {{{constants.specsHeaders}}}
29 |
30 | {{{specs.feature-extraction.input}}}
31 |
32 | #### Response
33 |
34 | {{{specs.feature-extraction.output}}}
35 |
36 |
--------------------------------------------------------------------------------
/scripts/inference-providers/templates/task/fill-mask.handlebars:
--------------------------------------------------------------------------------
1 | ## Fill-mask
2 |
3 | Mask filling is the task of predicting the right word (token to be precise) in the middle of a sequence.
4 |
5 | {{{tips.linksToTaskPage.fill-mask}}}
6 |
7 | ### Recommended models
8 |
9 | {{#each recommendedModels.fill-mask}}
10 | - [{{this.id}}](https://huggingface.co/{{this.id}}): {{this.description}}
11 | {{/each}}
12 |
13 | {{{tips.listModelsLink.fill-mask}}}
14 |
15 | ### Using the API
16 |
17 | {{{snippets.fill-mask}}}
18 |
19 | ### API specification
20 |
21 | #### Request
22 |
23 | {{{constants.specsHeaders}}}
24 |
25 | {{{specs.fill-mask.input}}}
26 |
27 | #### Response
28 |
29 | {{{specs.fill-mask.output}}}
30 |
--------------------------------------------------------------------------------
/scripts/inference-providers/templates/task/image-classification.handlebars:
--------------------------------------------------------------------------------
1 | ## Image Classification
2 |
3 | Image classification is the task of assigning a label or class to an entire image. Images are expected to have only one class for each image.
4 |
5 | {{{tips.linksToTaskPage.image-classification}}}
6 |
7 | ### Recommended models
8 |
9 | {{#each recommendedModels.image-classification}}
10 | - [{{this.id}}](https://huggingface.co/{{this.id}}): {{this.description}}
11 | {{/each}}
12 |
13 | {{{tips.listModelsLink.image-classification}}}
14 |
15 | ### Using the API
16 |
17 | {{{snippets.image-classification}}}
18 |
19 | ### API specification
20 |
21 | #### Request
22 |
23 | {{{constants.specsHeaders}}}
24 |
25 | {{{specs.image-classification.input}}}
26 |
27 | #### Response
28 |
29 | {{{specs.image-classification.output}}}
30 |
31 |
--------------------------------------------------------------------------------
/scripts/inference-providers/templates/task/image-segmentation.handlebars:
--------------------------------------------------------------------------------
1 | ## Image Segmentation
2 |
3 | Image Segmentation divides an image into segments where each pixel in the image is mapped to an object.
4 |
5 | {{{tips.linksToTaskPage.image-segmentation}}}
6 |
7 | ### Recommended models
8 |
9 | {{#each recommendedModels.image-segmentation}}
10 | - [{{this.id}}](https://huggingface.co/{{this.id}}): {{this.description}}
11 | {{/each}}
12 |
13 | {{{tips.listModelsLink.image-segmentation}}}
14 |
15 | ### Using the API
16 |
17 | {{{snippets.image-segmentation}}}
18 |
19 | ### API specification
20 |
21 | #### Request
22 |
23 | {{{constants.specsHeaders}}}
24 |
25 | {{{specs.image-segmentation.input}}}
26 |
27 | #### Response
28 |
29 | {{{specs.image-segmentation.output}}}
30 |
31 |
--------------------------------------------------------------------------------
/scripts/inference-providers/templates/task/image-to-image.handlebars:
--------------------------------------------------------------------------------
1 | ## Image to Image
2 |
3 | Image-to-image is the task of transforming a source image to match the characteristics of a target image or a target image domain.
4 |
5 | Example applications:
6 | * Transferring the style of an image to another image
7 | * Colorizing a black and white image
8 | * Increasing the resolution of an image
9 |
10 | {{{tips.linksToTaskPage.image-to-image}}}
11 |
12 | ### Recommended models
13 |
14 | {{#each recommendedModels.image-to-image}}
15 | - [{{this.id}}](https://huggingface.co/{{this.id}}): {{this.description}}
16 | {{/each}}
17 |
18 | {{{tips.listModelsLink.image-to-image}}}
19 |
20 | ### Using the API
21 |
22 | {{{snippets.image-to-image}}}
23 |
24 | ### API specification
25 |
26 | #### Request
27 |
28 | {{{constants.specsHeaders}}}
29 |
30 | {{{specs.image-to-image.input}}}
31 |
32 | #### Response
33 |
34 | {{{specs.image-to-image.output}}}
35 |
36 |
--------------------------------------------------------------------------------
/scripts/inference-providers/templates/task/object-detection.handlebars:
--------------------------------------------------------------------------------
1 | ## Object detection
2 |
3 | Object Detection models allow users to identify objects of certain defined classes. These models receive an image as input and output the images with bounding boxes and labels on detected objects.
4 |
5 | {{{tips.linksToTaskPage.object-detection}}}
6 |
7 | ### Recommended models
8 |
9 | {{#each recommendedModels.object-detection}}
10 | - [{{this.id}}](https://huggingface.co/{{this.id}}): {{this.description}}
11 | {{/each}}
12 |
13 | {{{tips.listModelsLink.object-detection}}}
14 |
15 | ### Using the API
16 |
17 | {{{snippets.object-detection}}}
18 |
19 | ### API specification
20 |
21 | #### Request
22 |
23 | {{{constants.specsHeaders}}}
24 |
25 | {{{specs.object-detection.input}}}
26 |
27 | #### Response
28 |
29 | {{{specs.object-detection.output}}}
30 |
--------------------------------------------------------------------------------
/scripts/inference-providers/templates/task/question-answering.handlebars:
--------------------------------------------------------------------------------
1 | ## Question Answering
2 |
3 | Question Answering models can retrieve the answer to a question from a given text, which is useful for searching for an answer in a document.
4 |
5 | {{{tips.linksToTaskPage.question-answering}}}
6 |
7 | ### Recommended models
8 |
9 | {{#each recommendedModels.question-answering}}
10 | - [{{this.id}}](https://huggingface.co/{{this.id}}): {{this.description}}
11 | {{/each}}
12 |
13 | {{{tips.listModelsLink.question-answering}}}
14 |
15 | ### Using the API
16 |
17 | {{{snippets.question-answering}}}
18 |
19 | ### API specification
20 |
21 | #### Request
22 |
23 | {{{constants.specsHeaders}}}
24 |
25 | {{{specs.question-answering.input}}}
26 |
27 | #### Response
28 |
29 | {{{specs.question-answering.output}}}
30 |
--------------------------------------------------------------------------------
/scripts/inference-providers/templates/task/summarization.handlebars:
--------------------------------------------------------------------------------
1 | ## Summarization
2 |
3 | Summarization is the task of producing a shorter version of a document while preserving its important information. Some models can extract text from the original input, while other models can generate entirely new text.
4 |
5 | {{{tips.linksToTaskPage.summarization}}}
6 |
7 | ### Recommended models
8 |
9 | {{#each recommendedModels.summarization}}
10 | - [{{this.id}}](https://huggingface.co/{{this.id}}): {{this.description}}
11 | {{/each}}
12 |
13 | {{{tips.listModelsLink.summarization}}}
14 |
15 | ### Using the API
16 |
17 | {{{snippets.summarization}}}
18 |
19 | ### API specification
20 |
21 | #### Request
22 |
23 | {{{constants.specsHeaders}}}
24 |
25 | {{{specs.summarization.input}}}
26 |
27 | #### Response
28 |
29 | {{{specs.summarization.output}}}
30 |
--------------------------------------------------------------------------------
/scripts/inference-providers/templates/task/table-question-answering.handlebars:
--------------------------------------------------------------------------------
1 | ## Table Question Answering
2 |
3 | Table Question Answering (Table QA) is the answering a question about an information on a given table.
4 |
5 | {{{tips.linksToTaskPage.table-question-answering}}}
6 |
7 | ### Recommended models
8 |
9 | {{#each recommendedModels.table-question-answering}}
10 | - [{{this.id}}](https://huggingface.co/{{this.id}}): {{this.description}}
11 | {{/each}}
12 |
13 | {{{tips.listModelsLink.table-question-answering}}}
14 |
15 | ### Using the API
16 |
17 | {{{snippets.table-question-answering}}}
18 |
19 | ### API specification
20 |
21 | #### Request
22 |
23 | {{{constants.specsHeaders}}}
24 |
25 | {{{specs.table-question-answering.input}}}
26 |
27 | #### Response
28 |
29 | {{{specs.table-question-answering.output}}}
30 |
--------------------------------------------------------------------------------
/scripts/inference-providers/templates/task/text-classification.handlebars:
--------------------------------------------------------------------------------
1 | ## Text Classification
2 |
3 | Text Classification is the task of assigning a label or class to a given text. Some use cases are sentiment analysis, natural language inference, and assessing grammatical correctness.
4 |
5 | {{{tips.linksToTaskPage.text-classification}}}
6 |
7 | ### Recommended models
8 |
9 | {{#each recommendedModels.text-classification}}
10 | - [{{this.id}}](https://huggingface.co/{{this.id}}): {{this.description}}
11 | {{/each}}
12 |
13 | {{{tips.listModelsLink.text-classification}}}
14 |
15 | ### Using the API
16 |
17 | {{{snippets.text-classification}}}
18 |
19 | ### API specification
20 |
21 | #### Request
22 |
23 | {{{constants.specsHeaders}}}
24 |
25 | {{{specs.text-classification.input}}}
26 |
27 | #### Response
28 |
29 | {{{specs.text-classification.output}}}
30 |
--------------------------------------------------------------------------------
/scripts/inference-providers/templates/task/text-generation.handlebars:
--------------------------------------------------------------------------------
1 | ## Text Generation
2 |
3 | Generate text based on a prompt.
4 |
5 | If you are interested in a Chat Completion task, which generates a response based on a list of messages, check out the [`chat-completion`](./chat_completion) task.
6 |
7 | {{{tips.linksToTaskPage.text-generation}}}
8 |
9 | ### Recommended models
10 |
11 | {{#each recommendedModels.text-generation}}
12 | - [{{this.id}}](https://huggingface.co/{{this.id}}): {{this.description}}
13 | {{/each}}
14 |
15 | {{{tips.listModelsLink.text-generation}}}
16 |
17 | ### Using the API
18 |
19 | {{{snippets.text-generation}}}
20 |
21 | ### API specification
22 |
23 | #### Request
24 |
25 | {{{constants.specsHeaders}}}
26 |
27 | {{{specs.text-generation.input}}}
28 |
29 | #### Response
30 |
31 | Output type depends on the `stream` input parameter.
32 | If `stream` is `false` (default), the response will be a JSON object with the following fields:
33 |
34 | {{{specs.text-generation.output}}}
35 |
36 | If `stream` is `true`, generated tokens are returned as a stream, using Server-Sent Events (SSE).
37 | For more information about streaming, check out [this guide](https://huggingface.co/docs/text-generation-inference/conceptual/streaming).
38 |
39 | {{{specs.text-generation.stream_output}}}
40 |
--------------------------------------------------------------------------------
/scripts/inference-providers/templates/task/text-to-image.handlebars:
--------------------------------------------------------------------------------
1 | ## Text to Image
2 |
3 | Generate an image based on a given text prompt.
4 |
5 | {{{tips.linksToTaskPage.text-to-image}}}
6 |
7 | ### Recommended models
8 |
9 | {{#each recommendedModels.text-to-image}}
10 | - [{{this.id}}](https://huggingface.co/{{this.id}}): {{this.description}}
11 | {{/each}}
12 |
13 | {{{tips.listModelsLink.text-to-image}}}
14 |
15 | ### Using the API
16 |
17 | {{{snippets.text-to-image}}}
18 |
19 | ### API specification
20 |
21 | #### Request
22 |
23 | {{{constants.specsHeaders}}}
24 |
25 | {{{specs.text-to-image.input}}}
26 |
27 | #### Response
28 |
29 | {{{specs.text-to-image.output}}}
30 |
--------------------------------------------------------------------------------
/scripts/inference-providers/templates/task/text-to-video.handlebars:
--------------------------------------------------------------------------------
1 | ## Text to Video
2 |
3 | Generate an video based on a given text prompt.
4 |
5 | {{{tips.linksToTaskPage.text-to-video}}}
6 |
7 | ### Recommended models
8 |
9 | {{#each recommendedModels.text-to-video}}
10 | - [{{this.id}}](https://huggingface.co/{{this.id}}): {{this.description}}
11 | {{/each}}
12 |
13 | {{{tips.listModelsLink.text-to-video}}}
14 |
15 | ### Using the API
16 |
17 | {{{snippets.text-to-video}}}
18 |
19 | ### API specification
20 |
21 | #### Request
22 |
23 | {{{specs.text-to-video.input}}}
24 |
25 | {{{constants.specsHeaders}}}
26 |
27 | #### Response
28 |
29 | {{{specs.text-to-video.output}}}
30 |
--------------------------------------------------------------------------------
/scripts/inference-providers/templates/task/token-classification.handlebars:
--------------------------------------------------------------------------------
1 | ## Token Classification
2 |
3 | Token classification is a task in which a label is assigned to some tokens in a text. Some popular token classification subtasks are Named Entity Recognition (NER) and Part-of-Speech (PoS) tagging.
4 |
5 | {{{tips.linksToTaskPage.token-classification}}}
6 |
7 | ### Recommended models
8 |
9 | {{#each recommendedModels.token-classification}}
10 | - [{{this.id}}](https://huggingface.co/{{this.id}}): {{this.description}}
11 | {{/each}}
12 |
13 | {{{tips.listModelsLink.token-classification}}}
14 |
15 | ### Using the API
16 |
17 | {{{snippets.token-classification}}}
18 |
19 | ### API specification
20 |
21 | #### Request
22 |
23 | {{{constants.specsHeaders}}}
24 |
25 | {{{specs.token-classification.input}}}
26 |
27 | #### Response
28 |
29 | {{{specs.token-classification.output}}}
30 |
31 |
--------------------------------------------------------------------------------
/scripts/inference-providers/templates/task/translation.handlebars:
--------------------------------------------------------------------------------
1 | ## Translation
2 |
3 | Translation is the task of converting text from one language to another.
4 |
5 | {{{tips.linksToTaskPage.translation}}}
6 |
7 | ### Recommended models
8 |
9 | {{#each recommendedModels.translation}}
10 | - [{{this.id}}](https://huggingface.co/{{this.id}}): {{this.description}}
11 | {{/each}}
12 |
13 | {{{tips.listModelsLink.translation}}}
14 |
15 | ### Using the API
16 |
17 | {{{snippets.translation}}}
18 |
19 | ### API specification
20 |
21 | #### Request
22 |
23 | {{{constants.specsHeaders}}}
24 |
25 | {{{specs.translation.input}}}
26 |
27 | #### Response
28 |
29 | {{{specs.translation.output}}}
30 |
--------------------------------------------------------------------------------
/scripts/inference-providers/templates/task/zero-shot-classification.handlebars:
--------------------------------------------------------------------------------
1 | ## Zero-Shot Classification
2 |
3 | Zero-shot text classification is super useful to try out classification with zero code, you simply pass a sentence/paragraph and the possible labels for that sentence, and you get a result. The model has not been necessarily trained on the labels you provide, but it can still predict the correct label.
4 |
5 | {{{tips.linksToTaskPage.zero-shot-classification}}}
6 |
7 | ### Recommended models
8 |
9 | {{#each recommendedModels.zero-shot-classification}}
10 | - [{{this.id}}](https://huggingface.co/{{this.id}}): {{this.description}}
11 | {{/each}}
12 |
13 | {{{tips.listModelsLink.zero-shot-classification}}}
14 |
15 | ### Using the API
16 |
17 | {{{snippets.zero-shot-classification}}}
18 |
19 | ### API specification
20 |
21 | #### Request
22 |
23 | {{{constants.specsHeaders}}}
24 |
25 | {{{specs.zero-shot-classification.input}}}
26 |
27 | #### Response
28 |
29 | {{{specs.zero-shot-classification.output}}}
30 |
--------------------------------------------------------------------------------
/scripts/inference-providers/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "allowSyntheticDefaultImports": true,
4 | "lib": ["ES2022", "DOM"],
5 | "module": "ESNext",
6 | "target": "ESNext",
7 | "moduleResolution": "node",
8 | "forceConsistentCasingInFileNames": true,
9 | "strict": true,
10 | "noImplicitAny": true,
11 | "strictNullChecks": true,
12 | "skipLibCheck": true,
13 | "noImplicitOverride": true,
14 | "outDir": "./dist",
15 | "declaration": true,
16 | "declarationMap": true
17 | },
18 | "include": ["scripts"],
19 | "exclude": ["dist"]
20 | }
21 |
--------------------------------------------------------------------------------