Hello guys,
im trying to use a pretrained models from hugging face to my costume dataset (4 classes),
the problem is that only one model that gave me no errors (distilbert-base-uncased),
but I use other models like Roberta, I got dimensions problems !!! I don’t know how to fix it !
############### here is my code ###################
from transformers import TFRobertaForSequenceClassification, TFAutoModelForSequenceClassification
model = TFRobertaForSequenceClassification.from_pretrained(‘siebert/sentiment-roberta-large-english’,num_labels=4)
optimizer = tf.keras.optimizers.Adam(learning_rate=4e-4)
model.compile(optimizer=optimizer,
loss=tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True),
metrics=tf.metrics.SparseCategoricalAccuracy()) # can also use any keras loss fn
model.fit(train_dataset.batch(16), epochs=30, batch_size=16)
########## here is the error ###################
cannot reshape array of size 2048 into shape (1024,4)
can someone help me plzzzz