add try-except to replicate

This commit is contained in:
Brett Kuprel 2022-07-07 12:35:00 -04:00
parent 9a4a839b3b
commit b17bea11b6
2 changed files with 24 additions and 18 deletions

2
cog.yaml vendored
View File

@ -1,5 +1,5 @@
build: build:
cuda: "11.5.1" cuda: "11.4"
gpu: true gpu: true
python_version: "3.10" python_version: "3.10"
system_packages: system_packages:

View File

@ -31,6 +31,7 @@ class ReplicatePredictor(BasePredictor):
default=4 default=4
), ),
) -> Iterator[Path]: ) -> Iterator[Path]:
try:
seed = -1 seed = -1
log2_mid_count = 3 if intermediate_outputs else 0 log2_mid_count = 3 if intermediate_outputs else 0
image_stream = self.model.generate_image_stream( image_stream = self.model.generate_image_stream(
@ -49,3 +50,8 @@ class ReplicatePredictor(BasePredictor):
image_path = path / 'min-dalle-iter-{}.jpg'.format(iter) image_path = path / 'min-dalle-iter-{}.jpg'.format(iter)
image.save(str(image_path)) image.save(str(image_path))
yield image_path yield image_path
except:
print("An error occured, deleting model")
del self.model
self.setup()
raise Exception("There was an error, please try again")