WinterGYC commited on
Commit
7de579c
1 Parent(s): ad982b6

Update handler.py

Browse files
Files changed (1) hide show
  1. 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}]