mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2024-12-27 15:44:12 +08:00
Add EOS token at end of sentence to prevent repetition. (#490)
Fix repetition at the end of sentence by adding a <EOS> token id.
This commit is contained in:
parent
734e6782d7
commit
f06244e125
@ -158,6 +158,7 @@ class TS(basetrans):
|
||||
)
|
||||
input_ids_len = n_tokens.value
|
||||
input_ids_py = [token_ids[i] for i in range(input_ids_len)]
|
||||
input_ids_py += [1] # add EOS token to notify the end of sentence and prevent repetition
|
||||
return input_ids_py
|
||||
|
||||
def decode_from_ids(self, output_ids_py):
|
||||
|
Loading…
x
Reference in New Issue
Block a user