Text Classification
TF-Keras
English
hate-speech
counterspeech
irt

Getting An error

#1
by man000000007 - opened

import tensorflow as tf
new_model = tf.keras.models.load_model("model_path")

=========================================================================================================

ValueError: The two structures don't have the same nested structure.

First structure: type=tuple str=(({'input_ids': TensorSpec(shape=(None, 5), dtype=tf.int32, name=None)}, None, None, None, None, None, None, None, None, None, None, None, None, False), {})

Second structure: type=tuple str=((TensorSpec(shape=(None, 256), dtype=tf.int32, name='input_ids'), TensorSpec(shape=(None, 256), dtype=tf.int32, name='attention_mask'), None, None, None, None, None, None, None, None, None, None, None, False), {})

More specifically: Substructure "type=dict str={'input_ids': TensorSpec(shape=(None, 5), dtype=tf.int32, name=None)}" is a sequence, while substructure "type=TensorSpec str=TensorSpec(shape=(None, 256), dtype=tf.int32, name='input_ids')" is not
Entire first structure:
(({'input_ids': .}, ., ., ., ., ., ., ., ., ., ., ., ., .), {})
Entire second structure:
((., ., ., ., ., ., ., ., ., ., ., ., ., .), {})

man000000007 changed discussion title from Getting the below Error to Getting An error
Social Sciences Data Lab at UC Berkeley org

What about the version of the model that Pratik uploaded? https://huggingface.co/ucberkeley-dlab/hate-measure-roberta-base/tree/main

Yes, this one works fine -- thank you so much!

Sign up or log in to comment