- Notifications
You must be signed in to change notification settings - Fork539
[Inference] Add async polling support for Replicate provider#1816
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
[Inference] Add async polling support for Replicate provider#1816
Uh oh!
There was an error while loading.Please reload this page.
Conversation
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.
thanks@lucataco for the PR! I left some comments
| constprediction=(awaitpollResponse.json())asReplicateAsyncResponse; | ||
| constpredictionStatus=prediction.status; | ||
| if(!predictionStatus||predictionStatus==="succeeded"){ |
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.
is it intentional to treat "no status" as a successful response?
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.
I think we have to removePrefer: wait from the headers (defined inprepareHeaders) now that all the tasks are using async polling
| output?:string|string[]; | ||
| } | ||
| typeReplicatePredictionStatus="starting"|"processing"|"succeeded"|"failed"|"canceled"|"queued"; |
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.
i believe this gives tighter typings and better autocomplete support
| typeReplicatePredictionStatus="starting"|"processing"|"succeeded"|"failed"|"canceled"|"queued"; | |
| constREPLICATE_STATUSES=[ | |
| "starting", | |
| "processing", | |
| "succeeded", | |
| "failed", | |
| "canceled", | |
| "queued", | |
| ]asconst; | |
| typeReplicatePredictionStatus=(typeofREPLICATE_STATUSES)[number]; |
This PR adds async polling for Replicate
To help the huggingface team so that they no longer need an allow-list of Replicate models to show Hub users
@SBrandeis