Skip to content

Commit

Permalink
Merge branch 'Vaibhavs10-patch-1' of https://github.com/huggingface/h…
Browse files Browse the repository at this point in the history
…ub-docs into Vaibhavs10-patch-1
  • Loading branch information
Vaibhavs10 committed Nov 29, 2024
2 parents 275d327 + a25f324 commit 141bb3d
Show file tree
Hide file tree
Showing 69 changed files with 1,887 additions and 452 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/api_inference_generate_documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Update API Inference Documentation

on:
workflow_dispatch:
schedule:
- cron: "0 3 * * *" # Every day at 3am

concurrency:
group: api_inference_generate_documentation
cancel-in-progress: true

jobs:
pull_request:
runs-on: ubuntu-latest
steps:
# Setup
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "20"
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
run_install: |
- recursive: true
cwd: ./scripts/api-inference
args: [--frozen-lockfile]
package_json_file: ./scripts/api-inference/package.json
- name: Update huggingface/tasks package
working-directory: ./scripts/api-inference
run: |
pnpm update @huggingface/tasks@latest
# Generate
- name: Generate API inference documentation
run: pnpm run generate
working-directory: ./scripts/api-inference

# Check changes
- name: Check changes
run: git status

# Create or update Pull Request
- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.TOKEN_INFERENCE_SYNC_BOT }}
commit-message: Update API inference documentation (automated)
branch: update-api-inference-docs-automated-pr
delete-branch: true
title: "[Bot] Update API inference documentation"
body: |
This PR automatically upgrades the `@huggingface/tasks` package and regenerates the API inference documentation by running:
```sh
cd scripts/api-inference
pnpm update @huggingface/tasks@latest
pnpm run generate
```
This PR was automatically created by the [Update API Inference Documentation workflow](https://github.com/huggingface/hub-docs/blob/main/.github/workflows/api_inference_generate_documentation.yml).
Please review the changes before merging.
reviewers: |
Wauplin
hanouticelina
2 changes: 2 additions & 0 deletions docs/api-inference/_toctree.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
title: Image Segmentation
- local: tasks/image-to-image
title: Image to Image
- local: tasks/image-text-to-text
title: Image-Text to Text
- local: tasks/object-detection
title: Object Detection
- local: tasks/question-answering
Expand Down
14 changes: 11 additions & 3 deletions docs/api-inference/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,16 @@ The documentation is organized into two sections:

---

## Looking for custom support from the Hugging Face team?
## Inference Playground

<a target="_blank" href="https://huggingface.co/support">
<img alt="HuggingFace Expert Acceleration Program" src="https://cdn-media.huggingface.co/marketing/transformers/new-support-improved.png" style="max-width: 600px; border: 1px solid #eee; border-radius: 4px; box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);">
If you want to get started quickly with [Chat Completion models](https://huggingface.co/models?inference=warm&other=conversational&sort=trending) use the Inference Playground to quickly text and compare models against your prompts.

<a href="https://huggingface.co/playground" target="blank"><img src="https://cdn-uploads.huggingface.co/production/uploads/5f17f0a0925b9863e28ad517/9_Tgf0Tv65srhBirZQMTp.png" style="max-width: 550px; width: 100%;"/></a>

---

## Serious about AI in your organisation? Build faster with the Hugging Face Enterprise Hub.

<a target="_blank" href="https://huggingface.co/enterprise">
<img alt="Hugging Face Enterprise Hub" src="https://cdn-uploads.huggingface.co/production/uploads/5f17f0a0925b9863e28ad517/64zNL-65xyIpRqWHe2iD0.png" style="width: 100%; max-width: 550px; border: 1px solid #eee; border-radius: 4px; box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);">
</a><br>
8 changes: 5 additions & 3 deletions docs/api-inference/rate-limits.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ The Inference API has rate limits based on the number of requests. These rate li

Serverless API is not meant to be used for heavy production applications. If you need higher rate limits, consider [Inference Endpoints](https://huggingface.co/docs/inference-endpoints) to have dedicated resources.

You need to be authenticated (passing a token or through your browser) to use the Inference API.


| User Tier | Rate Limit |
|---------------------|---------------------------|
| Unregistered Users | 1 request per hour |
| Signed-up Users | 50 requests per hour |
| PRO and Enterprise Users | 500 requests per hour |
| Signed-up Users | 1,000 requests per day |
| PRO and Enterprise Users | 20,000 requests per day |
12 changes: 6 additions & 6 deletions docs/api-inference/tasks/audio-classification.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ For more details about the `audio-classification` task, check out its [dedicated

### Recommended models

- [ehcalabres/wav2vec2-lg-xlsr-en-speech-emotion-recognition](https://huggingface.co/ehcalabres/wav2vec2-lg-xlsr-en-speech-emotion-recognition): An emotion recognition model.

This is only a subset of the supported models. Find the model that suits you best [here](https://huggingface.co/models?inference=warm&pipeline_tag=audio-classification&sort=trending).
Explore all available models and find the one that suits you best [here](https://huggingface.co/models?inference=warm&pipeline_tag=audio-classification&sort=trending).

### Using the API

Expand All @@ -39,19 +40,18 @@ This is only a subset of the supported models. Find the model that suits you bes

<curl>
```bash
curl https://api-inference.huggingface.co/models/<REPO_ID> \
curl https://api-inference.huggingface.co/models/ehcalabres/wav2vec2-lg-xlsr-en-speech-emotion-recognition \
-X POST \
--data-binary '@sample1.flac' \
-H "Authorization: Bearer hf_***"

```
</curl>

<python>
```py
import requests

API_URL = "https://api-inference.huggingface.co/models/<REPO_ID>"
API_URL = "https://api-inference.huggingface.co/models/ehcalabres/wav2vec2-lg-xlsr-en-speech-emotion-recognition"
headers = {"Authorization": "Bearer hf_***"}

def query(filename):
Expand All @@ -71,7 +71,7 @@ To use the Python client, see `huggingface_hub`'s [package reference](https://hu
async function query(filename) {
const data = fs.readFileSync(filename);
const response = await fetch(
"https://api-inference.huggingface.co/models/<REPO_ID>",
"https://api-inference.huggingface.co/models/ehcalabres/wav2vec2-lg-xlsr-en-speech-emotion-recognition",
{
headers: {
Authorization: "Bearer hf_***"
Expand Down Expand Up @@ -104,7 +104,7 @@ To use the JavaScript client, see `huggingface.js`'s [package reference](https:/
| Payload | | |
| :--- | :--- | :--- |
| **inputs*** | _string_ | The input audio data as a base64-encoded string. If no `parameters` are provided, you can also provide the audio data as a raw bytes payload. |
| **parameters** | _object_ | Additional inference parameters for Audio Classification |
| **parameters** | _object_ | |
| **&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;function_to_apply** | _enum_ | Possible values: sigmoid, softmax, none. |
| **&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;top_k** | _integer_ | When specified, limits the output to the top K most probable classes. |

Expand Down
11 changes: 5 additions & 6 deletions docs/api-inference/tasks/automatic-speech-recognition.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ For more details about the `automatic-speech-recognition` task, check out its [d
- [openai/whisper-large-v3](https://huggingface.co/openai/whisper-large-v3): A powerful ASR model by OpenAI.
- [pyannote/speaker-diarization-3.1](https://huggingface.co/pyannote/speaker-diarization-3.1): Powerful speaker diarization model.

This is only a subset of the supported models. Find the model that suits you best [here](https://huggingface.co/models?inference=warm&pipeline_tag=automatic-speech-recognition&sort=trending).
Explore all available models and find the one that suits you best [here](https://huggingface.co/models?inference=warm&pipeline_tag=automatic-speech-recognition&sort=trending).

### Using the API

Expand All @@ -45,7 +45,6 @@ curl https://api-inference.huggingface.co/models/openai/whisper-large-v3 \
-X POST \
--data-binary '@sample1.flac' \
-H "Authorization: Bearer hf_***"

```
</curl>

Expand All @@ -65,7 +64,7 @@ def query(filename):
output = query("sample1.flac")
```

To use the Python client, see `huggingface_hub`'s [package reference](https://huggingface.co/docs/huggingface_hub/package_reference/inference_client#huggingface_hub.InferenceClient.automatic_speech-recognition).
To use the Python client, see `huggingface_hub`'s [package reference](https://huggingface.co/docs/huggingface_hub/package_reference/inference_client#huggingface_hub.InferenceClient.automatic_speech_recognition).
</python>

<js>
Expand All @@ -92,7 +91,7 @@ query("sample1.flac").then((response) => {
});
```

To use the JavaScript client, see `huggingface.js`'s [package reference](https://huggingface.co/docs/huggingface.js/inference/classes/HfInference#automaticspeech-recognition).
To use the JavaScript client, see `huggingface.js`'s [package reference](https://huggingface.co/docs/huggingface.js/inference/classes/HfInference#automaticspeechrecognition).
</js>

</inferencesnippet>
Expand All @@ -106,9 +105,9 @@ To use the JavaScript client, see `huggingface.js`'s [package reference](https:/
| Payload | | |
| :--- | :--- | :--- |
| **inputs*** | _string_ | The input audio data as a base64-encoded string. If no `parameters` are provided, you can also provide the audio data as a raw bytes payload. |
| **parameters** | _object_ | Additional inference parameters for Automatic Speech Recognition |
| **parameters** | _object_ | |
| **&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return_timestamps** | _boolean_ | Whether to output corresponding timestamps with the generated text |
| **&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;generate** | _object_ | Ad-hoc parametrization of the text generation process |
| **&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;generation_parameters** | _object_ | |
| **&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;temperature** | _number_ | The value used to modulate the next token probabilities. |
| **&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;top_k** | _integer_ | The number of highest probability vocabulary tokens to keep for top-k-filtering. |
| **&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;top_p** | _number_ | If set to float < 1, only the smallest set of most probable tokens with probabilities that add up to top_p or higher are kept for generation. |
Expand Down
Loading

0 comments on commit 141bb3d

Please sign in to comment.