-
Notifications
You must be signed in to change notification settings - Fork 205
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This PR extends #325 to add the prediction object itself to `ModelError`, as opposed to just its ID. This makes it convenient to introspect logs and other information to determine how to handle the failure. ```python import replicate from replicate.exceptions import ModelError try: output = replicate.run("stability-ai/stable-diffusion-3", { "prompt": "..." }) except ModelError as e if "(some known issue)" in e.logs: pass print("Failed prediction: " + e.prediction.id) ``` --------- Signed-off-by: Rohan Mehta <[email protected]> Signed-off-by: Mattt Zmuda <[email protected]> Co-authored-by: Rohan Mehta <[email protected]>
- Loading branch information
1 parent
ecfedfb
commit 71c124d
Showing
5 changed files
with
102 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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