Prior to 1.0.0 replicate.run() would return an iterator for cog models that output a type of Iterator[Any]. This would poll the predictions.get endpoint for the in progress prediction and yield any new output.
When implementing the new file interface we introduced two bugs:
The iterator didn't convert URLs returned by the model into FileOutput types making it inconsistent with the non-iterator interface. This is controlled by the use_file_outputs argument.
The iterator was returned without checking if we are using the new blocking API introduced by default and controlled by the wait argument.
This commit fixes these two issues, consistently applying the transform_output function to the output of the iterator as well as returning the polling iterator (prediciton.output_iterator) if the blocking API has not successfully returned a completed prediction.
The tests have been updated to exercise both of these code paths.
Prior to 1.0.0
replicate.run()
would return an iterator for cog models that output a type ofIterator[Any]
. This would poll thepredictions.get
endpoint for the in progress prediction and yield any new output.When implementing the new file interface we introduced two bugs:
FileOutput
types making it inconsistent with the non-iterator interface. This is controlled by theuse_file_outputs
argument.wait
argument.This commit fixes these two issues, consistently applying the
transform_output
function to the output of the iterator as well as returning the polling iterator (prediciton.output_iterator
) if the blocking API has not successfully returned a completed prediction.The tests have been updated to exercise both of these code paths.