jayyap commited on
Commit
d93c571
·
1 Parent(s): fe90019

Update handler.py

Browse files
Files changed (1) hide show
  1. handler.py +2 -0
handler.py CHANGED
@@ -16,6 +16,8 @@ class EndpointHandler():
16
  def __init__(self, path=""):
17
  self.pipeline = DiffusionPipeline.from_pretrained("CompVis/ldm-super-resolution-4x-openimages", torch_dtype=dtype).to(device)
18
 
 
 
19
 
20
  def __call__(self, data: Any) -> List[List[Dict[str, float]]]:
21
  image = data.pop("image", None)
 
16
  def __init__(self, path=""):
17
  self.pipeline = DiffusionPipeline.from_pretrained("CompVis/ldm-super-resolution-4x-openimages", torch_dtype=dtype).to(device)
18
 
19
+ # this command loads the individual model components on GPU on-demand.
20
+ self.pipeline.enable_model_cpu_offload()
21
 
22
  def __call__(self, data: Any) -> List[List[Dict[str, float]]]:
23
  image = data.pop("image", None)