`replicate.run()` does not respect `wait=False`
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=xtoreplicate.run()wherexis a timeout in seconds between 1 and 60. To disable the sync mode you can passwait=False.
If you're disabling sync mode with replicate.run, where does that leave you? Async mode? What should it return?
cc @hbqdev
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.