ValueError: initial_value must be specified

Viewed 18

I am using arabertV2 to fine tune it for sentiment analysis task.

I have cloned the hugging face repo here using:

git lfs clone https://huggingface.co/aubmindlab/bert-base-arabertv2

To this this out, I am using the below code:

model_name = "bert-base-arabertv2"
bert_tokenizer = BertTokenizer.from_pretrained(model_name)

bert_model = TFBertForSequenceClassification.from_pretrained(model_name)

optimizer = tf.keras.optimizers.Adam(learning_rate=3e-5, epsilon=1e-08, clipnorm=1.0)
loss = tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True)
metric = tf.keras.metrics.SparseCategoricalAccuracy('accuracy')


bert_model.compile( optimizer=optimizer, metrics=[metric], loss=loss )

When I am compiling the model, I get this error

I am not sure why compiling the model should cause this here, the error is very ambiguous and does not tell much.

0 Answers
Related