-
Notifications
You must be signed in to change notification settings - Fork 374
Add text-to-video page #1672
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Add text-to-video page #1672
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| <!--- | ||
| This markdown file has been generated from a script. Please do not edit it directly. | ||
| For more details, check out: | ||
| - the `generate.ts` script: https://github.com/huggingface/hub-docs/blob/main/scripts/inference-providers/scripts/generate.ts | ||
| - the task template defining the sections in the page: https://github.com/huggingface/hub-docs/tree/main/scripts/inference-providers/templates/task/text-to-video.handlebars | ||
| - the input jsonschema specifications used to generate the input markdown table: https://github.com/huggingface/huggingface.js/blob/main/packages/tasks/src/tasks/text-to-video/spec/input.json | ||
| - the output jsonschema specifications used to generate the output markdown table: https://github.com/huggingface/huggingface.js/blob/main/packages/tasks/src/tasks/text-to-video/spec/output.json | ||
| - the snippets used to generate the example: | ||
| - curl: https://github.com/huggingface/huggingface.js/blob/main/packages/tasks/src/snippets/curl.ts | ||
| - python: https://github.com/huggingface/huggingface.js/blob/main/packages/tasks/src/snippets/python.ts | ||
| - javascript: https://github.com/huggingface/huggingface.js/blob/main/packages/tasks/src/snippets/js.ts | ||
| - the "tasks" content for recommended models: https://huggingface.co/api/tasks | ||
| ---> | ||
|
|
||
| ## Text to Video | ||
|
|
||
| Generate an video based on a given text prompt. | ||
|
|
||
| <Tip> | ||
|
|
||
| For more details about the `text-to-video` task, check out its [dedicated page](https://huggingface.co/tasks/text-to-video)! You will find examples and related materials. | ||
|
|
||
| </Tip> | ||
|
|
||
| ### Recommended models | ||
|
|
||
| - [tencent/HunyuanVideo](https://huggingface.co/tencent/HunyuanVideo): A strong model for consistent video generation. | ||
| - [Lightricks/LTX-Video](https://huggingface.co/Lightricks/LTX-Video): A text-to-video model with high fidelity motion and strong prompt adherence. | ||
| - [Wan-AI/Wan2.1-T2V-1.3B](https://huggingface.co/Wan-AI/Wan2.1-T2V-1.3B): A robust model for video generation. | ||
|
|
||
| Explore all available models and find the one that suits you best [here](https://huggingface.co/models?inference=warm&pipeline_tag=text-to-video&sort=trending). | ||
|
|
||
| ### Using the API | ||
|
|
||
|
|
||
| <InferenceSnippet | ||
| pipeline=text-to-video | ||
| providersMapping={ {"fal-ai":{"modelId":"Wan-AI/Wan2.1-T2V-14B","providerModelId":"fal-ai/wan-t2v"},"hf-inference":{"modelId":"AdamLucek/Wan2.1-T2V-14B-OldBookIllustrations","providerModelId":"black-forest-labs/FLUX.1-dev"},"novita":{"modelId":"Wan-AI/Wan2.1-T2V-14B","providerModelId":"wan-t2v"},"replicate":{"modelId":"Wan-AI/Wan2.1-T2V-14B","providerModelId":"wavespeedai/wan-2.1-t2v-480p"}} } | ||
| /> | ||
|
|
||
|
|
||
|
|
||
| ### API specification | ||
|
|
||
| #### Request | ||
|
|
||
| | Payload | | | | ||
| | :--- | :--- | :--- | | ||
| | **inputs*** | _string_ | The input text data (sometimes called "prompt") | | ||
| | **parameters** | _object_ | | | ||
| | ** num_frames** | _number_ | The num_frames parameter determines how many video frames are generated. | | ||
| | ** guidance_scale** | _number_ | A higher guidance scale value encourages the model to generate videos closely linked to the text prompt, but values too high may cause saturation and other artifacts. | | ||
| | ** negative_prompt** | _string[]_ | One or several prompt to guide what NOT to include in video generation. | | ||
| | ** num_inference_steps** | _integer_ | The number of denoising steps. More denoising steps usually lead to a higher quality video at the expense of slower inference. | | ||
| | ** seed** | _integer_ | Seed for the random number generator. | | ||
|
|
||
|
|
||
| Some options can be configured by passing headers to the Inference API. Here are the available headers: | ||
|
|
||
| | Headers | | | | ||
| | :--- | :--- | :--- | | ||
| | **authorization** | _string_ | Authentication header in the form `'Bearer: hf_****'` when `hf_****` is a personal user access token with Inference API permission. You can generate one from [your settings page](https://huggingface.co/settings/tokens). | | ||
| | **x-use-cache** | _boolean, default to `true`_ | There is a cache layer on the inference API to speed up requests we have already seen. Most models can use those results as they are deterministic (meaning the outputs will be the same anyway). However, if you use a nondeterministic model, you can set this parameter to prevent the caching mechanism from being used, resulting in a real new query. Read more about caching [here](../parameters#caching]). | | ||
| | **x-wait-for-model** | _boolean, default to `false`_ | If the model is not ready, wait for it instead of receiving 503. It limits the number of requests required to get your inference done. It is advised to only set this flag to true after receiving a 503 error, as it will limit hanging in your application to known places. Read more about model availability [here](../overview#eligibility]). | | ||
|
|
||
| For more information about Inference API headers, check out the parameters [guide](../parameters). | ||
|
|
||
| #### Response | ||
|
|
||
| | Body | | | ||
| | :--- | :--- | :--- | | ||
| | **video** | _unknown_ | The generated video returned as raw bytes in the payload. | | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
scripts/inference-providers/templates/task/text-to-video.handlebars
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| ## Text to Video | ||
|
|
||
| Generate an video based on a given text prompt. | ||
|
|
||
| {{{tips.linksToTaskPage.text-to-video}}} | ||
|
|
||
| ### Recommended models | ||
|
|
||
| {{#each recommendedModels.text-to-video}} | ||
| - [{{this.id}}](https://huggingface.co/{{this.id}}): {{this.description}} | ||
| {{/each}} | ||
|
|
||
| {{{tips.listModelsLink.text-to-video}}} | ||
|
|
||
| ### Using the API | ||
|
|
||
| {{{snippets.text-to-video}}} | ||
|
|
||
| ### API specification | ||
|
|
||
| #### Request | ||
|
|
||
| {{{specs.text-to-video.input}}} | ||
|
|
||
| {{{constants.specsHeaders}}} | ||
|
|
||
| #### Response | ||
|
|
||
| {{{specs.text-to-video.output}}} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lol, funny this one popped out