-
Notifications
You must be signed in to change notification settings - Fork 19.6k
Open
Labels
type:supportUser is asking for help / asking an implementation question. Stackoverflow would be better suited.User is asking for help / asking an implementation question. Stackoverflow would be better suited.
Description
tf_keras==2.20.1
self._model = TFDistilBertForTokenClassification.from_pretrained('models/NameEntityRecognition', num_labels=len(self._unique_tags))
self._model.compile(optimizer=Adam(learning_rate=self._learning_rate), loss=self._model.hf_compute_loss, metrics=['accuracy'])
I have tried os.environ['TF_USE_LEGACY_KERAS'] = '1'
but to no avail.
File "/usr/src/Python/pAIthon/NameEntityRecognition.py", line 52, in BuildTrainModel
self._model.compile(optimizer=Adam(learning_rate=self._learning_rate), loss=self._model.hf_compute_loss, metrics=['accuracy']) # can also use any keras loss fn
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/khteh/.local/share/virtualenvs/pAIthon-GaqEDHQT/lib/python3.13/site-packages/transformers/modeling_tf_utils.py", line 1547, in compile
super().compile(
~~~~~~~~~~~~~~~^
optimizer=optimizer,
^^^^^^^^^^^^^^^^^^^^
...<6 lines>...
**kwargs,
^^^^^^^^^
)
^
File "/home/khteh/.local/share/virtualenvs/pAIthon-GaqEDHQT/lib/python3.13/site-packages/tf_keras/src/utils/traceback_utils.py", line 70, in error_handler
raise e.with_traceback(filtered_tb) from None
File "/home/khteh/.local/share/virtualenvs/pAIthon-GaqEDHQT/lib/python3.13/site-packages/tf_keras/src/optimizers/__init__.py", line 335, in get
raise ValueError(
f"Could not interpret optimizer identifier: {identifier}"
)
ValueError: Could not interpret optimizer identifier: <keras.src.optimizers.adam.Adam object at 0x7e2fc0491010>
Metadata
Metadata
Assignees
Labels
type:supportUser is asking for help / asking an implementation question. Stackoverflow would be better suited.User is asking for help / asking an implementation question. Stackoverflow would be better suited.