krishnaik06 / Huggingfacetransformer

GNU General Public License v3.0
59 stars 97 forks source link

TypeError: Exception encountered when calling layer "tf_distil_bert_for_sequence_classification" (type TFDistilBertForSequenceClassification). TypeError: 'NoneType' object is not callable #4

Open JafirDon opened 2 years ago

JafirDon commented 2 years ago

TypeError Traceback (most recent call last)

in () 9 ) 10 ---> 11 trainer.train() 2 frames /usr/local/lib/python3.7/dist-packages/tensorflow/python/framework/func_graph.py in autograph_handler(*args, **kwargs) 1145 except Exception as e: # pylint:disable=broad-except 1146 if hasattr(e, "ag_error_metadata"): -> 1147 raise e.ag_error_metadata.to_exception(e) 1148 else: 1149 raise TypeError: in user code: File "/usr/local/lib/python3.7/dist-packages/transformers/trainer_tf.py", line 697, in distributed_training_steps * self.args.strategy.run(self.apply_gradients, inputs) File "/usr/local/lib/python3.7/dist-packages/transformers/trainer_tf.py", line 639, in apply_gradients * gradients = self.training_step(features, labels, nb_instances_in_global_batch) File "/usr/local/lib/python3.7/dist-packages/transformers/trainer_tf.py", line 622, in training_step * per_example_loss, _ = self.run_model(features, labels, True) File "/usr/local/lib/python3.7/dist-packages/transformers/trainer_tf.py", line 744, in run_model * outputs = self.model(features, labels=labels, training=training)[:2] File "/usr/local/lib/python3.7/dist-packages/keras/utils/traceback_utils.py", line 67, in error_handler ** raise e.with_traceback(filtered_tb) from None TypeError: Exception encountered when calling layer "tf_distil_bert_for_sequence_classification" (type TFDistilBertForSequenceClassification). in user code: File "/usr/local/lib/python3.7/dist-packages/transformers/models/distilbert/modeling_tf_distilbert.py", line 816, in call * loss = None if inputs["labels"] is None else self.compute_loss(inputs["labels"], logits) File "/usr/local/lib/python3.7/dist-packages/keras/engine/training.py", line 919, in compute_loss ** y, y_pred, sample_weight, regularization_losses=self.losses) TypeError: 'NoneType' object is not callable Call arguments received: • input_ids={'input_ids': 'tf.Tensor(shape=(8, 238), dtype=int32)', 'attention_mask': 'tf.Tensor(shape=(8, 238), dtype=int32)'} • attention_mask=None • head_mask=None • inputs_embeds=None • output_attentions=None • output_hidden_states=None • return_dict=None • labels=tf.Tensor(shape=(8,), dtype=int32) • training=True • kwargs=
abkafi1234 commented 2 years ago

same here. running on m1 mac

shanny-day commented 1 year ago

I am experiencing similar issues

Asma-Rafique commented 10 months ago

i am also facing the same issue