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

Add more Replicate models (take 2) #1130

Merged
merged 9 commits into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions packages/inference/src/providers/replicate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,19 @@ type ReplicateId = string;

export const REPLICATE_SUPPORTED_MODEL_IDS: ProviderMapping<ReplicateId> = {
"text-to-image": {
"black-forest-labs/FLUX.1-dev": "black-forest-labs/flux-dev",
"black-forest-labs/FLUX.1-schnell": "black-forest-labs/flux-schnell",
"ByteDance/Hyper-SD":
"bytedance/hyper-flux-16step:382cf8959fb0f0d665b26e7e80b8d6dc3faaef1510f14ce017e8c732bb3d1eb7",
"ByteDance/SDXL-Lightning":
"bytedance/sdxl-lightning-4step:5599ed30703defd1d160a25a63321b4dec97101d98b4674bcc56e41f62f35637",
"playgroundai/playground-v2.5-1024px-aesthetic":
"playgroundai/playground-v2.5-1024px-aesthetic:a45f82a1382bed5c7aeb861dac7c7d191b0fdf74d8d57c4a0e6ed7d4d0bf7d24",
"stabilityai/stable-diffusion-3.5-large-turbo": "stability-ai/stable-diffusion-3.5-large-turbo",
"stabilityai/stable-diffusion-3.5-large": "stability-ai/stable-diffusion-3.5-large",
"stabilityai/stable-diffusion-3.5-medium": "stability-ai/stable-diffusion-3.5-medium",
"stabilityai/stable-diffusion-xl-base-1.0":
"stability-ai/sdxl:7762fd07cf82c948538e41f63f77d685e02b063e37e496e96eefd46c929f9bdc",
},
"text-to-speech": {
"OuteAI/OuteTTS-0.3-500M": "jbilcke/oute-tts:39a59319327b27327fa3095149c5a746e7f2aee18c75055c3368237a6503cd26",
Expand Down
52 changes: 49 additions & 3 deletions packages/inference/test/HfInference.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,7 @@ describe.concurrent("HfInference", () => {
() => {
const client = new HfInference(env.HF_REPLICATE_KEY);

it("textToImage canonical", async () => {
it("textToImage canonical - black-forest-labs/FLUX.1-schnell", async () => {
const res = await client.textToImage({
model: "black-forest-labs/FLUX.1-schnell",
provider: "replicate",
Expand All @@ -847,11 +847,57 @@ describe.concurrent("HfInference", () => {
expect(res).toBeInstanceOf(Blob);
});

it("textToImage versioned", async () => {
it("textToImage canonical - black-forest-labs/FLUX.1-dev", async () => {
const res = await client.textToImage({
model: "black-forest-labs/FLUX.1-dev",
provider: "replicate",
inputs:
"A tiny laboratory deep in the Black Forest where squirrels in lab coats experiment with mixing chocolate and pine cones",
});
expect(res).toBeInstanceOf(Blob);
});

it("textToImage canonical - stabilityai/stable-diffusion-3.5-large-turbo", async () => {
const res = await client.textToImage({
model: "stabilityai/stable-diffusion-3.5-large-turbo",
provider: "replicate",
inputs: "A confused rubber duck wearing a tiny wizard hat trying to cast spells with a banana wand",
});
expect(res).toBeInstanceOf(Blob);
});

it("textToImage versioned - ByteDance/SDXL-Lightning", async () => {
const res = await client.textToImage({
model: "ByteDance/SDXL-Lightning",
provider: "replicate",
inputs: "black forest gateau cake spelling out the words FLUX SCHNELL, tasty, food photography, dynamic shot",
inputs: "A grumpy storm cloud wearing sunglasses and throwing tiny lightning bolts like confetti",
});
expect(res).toBeInstanceOf(Blob);
});

it("textToImage versioned - ByteDance/Hyper-SD", async () => {
const res = await client.textToImage({
model: "ByteDance/Hyper-SD",
provider: "replicate",
inputs: "A group of dancing bytes wearing tiny party hats doing the macarena in cyberspace",
});
expect(res).toBeInstanceOf(Blob);
});

it("textToImage versioned - playgroundai/playground-v2.5-1024px-aesthetic", async () => {
const res = await client.textToImage({
model: "playgroundai/playground-v2.5-1024px-aesthetic",
provider: "replicate",
inputs: "A playground where slides turn into rainbows and swings launch kids into cotton candy clouds",
});
expect(res).toBeInstanceOf(Blob);
});

it("textToImage versioned - stabilityai/stable-diffusion-xl-base-1.0", async () => {
const res = await client.textToImage({
model: "stabilityai/stable-diffusion-xl-base-1.0",
provider: "replicate",
inputs: "An octopus juggling watermelons underwater while wearing scuba gear",
});
expect(res).toBeInstanceOf(Blob);
});
Expand Down
Loading
Loading