Update handler.py
Browse files- handler.py +2 -0
handler.py
CHANGED
@@ -18,4 +18,6 @@ class EndpointHandler:
|
|
18 |
# ignoring parameters! Default to configs in generation_config.json.
|
19 |
messages = [{"role": "user", "content": inputs}]
|
20 |
response = self.model.chat(self.tokenizer, messages)
|
|
|
|
|
21 |
return [{'generated_text': response}]
|
|
|
18 |
# ignoring parameters! Default to configs in generation_config.json.
|
19 |
messages = [{"role": "user", "content": inputs}]
|
20 |
response = self.model.chat(self.tokenizer, messages)
|
21 |
+
if torch.backends.mps.is_available():
|
22 |
+
torch.mps.empty_cache()
|
23 |
return [{'generated_text': response}]
|