Skip to content

Conversation

@apolinario
Copy link
Contributor

Internal discussion

The goal is:

  • Keep inputs similar to image-to-image
  • Keep outputs similar to text-to-video
  • For now super generic about.md
  • data.ts for the /tasks on huggingface.co is pending merging this PR

@apolinario apolinario changed the title Add support to image-to-video task Add support to image-to-video task for inference May 21, 2025
Copy link
Contributor

@Wauplin Wauplin left a 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).

};

const prepareImageToVideoInput = (model: ModelDataMinimal): object => {
const data = JSON.parse(getModelInputSnippet(model) as string);
Copy link
Contributor

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";
Copy link
Contributor

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.

@apolinario apolinario marked this pull request as ready for review May 21, 2025 09:01
@apolinario
Copy link
Contributor Author

Thanks @Wauplin ! I've kept it strictly spec-based for now and applied your suggestion for snippets/inputs.ts

Copy link
Contributor

@Wauplin Wauplin left a 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

Copy link
Contributor

@merveenoyan merveenoyan left a comment

Choose a reason for hiding this comment

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

thanks a lot 💗

apolinario and others added 9 commits May 21, 2025 22:12
Co-authored-by: Merve Noyan <merveenoyan@gmail.com>
Co-authored-by: Merve Noyan <merveenoyan@gmail.com>
Co-authored-by: Merve Noyan <merveenoyan@gmail.com>
Co-authored-by: Merve Noyan <merveenoyan@gmail.com>
Co-authored-by: Merve Noyan <merveenoyan@gmail.com>
Co-authored-by: Merve Noyan <merveenoyan@gmail.com>
Co-authored-by: Merve Noyan <merveenoyan@gmail.com>
@apolinario
Copy link
Contributor Author

Thanks merve, applied your suggestions!

Copy link
Contributor

@SBrandeis SBrandeis left a 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 :)

Copy link
Contributor

@merveenoyan merveenoyan left a comment

Choose a reason for hiding this comment

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

LGTM :)

@apolinario apolinario merged commit 131b286 into main May 23, 2025
5 checks passed
@apolinario apolinario deleted the origin/add-image-to-video branch May 23, 2025 07:24
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.

5 participants