Skip to content

Commit

Permalink
Update handler.py
Browse files Browse the repository at this point in the history
  • Loading branch information
justinmerrell committed Jan 27, 2024
1 parent 93dd1f5 commit cb57900
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@
# If your handler runs inference on a model, load the model here.
# You will want models to be loaded into memory before starting serverless.

pipe = AutoPipelineForText2Image.from_pretrained("stabilityai/sdxl-turbo", torch_dtype=torch.float16, variant="fp16")
pipe.to("cuda")
try:
pipe = AutoPipelineForText2Image.from_pretrained("stabilityai/sdxl-turbo", torch_dtype=torch.float16, variant="fp16")
pipe.to("cuda")
except RuntimeError:
quit()

def handler(job):
""" Handler function that will be used to process jobs. """
Expand Down

0 comments on commit cb57900

Please sign in to comment.