TiberiuCristianLeon commited on
Commit
f115a7c
·
verified ·
1 Parent(s): 94663ef

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -217,7 +217,7 @@ class Translators:
217
  )
218
  # Generate response
219
  temperature = 0.7
220
- with torch.no_grad():
221
  outputs = model.generate(
222
  tokenized_chat.to(model.device),
223
  max_new_tokens=512,
@@ -243,7 +243,7 @@ class Translators:
243
  except Exception as error:
244
  return f"Error translating with model: {self.model_name}! Try other available language combination or model.", error
245
 
246
- def rosetta(self):
247
  model = AutoModelForCausalLM.from_pretrained(
248
  self.model_name,
249
  dtype=torch.bfloat16,
 
217
  )
218
  # Generate response
219
  temperature = 0.7
220
+ with torch.inference_mode():
221
  outputs = model.generate(
222
  tokenized_chat.to(model.device),
223
  max_new_tokens=512,
 
243
  except Exception as error:
244
  return f"Error translating with model: {self.model_name}! Try other available language combination or model.", error
245
 
246
+ def rosetta(self):
247
  model = AutoModelForCausalLM.from_pretrained(
248
  self.model_name,
249
  dtype=torch.bfloat16,