Downloads · 30 days
15
3% of all-time downloads
radlab/polish-denoiser-t5-base
polish-denoiser-t5-base is a machine learning model from radlab. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for transformers. The card lists the license as cc-by-sa-4.0.
The presented model can be used for text de-noising. You can use it if you have text that has noise after loading, such as after loading pdf files.
Downloads · 30 days
15
3% of all-time downloads
All-time downloads
532
Public
Parameters
275M
3.3 GB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors1.1 GB · 100%
From the Hugging Face model README
The presented model can be used for text de-noising. You can use it if you have text that has noise after loading, such as after loading pdf files.
The model was learned on texts in Polish. The dataset was automatically noised. allegro/plt5-base was used as the base model.
Model input
Model input must be preceded by the tag denoise: F.e. if you have text:
As | -Tron^# om ia je@st je!d &*ną z na -J s | AA ta rsZy ch n a u k.
then input to the model must be constructed as follows:
denoise: As | -Tron^# om ia je@st je!d &*ną z na -J s | AA ta rsZy ch n a u k.
Sample model usage
from transformers import T5ForConditionalGeneration, T5Tokenizer
def do_inference(text, model, tokenizer):
input_text = f"denoise: {text}"
inputs = tokenizer.encode(
input_text,
return_tensors="pt",
max_length=256,
padding="max_length",
truncation=True,
)
corrected_ids = model.generate(
inputs,
max_length=256,
num_beams=5,
early_stopping=True,
)
corrected_sentence = tokenizer.decode(corrected_ids[0], skip_special_tokens=True)
return corrected_sentence
model = T5ForConditionalGeneration.from_pretrained("radlab/polish-denoiser-t5-base")
tokenizer = T5Tokenizer.from_pretrained("radlab/polish-denoiser-t5-base")
text_str = "As | -Tron^# om ia je@st je!d &*ną z na -J s | AA ta rsZy ch n a u k."
print(do_inference(text_str, model, tokenizer))
Model reponse for input:
denoise: As | -Tron^# om ia je@st je!d &*ną z na -J s | AA ta rsZy ch n a u k.
is:
Astronomia jest jedną z najstarszych nauk.
Evaluation
Eval loss:

More information (in Polish) on our blog