Ich kann es zum Laufen bringen. setup.
The code works with the following (old) setup:
- tf version: 2.13.0
- keras version: 2.13.1
- transformers version: 4.33.3
- Python: 3.8.10
tf fusion: 2.16.16.16.16.16.16.16.16.16.16.16.16.16.16.16.16.16.16.16.16.16. Version: 3.3.2 < /li>
Transformatoren Version: 4.39.3 < /li>
Python 3.11.5 < /li>
< />
Code: Select all
import tensorflow as tf
from transformers import ElectraTokenizer, TFElectraModel
from tensorflow.keras.optimizers import Adam # if I include this line (regardless if I use Adam in the code) I get the error.
model = TFElectraModel.from_pretrained('deepset/gelectra-base')
inputs = tf.keras.layers.Input(shape=(40,), dtype='int32')
electra_output = model(inputs)[0]
< /code>
Ich erhalte immer den gleichen Fehler, sobald ich TensorFlow.keras.Soming mit dem aktuellen Setup < /p>
eingeschlossen habe. < /p>
ValueError Traceback (most recent call last)
Cell In[3], line 7
4 inputs = tf.keras.layers.Input(shape=(40,), dtype='int32')
5 # inputs = Input(shape=(40,), dtype='int32')
----> 7 electra_output = model(inputs)[0]
File ~/.local/anaconda3/lib/python3.11/site-packages/tf_keras/src/utils/traceback_utils.py:70, in filter_traceback..error_handler(*args, **kwargs)
67 filtered_tb = _process_traceback_frames(e.__traceback__)
68 # To get the full stack trace, call:
69 # `tf.debugging.disable_traceback_filtering()`
---> 70 raise e.with_traceback(filtered_tb) from None
71 finally:
72 del filtered_tb
File ~/.local/anaconda3/lib/python3.11/site-packages/transformers/modeling_tf_utils.py:436, in unpack_inputs..run_call_with_unpacked_inputs(self, *args, **kwargs)
433 else:
434 config = self.config
--> 436 unpacked_inputs = input_processing(func, config, **fn_args_and_kwargs)
437 return func(self, **unpacked_inputs)
File ~/.local/anaconda3/lib/python3.11/site-packages/transformers/modeling_tf_utils.py:566, in input_processing(func, config, **kwargs)
564 output[main_input_name] = main_input
565 else:
--> 566 raise ValueError(
567 f"Data of type {type(main_input)} is not allowed only {allowed_types} is accepted for"
568 f" {main_input_name}."
569 )
571 # Populates any unspecified argument with their default value, according to the signature.
572 for name in parameter_names:
ValueError: Exception encountered when calling layer 'tf_electra_model_1' (type TFElectraModel).
Data of type is not allowed only (, , , , , , , ) is accepted for input_ids.
Call arguments received by layer 'tf_electra_model_1' (type TFElectraModel):
• input_ids=
• attention_mask=None
• token_type_ids=None
• position_ids=None
• head_mask=None
• inputs_embeds=None
• encoder_hidden_states=None
• encoder_attention_mask=None
• past_key_values=None
• use_cache=None
• output_attentions=None
• output_hidden_states=None
• return_dict=None
• training=False