alibidaran commited on
Commit
8a82af7
1 Parent(s): 3efe14a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -10,7 +10,8 @@ def generate_text(Text,Max_length,Temperature):
10
  tokenizer.pad_token_id=tokenizer.eos_token_id
11
  with torch.no_grad():
12
  input_ids = tokenizer(Text, return_tensors="pt")["input_ids"].to('cpu')
13
- output=model.generate(input_ids,max_new_tokens=Max_length,do_sample=True, temperature=Temperature, top_p=0.90,top_k=10)
 
14
  return tokenizer.decode(output[0])
15
  demo=gr.Interface(
16
  generate_text,
 
10
  tokenizer.pad_token_id=tokenizer.eos_token_id
11
  with torch.no_grad():
12
  input_ids = tokenizer(Text, return_tensors="pt")["input_ids"].to('cpu')
13
+ attn_mask=tokenizer(Text, return_tensors="pt")["attention_mask"].to('cpu')
14
+ output=model.generate(input_ids=input_ids,attention_mask=attn_mask,max_new_tokens=Max_length,do_sample=True, temperature=Temperature, top_p=0.90,top_k=10)
15
  return tokenizer.decode(output[0])
16
  demo=gr.Interface(
17
  generate_text,