We have finetuned our BERT model for text2text generation. It is working fine on the Jupyter notebook. But when I use the same trained model on another server of Ubuntu, then it shows the issue. This is my first post, so please bear with me. The issue I'm facing is that when I generate output on small sentences, it works fine. But on long sentences, it shows the following error:
At most 4 tokens in tensor([ 2, 2, 2, 2, 44763, 44763, 2, 44763]) can be equal to
eos_token_id: 2
. Make sure tensor([ 2, 2, 2, 2, 44763, 44763, 2, 44763]) are corrected.
My output generation code is:
from simpletransformers.seq2seq import Seq2SeqModel
#logging.basicConfig(level=logging.INFO)
#transformers_logger = logging.getLogger("transformers")
#transformers_logger.setLevel(logging.ERROR)
model = Seq2SeqModel(
encoder_decoder_type="bart", encoder_decoder_name="PATHOFMODEL",use_cuda=False,
)
while True:
original = input("Enter text to paraphrase: ")
to_predict = [original]
preds = model.predict(to_predict)
print("---------------------------------------------------------")
print(original)
print()
print("Predictions >>>")
for pred in preds[0]:
print(pred)
print("---------------------------------------------------------")
print()