-
Notifications
You must be signed in to change notification settings - Fork 538
[Inference] [3rd party] Support versioned and unversioned Replicate models #1106
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
Merged
SBrandeis
merged 3 commits into
huggingface:main
from
zeke:support-versioned-and-unversioned-replicate-models
Jan 15, 2025
Merged
[Inference] [3rd party] Support versioned and unversioned Replicate models #1106
SBrandeis
merged 3 commits into
huggingface:main
from
zeke:support-versioned-and-unversioned-replicate-models
Jan 15, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
Note I haven't tested this change. Please advise if you want me to add some automated tests! |
SBrandeis
approved these changes
Jan 15, 2025
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.
Awesome!! Thank you
SBrandeis
reviewed
Jan 15, 2025
Comment on lines
+2529
to
+2580
| "84b1cb6a9d1039df7c10ffb2c90832009f4399964368f18f9b621da494d6c591": { | ||
| "url": "https://api.replicate.com/v1/predictions", | ||
| "init": { | ||
| "headers": { | ||
| "Content-Type": "application/json", | ||
| "Prefer": "wait" | ||
| }, | ||
| "method": "POST", | ||
| "body": "{\"input\":{\"prompt\":\"black forest gateau cake spelling out the words FLUX SCHNELL, tasty, food photography, dynamic shot\"},\"version\":\"5599ed30703defd1d160a25a63321b4dec97101d98b4674bcc56e41f62f35637\"}" | ||
| }, | ||
| "response": { | ||
| "body": "{\"id\":\"a0fyn914thrj00cmd6e8cd6e14\",\"model\":\"bytedance/sdxl-lightning-4step\",\"version\":\"5599ed30703defd1d160a25a63321b4dec97101d98b4674bcc56e41f62f35637\",\"input\":{\"prompt\":\"black forest gateau cake spelling out the words FLUX SCHNELL, tasty, food photography, dynamic shot\"},\"logs\":\"\",\"output\":[\"https://replicate.delivery/yhqm/f8ALqF3E4myiHqr66Gg765nEhsco4pvr32ABQvZX3fdFaUFUA/out-0.png\"],\"data_removed\":false,\"error\":null,\"status\":\"processing\",\"created_at\":\"2025-01-15T10:57:08.308Z\",\"urls\":{\"cancel\":\"https://api.replicate.com/v1/predictions/a0fyn914thrj00cmd6e8cd6e14/cancel\",\"get\":\"https://api.replicate.com/v1/predictions/a0fyn914thrj00cmd6e8cd6e14\",\"stream\":\"https://stream.replicate.com/v1/files/qoxq-pku5oelao43fx5g5ny4qbdm2qqyf5fqwp5yv26jpxcslw5ufwrtq\"}}", | ||
| "status": 201, | ||
| "statusText": "Created", | ||
| "headers": { | ||
| "alt-svc": "h3=\":443\"; ma=86400", | ||
| "cf-cache-status": "DYNAMIC", | ||
| "cf-ray": "902557da19120198-CDG", | ||
| "connection": "keep-alive", | ||
| "content-type": "application/json; charset=UTF-8", | ||
| "nel": "{\"success_fraction\":0,\"report_to\":\"cf-nel\",\"max_age\":604800}", | ||
| "preference-applied": "wait=60", | ||
| "ratelimit-remaining": "599", | ||
| "ratelimit-reset": "1", | ||
| "report-to": "{\"endpoints\":[{\"url\":\"https:\\/\\/a.nel.cloudflare.com\\/report\\/v4?s=dJWB5mgkALTqjarim6D5LybEWWkOtTzyTu4kxPRj%2FzVGVi%2BAmI0GsIe47bjsScWSZIIfuSe0XRTCtS3%2FW00TqVqiOT%2BmtKxvY903AZFVatuU2qx5IfRi1wE41l%2BlKyRMkjqs\"}],\"group\":\"cf-nel\",\"max_age\":604800}", | ||
| "server": "cloudflare", | ||
| "server-timing": "cfL4;desc=\"?proto=TCP&rtt=4793&min_rtt=3728&rtt_var=2159&sent=4&recv=5&lost=0&retrans=0&sent_bytes=2847&recv_bytes=1013&delivery_rate=776824&cwnd=251&unsent_bytes=0&cid=c3db321825f7d0a3&ts=1415&x=0\"", | ||
| "strict-transport-security": "max-age=15552000", | ||
| "vary": "Accept-Encoding" | ||
| } | ||
| } | ||
| }, | ||
| "a3b664767cd6d4e44d76a7b3870730f789f02f3d05af00a26f4418c59c6b6cbc": { | ||
| "url": "https://replicate.delivery/yhqm/f8ALqF3E4myiHqr66Gg765nEhsco4pvr32ABQvZX3fdFaUFUA/out-0.png", | ||
| "init": {}, | ||
| "response": { | ||
| "body": "", | ||
| "status": 200, | ||
| "statusText": "OK", | ||
| "headers": { | ||
| "accept-ranges": "bytes", | ||
| "access-control-allow-origin": "*", | ||
| "alt-svc": "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000", | ||
| "cache-control": "public,max-age=3600", | ||
| "cache-id": "PAR-31976c84", | ||
| "cache-status": "miss", | ||
| "content-type": "image/png", | ||
| "etag": "\"0e4e24383e70701c57477916dbc681de\"", | ||
| "last-modified": "Wed, 15 Jan 2025 10:57:09 GMT", | ||
| "server": "UploadServer" | ||
| } | ||
| } |
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.
Generated with:
VCR_MODE=cache pnpm run test
aykutkardas
pushed a commit
to gokayfem/huggingface.js
that referenced
this pull request
Jan 20, 2025
…odels (huggingface#1106) This PR updates the Replicate integration to support running both versioned and unversioned models via API. ### Versioned models The vast majority of models on Replicate are [versioned](https://replicate.com/docs/topics/models/versions). Each time a model author publishes changes to the model, a new version is created with a new 64-character SHA identifier. You have to specify a model's version by ID when running them with the API. Versioned models use the following HTTP API endpoint: ``` POST /v1/predictions ``` ☝🏼 This endpoint expects a `version` in the body of the request. See https://replicate.com/docs/reference/http#predictions.create ### Unversioned models Some models on Replicate like [black-forest-labs/flux-schnell](https://replicate.com/black-forest-labs/flux-schnell) are _unversioned_. Replicate staff maintains these as evergreen models, improving their performance and fixing bugs while maintaining API compatibility, so users know they're always running the latest and greatest. Unversioned models have their own HTTP API endpoint: ``` POST /v1/models/{owner}/{model}/predictions ``` See https://replicate.com/docs/reference/http#models.predictions.create --------- Co-authored-by: SBrandeis <simon@huggingface.co>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR updates the Replicate integration to support running both versioned and unversioned models via API.
Versioned models
The vast majority of models on Replicate are versioned. Each time a model author publishes changes to the model, a new version is created with a new 64-character SHA identifier. You have to specify a model's version by ID when running them with the API.
Versioned models use the following HTTP API endpoint:
☝🏼 This endpoint expects a
versionin the body of the request.See https://replicate.com/docs/reference/http#predictions.create
Unversioned models
Some models on Replicate like black-forest-labs/flux-schnell are unversioned. Replicate staff maintains these as evergreen models, improving their performance and fixing bugs while maintaining API compatibility, so users know they're always running the latest and greatest.
Unversioned models have their own HTTP API endpoint:
See https://replicate.com/docs/reference/http#models.predictions.create