Search code examples
deep-learningdata-sciencehuggingface-transformershuggingface-tokenizershuggingface-datasets

HUGGINGFACE TypeError: '>' not supported between instances of 'NoneType' and 'int'


I am working on Fine-Tuning Pretrained Model on custom (using HuggingFace) dataset I will copy all code correctly from the one youtube video everything is ok but in this cell/code:

with training_args.strategy.scope():
    model=TFDistilBertForSequenceClassification.from_pretrained("distilbert-base-uncased")

    trainer = TFTrainer(model=model,     # the instantiated 🤗 Transformers model to be trained
    args=training_args,                  # training arguments, defined above
    train_dataset=train_dataset,         # training dataset
    eval_dataset=test_dataset)           # evaluation dataset


    trainer.train()

It will give me this error:

TypeError: '>' not supported between instances of 'NoneType' and 'int'

Solution

  • Seems to be an issue with the new version of transformers.

    Installing version 4.6.0 worked for me.

    pip install transformers==4.6.0