Update handler.py
Browse files- handler.py +2 -0
handler.py
CHANGED
|
@@ -68,6 +68,8 @@ class EndpointHandler():
|
|
| 68 |
safety_checker=None).to(device)
|
| 69 |
# Define Generator with seed
|
| 70 |
self.generator = torch.Generator(device="cpu").manual_seed(3)
|
|
|
|
|
|
|
| 71 |
|
| 72 |
def __call__(self, data: Any) -> List[List[Dict[str, float]]]:
|
| 73 |
"""
|
|
|
|
| 68 |
safety_checker=None).to(device)
|
| 69 |
# Define Generator with seed
|
| 70 |
self.generator = torch.Generator(device="cpu").manual_seed(3)
|
| 71 |
+
# this command loads the individual model components on GPU on-demand.
|
| 72 |
+
self.pipe.enable_model_cpu_offload()
|
| 73 |
|
| 74 |
def __call__(self, data: Any) -> List[List[Dict[str, float]]]:
|
| 75 |
"""
|