'ValueError: No gradients provided for any variable Huggingface

Hi I am following the Huggingface course for Question Answering.

I built my own Dataset and all the features are present and I get the exact same results up until fitting the model. There I get the above error. After some research it seems this is caused by not having the columns in the correct order.

The tokenizer does output it in a different order and I changed it, but neither the order in the course nor the order of the tokenizer seem to work.

Can someone think of another issue? I don't have the Data Collator as it's deprecated now. Token Type Ids are commented out because the tokenizer does not return them. I'm using "distilbert-base-cased-distilled-squad" because I just want to try and that seems like the fastest (smallest) model.

tf_train_dataset = train_dataset.to_tf_dataset(
    columns=[
        "attention_mask",
        "end_positions",
        "input_ids",
        "start_positions",
        #"token_type_ids",
    ],
    shuffle=True,
    batch_size=4,
)

Thank you very much!

edit: I get the same error with the model from the tutorial.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source