Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -11,8 +11,8 @@ model = AutoModelForSeq2SeqLM.from_pretrained(model_dir)
|
|
| 11 |
def mask_generation(text):
|
| 12 |
import re
|
| 13 |
inputs = ["Mask Generation: " + text]
|
| 14 |
-
inputs = tokenizer(inputs,max_length=128, truncation=True, return_tensors="pt")
|
| 15 |
-
output = model.generate(**inputs, num_beams=8, do_sample=True,
|
| 16 |
decoded_output = tokenizer.batch_decode(output, skip_special_tokens=True)[0]
|
| 17 |
predicted_title = decoded_output.strip()
|
| 18 |
pattern = r'\[.*?\]'
|
|
|
|
| 11 |
def mask_generation(text):
|
| 12 |
import re
|
| 13 |
inputs = ["Mask Generation: " + text]
|
| 14 |
+
inputs = tokenizer(inputs, max_length=128, truncation=True, return_tensors="pt")
|
| 15 |
+
output = model.generate(**inputs, num_beams=8, do_sample=True, max_length=len(text))
|
| 16 |
decoded_output = tokenizer.batch_decode(output, skip_special_tokens=True)[0]
|
| 17 |
predicted_title = decoded_output.strip()
|
| 18 |
pattern = r'\[.*?\]'
|