request help with error: AttributeError: 'SymbolicTensor' object has no attribute 'numpy'

72 views
Skip to first unread message

Tex Cowboy

unread,
Feb 3, 2025, 1:31:49 PMFeb 3
to Keras-users
Hi team,

I trying to run the following sample code  from https://keras.io/keras_hub/api/models/deberta_v3/deberta_v3_masked_lm/

import keras_hub
# KERAS_BACKEND was set to tensorflow or jax
def test_running_deberta_lm():

    features = ["The quick brown fox jumped.", "I forgot my homework."]
    masked_lm = keras_hub.models.DebertaV3MaskedLM.from_preset('deberta_v3_base_en')
    masked_lm.fit(x=features, batch_size=2)
    masked_lm.summary()

if __name__ == '__main__':
    test_running_deberta_lm()

I am using Python 3.11 venv and have installed the latest requirements-jax-cuda.txt from keras-hub.

However, I am getting the following error when running masked_lm.fit(...)

sentence_piece_tokenizer.py", line 172, in vocabulary_size
        return int(self._sentence_piece.vocab_size().numpy())

    AttributeError: 'SymbolicTensor' object has no attribute 'numpy'

I appreciate any tips!

Not sure if this had to do with running eager execution, but this version is set up to run jax...

Thanks in advance








Reply all
Reply to author
Forward
0 new messages