Skip to content
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

[Fix Replicate] Send Prefer:wait header #1249

Merged
merged 1 commit into from
Mar 4, 2025
Merged

Conversation

Wauplin
Copy link
Contributor

@Wauplin Wauplin commented Mar 4, 2025

Fixing a bug introduced in #1208 and more precisely here.

For Replicate provider, we must send Prefer: wait header as this is the only path we support for now.


Tested locally and it fixes the textToVideo issue we have on https://huggingface.co/Wan-AI/Wan2.1-T2V-14B

import { HfInference } from "@huggingface/inference";
import fs from "fs/promises";

async function generateTextToVideo() {
	const hf = new HfInference("xxx");
	const res = await hf.textToVideo({
		inputs: "a cat swimming in an ocean of bananas",
		provider: "replicate",
		model: "Wan-AI/Wan2.1-T2V-14B",
	});

	const arrayBuffer = await res.arrayBuffer();
	const buffer = Buffer.from(arrayBuffer);
	await fs.writeFile("output.mp4", buffer);
}

generateTextToVideo();
output.mp4

cc @SBrandeis @kefranabg @zeke

@Wauplin Wauplin changed the title Fix Replicate: use Prefer:wait header [Fix Replicate] Send Prefer:wait header Mar 4, 2025
Copy link
Contributor

@kefranabg kefranabg left a comment

Choose a reason for hiding this comment

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

Nice!

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.

🐐

@Wauplin
Copy link
Contributor Author

Wauplin commented Mar 4, 2025

Never got that many approvals so quickly 😄

image

@Wauplin Wauplin merged commit bca4f71 into main Mar 4, 2025
5 checks passed
@Wauplin Wauplin deleted the fix-replicate-add-prefer-wait branch March 4, 2025 15:29
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