Skip to content

Commit bd1fa9e

Browse files
zekeSBrandeis
andauthored
Add more Replicate models (take 2) (#1130)
This PR adds mappings for more Replicate models, along with tests for each new model. ``` vitest run --config vitest.config.mts -t "Replicate" ... ✓ Replicate (9) 8666ms ✓ textToImage canonical - black-forest-labs/FLUX.1-schnell 1214ms ✓ textToImage canonical - black-forest-labs/FLUX.1-dev 3472ms ✓ textToImage canonical - stabilityai/stable-diffusion-3.5-large-turbo 1460ms ✓ textToImage versioned - ByteDance/SDXL-Lightning 2612ms ✓ textToImage versioned - ByteDance/Hyper-SD 4346ms ✓ textToImage versioned - playgroundai/playground-v2.5-1024px-aesthetic 4099ms ✓ textToImage versioned - stabilityai/stable-diffusion-xl-base-1.0 7205ms ↓ textToSpeech versioned [skipped] ↓ textToSpeech OuteTTS [skipped] ``` Replaces #1102 cc @julien-c @SBrandeis --------- Co-authored-by: SBrandeis <[email protected]> Co-authored-by: Simon Brandeis <[email protected]>
1 parent 284b28e commit bd1fa9e

File tree

3 files changed

+377
-3
lines changed

3 files changed

+377
-3
lines changed

packages/inference/src/providers/replicate.ts

+10
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,19 @@ type ReplicateId = string;
66

77
export const REPLICATE_SUPPORTED_MODEL_IDS: ProviderMapping<ReplicateId> = {
88
"text-to-image": {
9+
"black-forest-labs/FLUX.1-dev": "black-forest-labs/flux-dev",
910
"black-forest-labs/FLUX.1-schnell": "black-forest-labs/flux-schnell",
11+
"ByteDance/Hyper-SD":
12+
"bytedance/hyper-flux-16step:382cf8959fb0f0d665b26e7e80b8d6dc3faaef1510f14ce017e8c732bb3d1eb7",
1013
"ByteDance/SDXL-Lightning":
1114
"bytedance/sdxl-lightning-4step:5599ed30703defd1d160a25a63321b4dec97101d98b4674bcc56e41f62f35637",
15+
"playgroundai/playground-v2.5-1024px-aesthetic":
16+
"playgroundai/playground-v2.5-1024px-aesthetic:a45f82a1382bed5c7aeb861dac7c7d191b0fdf74d8d57c4a0e6ed7d4d0bf7d24",
17+
"stabilityai/stable-diffusion-3.5-large-turbo": "stability-ai/stable-diffusion-3.5-large-turbo",
18+
"stabilityai/stable-diffusion-3.5-large": "stability-ai/stable-diffusion-3.5-large",
19+
"stabilityai/stable-diffusion-3.5-medium": "stability-ai/stable-diffusion-3.5-medium",
20+
"stabilityai/stable-diffusion-xl-base-1.0":
21+
"stability-ai/sdxl:7762fd07cf82c948538e41f63f77d685e02b063e37e496e96eefd46c929f9bdc",
1222
},
1323
"text-to-speech": {
1424
"OuteAI/OuteTTS-0.3-500M": "jbilcke/oute-tts:39a59319327b27327fa3095149c5a746e7f2aee18c75055c3368237a6503cd26",

packages/inference/test/HfInference.spec.ts

+49-3
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,7 @@ describe.concurrent("HfInference", () => {
838838
() => {
839839
const client = new HfInference(env.HF_REPLICATE_KEY);
840840

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

850-
it("textToImage versioned", async () => {
850+
it("textToImage canonical - black-forest-labs/FLUX.1-dev", async () => {
851+
const res = await client.textToImage({
852+
model: "black-forest-labs/FLUX.1-dev",
853+
provider: "replicate",
854+
inputs:
855+
"A tiny laboratory deep in the Black Forest where squirrels in lab coats experiment with mixing chocolate and pine cones",
856+
});
857+
expect(res).toBeInstanceOf(Blob);
858+
});
859+
860+
it("textToImage canonical - stabilityai/stable-diffusion-3.5-large-turbo", async () => {
861+
const res = await client.textToImage({
862+
model: "stabilityai/stable-diffusion-3.5-large-turbo",
863+
provider: "replicate",
864+
inputs: "A confused rubber duck wearing a tiny wizard hat trying to cast spells with a banana wand",
865+
});
866+
expect(res).toBeInstanceOf(Blob);
867+
});
868+
869+
it("textToImage versioned - ByteDance/SDXL-Lightning", async () => {
851870
const res = await client.textToImage({
852871
model: "ByteDance/SDXL-Lightning",
853872
provider: "replicate",
854-
inputs: "black forest gateau cake spelling out the words FLUX SCHNELL, tasty, food photography, dynamic shot",
873+
inputs: "A grumpy storm cloud wearing sunglasses and throwing tiny lightning bolts like confetti",
874+
});
875+
expect(res).toBeInstanceOf(Blob);
876+
});
877+
878+
it("textToImage versioned - ByteDance/Hyper-SD", async () => {
879+
const res = await client.textToImage({
880+
model: "ByteDance/Hyper-SD",
881+
provider: "replicate",
882+
inputs: "A group of dancing bytes wearing tiny party hats doing the macarena in cyberspace",
883+
});
884+
expect(res).toBeInstanceOf(Blob);
885+
});
886+
887+
it("textToImage versioned - playgroundai/playground-v2.5-1024px-aesthetic", async () => {
888+
const res = await client.textToImage({
889+
model: "playgroundai/playground-v2.5-1024px-aesthetic",
890+
provider: "replicate",
891+
inputs: "A playground where slides turn into rainbows and swings launch kids into cotton candy clouds",
892+
});
893+
expect(res).toBeInstanceOf(Blob);
894+
});
895+
896+
it("textToImage versioned - stabilityai/stable-diffusion-xl-base-1.0", async () => {
897+
const res = await client.textToImage({
898+
model: "stabilityai/stable-diffusion-xl-base-1.0",
899+
provider: "replicate",
900+
inputs: "An octopus juggling watermelons underwater while wearing scuba gear",
855901
});
856902
expect(res).toBeInstanceOf(Blob);
857903
});

0 commit comments

Comments
 (0)