Skip to content

replicate.run() does not respect wait=False #411

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

Open
zeke opened this issue Feb 14, 2025 · 1 comment
Open

replicate.run() does not respect wait=False #411

zeke opened this issue Feb 14, 2025 · 1 comment
Assignees

Comments

@zeke
Copy link
Member

zeke commented Feb 14, 2025

Client version: 1.0.4

This snippet blocks until the prediction is done:

import replicate

print("starting")
output = replicate.run(
    "tencent/hunyuan-video:6c9132aee14409cd6568d030453f1ba50f5f3412b844fe67f78a9eb62d55664f",
    input={"prompt": "A cat walks on the grass, realistic style"},
    wait=False
)
print(output.__dict__)
print("done")

I'm not really sure what the expected behavior should be here...

The current docs in the README say this:

The timeout can be configured by passing wait=x to replicate.run() where x is a timeout
in seconds between 1 and 60. To disable the sync mode you can pass wait=False.

If you're disabling sync mode with replicate.run, where does that leave you? Async mode? What should it return?

cc @hbqdev

@zeke zeke changed the title replicate.run does not respect wait=False replicate.run() does not respect wait=False Feb 14, 2025
@aron
Copy link
Contributor

aron commented Feb 17, 2025

replicate.run has always had a blocking interface at the SDK layer. To create a prediction and return the Prediction object before it completes you need to use the predictions.create() interfaces.

The wait param to run() just controls whether the client attempts to keep the HTTP connection open or uses polling. I can see how the name is confusing.

@aron aron self-assigned this Feb 17, 2025
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

No branches or pull requests

2 participants