PhantHive commited on
Commit
dea9964
·
verified ·
1 Parent(s): cd5c270

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -1
app.py CHANGED
@@ -24,7 +24,7 @@ model = PeftModel.from_pretrained(model, model_id)
24
 
25
  def greet(text):
26
  with torch.no_grad(): # Disable gradient calculation for inference
27
- batch = tokenizer(f'### Input:\n{text}\n\n### Answer:\n', return_tensors='pt') # Move tensors to device
28
  with torch.cuda.amp.autocast(): # Enable mixed-precision if available
29
  output_tokens = model.generate(**batch, max_new_tokens=25)
30
  return tokenizer.decode(output_tokens[0], skip_special_tokens=True)
 
24
 
25
  def greet(text):
26
  with torch.no_grad(): # Disable gradient calculation for inference
27
+ batch = tokenizer(f'### Input:\n{text}\n\n### Answer:', return_tensors='pt') # Move tensors to device
28
  with torch.cuda.amp.autocast(): # Enable mixed-precision if available
29
  output_tokens = model.generate(**batch, max_new_tokens=25)
30
  return tokenizer.decode(output_tokens[0], skip_special_tokens=True)