Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
@@ -13,8 +13,9 @@ model_dir_large = 'edithram23/Redaction_Personal_info_v1'
|
|
13 |
tokenizer_large = AutoTokenizer.from_pretrained(model_dir_large)
|
14 |
model_large = AutoModelForSeq2SeqLM.from_pretrained(model_dir_large)
|
15 |
|
16 |
-
def mask_generation(text,model=model_small,tokenizer=tokenizer_small,max_len=128
|
17 |
import re
|
|
|
18 |
inputs = ["Mask Generation: " + text]
|
19 |
inputs = tokenizer(inputs, max_length=max_len, truncation=True, return_tensors="pt")
|
20 |
output = model.generate(**inputs, num_beams=8, do_sample=True, max_length=max_len2)
|
|
|
13 |
tokenizer_large = AutoTokenizer.from_pretrained(model_dir_large)
|
14 |
model_large = AutoModelForSeq2SeqLM.from_pretrained(model_dir_large)
|
15 |
|
16 |
+
def mask_generation(text,model=model_small,tokenizer=tokenizer_small,max_len=128):
|
17 |
import re
|
18 |
+
max_len2=len(text)
|
19 |
inputs = ["Mask Generation: " + text]
|
20 |
inputs = tokenizer(inputs, max_length=max_len, truncation=True, return_tensors="pt")
|
21 |
output = model.generate(**inputs, num_beams=8, do_sample=True, max_length=max_len2)
|