-
Notifications
You must be signed in to change notification settings - Fork 388
Add support to image-to-video
task for inference
#1471
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
base: main
Are you sure you want to change the base?
Conversation
image-to-video
task image-to-video
task for inference
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.
Thanks @apolinario ! Pretty solid PR already :) I've made some high-level comments while you are still working on it. I do think it's best to split the PR into 2 (one for spec definition, one for proper implementation for each provider).
@@ -266,6 +268,11 @@ const prepareImageToImageInput = (model: ModelDataMinimal): object => { | |||
return { inputs: data.image, parameters: { prompt: data.prompt } }; | |||
}; | |||
|
|||
const prepareImageToVideoInput = (model: ModelDataMinimal): object => { | |||
const data = JSON.parse(getModelInputSnippet(model) as string); |
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.
Could you add a simple example in https://github.com/huggingface/huggingface.js/blob/main/packages/tasks/src/snippets/inputs.ts ? Something like this:
const inputsImageToVideo = () => `{
"image": "cat.png",
"prompt": "Make the cat dance."
}`;
and then
"image-to-video": inputsImageToVideo,
in the modelInputSnippets
mapping.
This way, const data = JSON.parse(getModelInputSnippet(model) as string);
will return a valid payload to generate the inference snippets.
@@ -0,0 +1,23 @@ | |||
import type { ImageToVideoInput } from "@huggingface/tasks"; |
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.
Let's not add this file yet and wait for a follow-up PR. The current implementation assumes it works with FalAI and Replicate which is not the case yet -and not tested-. Better to separate them and keep this PR for specs definition only.
…pet to tasks snippets)
Thanks @Wauplin ! I've kept it strictly spec-based for now and applied your suggestion for snippets/inputs.ts |
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.
Looks good to me, thanks!
Let's wait for another review, especially for the about.md/data.ts part which I know less about
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.
thanks a lot 💗
Co-authored-by: Merve Noyan <[email protected]>
Co-authored-by: Merve Noyan <[email protected]>
Co-authored-by: Merve Noyan <[email protected]>
Co-authored-by: Merve Noyan <[email protected]>
Co-authored-by: Merve Noyan <[email protected]>
Co-authored-by: Merve Noyan <[email protected]>
Co-authored-by: Merve Noyan <[email protected]>
…gface/huggingface.js into origin/add-image-to-video
Thanks merve, applied your suggestions! |
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.
Approving in principle - deferring to @merveenoyan re: data.ts
I will review the inference client implementation more thoroughly :)
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.
LGTM :)
Internal discussion
The goal is:
about.md
data.ts
for the/tasks
on huggingface.co is pending merging this PR