TensorFlow error: 'hub.KerasLayer.trainable = True is unsupported when loading from the TF1 Hub format' error when trying to create an EMLo layer

Viewed 21

Hello I am trying to embed an ELMo layer into the model below, but am getting an error stating Setting hub.KerasLayer.trainable = True is unsupported when loading from the TF1 Hub format. How to I resolve this?

I am using tensorflow==2.10.0 and tensorflow_hub>=0.12.0 .

sentences = ["this is a sentence", "i really need this to work"]
train_tensor = tf.convert_to_tensor([sentences])
train_examples = tfds.as_numpy(train_tensor)

model = "https://tfhub.dev/google/elmo/3"
hub_layer = hub.KerasLayer(model, input_shape=[], dtype=tf.string, trainable=True)
hub_layer(train_examples[:3])
0 Answers
Related