nkrnrnk / BertPunc

SOTA punctation restoration (for e.g. automatic speech recognition) deep learning model based on BERT pre-trained model
Apache License 2.0
179 stars 43 forks source link

How apply inference on text of length less than then segment size? #9

Open venkateshvayyavuru opened 3 years ago

venkateshvayyavuru commented 3 years ago

Hi, I have trained the model with segment size of 32. Now i want to apply the inference on unpuntucated text of length less than the segment size. I got struck here, can anyone help me for the same.

Thanks in advance, Venkatesh

Adam-fei commented 3 years ago

hi, have you got the idea? I have the same problem. Thx

kotikkonstantin commented 3 years ago

@venkateshvayyavuru @Adam-fei Hi guys! I hope you are doing well! For resolving this problem, you can take a look at https://github.com/kotikkonstantin/ru-autopunctuation/blob/master/inference.py (def make_single_text_pred)

Adam-fei commented 3 years ago

@kotikkonstantin @venkateshvayyavuru Thx a lot! I've already solved this problem by simply repeating the text itself to meet the min infer length. And trim the output into the original text length. It worked fine~