Skip to content

Conversation

@Wauplin
Copy link
Contributor

@Wauplin Wauplin commented Mar 21, 2025

How to review

Go to https://moon-ci-docs.huggingface.co/docs/inference-providers/pr_1643/en/tasks/index


Description

Opening this PR as a draft as it'll requires some deeper changes in doc-builder cc @julien-c @gary149 @mishig25 @SBrandeis @hanouticelina

This PR updates the script to generate the tasks pages of the Inference API docs (e.g. text-to-image page). The short-term goal is to revamp the "Inference API" docs as an "Inference Providers" one, making them more provider-centric. With this PR, each task page will have

  • a Recommended models section => same as today. Recommended models taken from hf.co/tasks + filtered to keep only warm ones
  • an API specification section => same as today. Specs are taken from the jsonschema specs that we have and rendered in a table.
  • a Using the API section => this is the revamped one. We want to display snippets for all providers supporting the task, and for all clients for which we have code snippets. To chose which model to highlight, I'm taking for each provider the "live" model with the most "likes30d". My only concern with this strategy is that it might lead to recurrent changes in the docs (which are automated daily).
    • In practice, it would be very nice to extend the current <inferencesnippets> tag to have an interface similar to the one on the model page
      image

What I did in this PR is to generate the snippets and serialize them inside some <snippet provider="..." language="..." client="..."> tags. This is where doc-builder should be updated to take them into account.


EDIT: using the new </InferenceSnippet> svelte component from huggingface/doc-builder#549 (thanks @mishig25!)

@Wauplin Wauplin marked this pull request as draft March 21, 2025 15:13
@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@Wauplin Wauplin mentioned this pull request Mar 26, 2025
43 tasks
@mishig25
Copy link
Collaborator

Handled by huggingface/doc-builder#549

see example: #1656

@mishig25 mishig25 closed this Mar 31, 2025
@mishig25 mishig25 reopened this Mar 31, 2025
@Wauplin Wauplin mentioned this pull request Apr 1, 2025
44 tasks
@julien-c
Copy link
Member

julien-c commented Apr 2, 2025

@Wauplin
Copy link
Contributor Author

Wauplin commented Apr 2, 2025

hmm https://moon-ci-docs.huggingface.co/docs/api-inference/pr_1643/en/index has not been updated no?

It's now under https://moon-ci-docs.huggingface.co/docs/inference-providers/pr_1643/en/index

(but in general this PR is not ready, I finishing it up)

@Wauplin Wauplin marked this pull request as ready for review April 2, 2025 16:30
@Wauplin
Copy link
Contributor Author

Wauplin commented Apr 2, 2025

@julien-c @gary149 @hanouticelina @SBrandeis PR is finally ready for review. Best way to review is to go on https://moon-ci-docs.huggingface.co/docs/inference-providers/pr_1643/en/tasks/index

<InferenceSnippet
pipeline=automatic-speech-recognition
providersMapping={ {"fal-ai":{"modelId":"openai/whisper-large-v3","providerModelId":"fal-ai/whisper"},"hf-inference":{"modelId":"openai/whisper-large-v3-turbo","providerModelId":"openai/whisper-large-v3-turbo"}} }
/>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so in the end you don't embed the full snippets in the markdown. Correct?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but we still need to regenerate the .md from time to time to pick up the mapping?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes exactly. If we want we can still have an .md export for llms but not for now

Copy link
Collaborator

@mishig25 mishig25 Apr 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but we still need to regenerate the .md from time to time to pick up the mapping?

yep, written here

image

Copy link
Collaborator

@mishig25 mishig25 Apr 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so in the end you don't embed the full snippets in the markdown. Correct?

inference snippets strings are directly coming from https://github.com/huggingface/huggingface.js (single source of truth)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^ I think that statement does not hold anymore - we moved snippets code to moon-landing

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there is a confusion here 😬

Inference snippets are indeed located in huggingface.js/inference (or I'm not aware of the change) and providers mapping is on the Hub => and pulled from the Hub by the script in this PR to make sure we always get up-to-date models in the docs => done in CI once a day

So all good, right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I've mistaken 'snippets' and 'widgets' - my bad!

</js>

</inferencesnippet>
No snippet available for this task.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's no warm hf-inference for this seminal task? Que pena!!

@Wauplin Wauplin merged commit 4c01d39 into main Apr 3, 2025
2 checks passed
@Wauplin Wauplin deleted the snippets-next-gen branch April 3, 2025 09:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants