Melissa Roemmele commited on
Commit ·
fbc6b9c
1
Parent(s): 7d19a12
Updated handler.py
Browse files- handler.py +1 -1
handler.py
CHANGED
|
@@ -17,9 +17,9 @@ class EndpointHandler:
|
|
| 17 |
device=device)
|
| 18 |
|
| 19 |
def __call__(self, data: Dict[str, Any]) -> Dict[str, str]:
|
|
|
|
| 20 |
inputs = data.pop("inputs", data)
|
| 21 |
parameters = data.pop("parameters", {})
|
| 22 |
with torch.autocast(self.pipeline.device.type, dtype=torch.bfloat16):
|
| 23 |
outputs = self.pipeline(inputs, **parameters, use_cache=True)
|
| 24 |
-
torch.cuda.empty_cache()
|
| 25 |
return outputs
|
|
|
|
| 17 |
device=device)
|
| 18 |
|
| 19 |
def __call__(self, data: Dict[str, Any]) -> Dict[str, str]:
|
| 20 |
+
torch.cuda.empty_cache()
|
| 21 |
inputs = data.pop("inputs", data)
|
| 22 |
parameters = data.pop("parameters", {})
|
| 23 |
with torch.autocast(self.pipeline.device.type, dtype=torch.bfloat16):
|
| 24 |
outputs = self.pipeline(inputs, **parameters, use_cache=True)
|
|
|
|
| 25 |
return outputs
|