I'm fine-tuning a BERT model using Hugging Face, Keras, Tensorflow libraries.
Since yesterday I'm getting this error running my code in Google Colab. The odd thing is that the code used to run without any problem and suddenly started to throw this error. What is even more suspicious is that the code runs without problems in my Apple M1 tensorflow configuration. Again, I did not change anything to my code, but now the code can't run in Google Colab although it used to run with no problems whatsoever.
Both environments have tensorflow 2.6.0
I created the code below for reproducibility of the error. I hope you can shed some light on this.
!pip install transformers
!pip install datasets
import pandas as pd
import numpy as np
import tensorflow as tf
from transformers import AutoTokenizer
from datasets import Dataset
# dummy sentences
sentences = ['the house is blue and big', 'this is fun stuff','what a horrible thing to say']
# create a pandas dataframe and converto to Hugging Face dataset
df = pd.DataFrame({'Text': sentences})
dataset = Dataset.from_pandas(df)
#download bert tokenizer
tokenizer = AutoTokenizer.from_pretrained('bert-base-uncased')
# tokenize each sentence in dataset
dataset_tok = dataset.map(lambda x: tokenizer(x['Text'], truncation=True, padding=True, max_length=10), batched=True)
# remove original text column and set format
dataset_tok = dataset_tok.remove_columns(['Text']).with_format('tensorflow')
# extract features
features = {x: dataset_tok[x].to_tensor() for x in tokenizer.model_input_names}