declare-lab / MELD

MELD: A Multimodal Multi-Party Dataset for Emotion Recognition in Conversation
GNU General Public License v3.0
789 stars 200 forks source link

ValueError: "input_length" is 33, but received input has shape (None, 50) #15

Closed ajinkyabedekar closed 4 years ago

ajinkyabedekar commented 4 years ago

I am trying to run the baseline.py file to test the model for Emotion classification and text modality by using the already trained models (the source of which were provided in the README file).

I am using the following command: python baseline.py -classify Emotion -modality text -test

The error that I am getting after running this command is as follows:

Using TensorFlow backend.
Model initiated for Emotion classification
Loading data
Labels used for this classification:  {'neutral': 0, 'surprise': 1, 'fear': 2, 'sadness': 3, 'joy': 4, 'disgust': 5, 'anger': 6}
Traceback (most recent call last):
  File "baseline.py", line 286, in <module>
    model.test_model()
  File "baseline.py", line 234, in test_model
    model = load_model(self.PATH)
  File "C:\Program Files\Python37\lib\site-packages\keras\engine\saving.py", line 492, in load_wrapper
    return load_function(*args, **kwargs)
  File "C:\Program Files\Python37\lib\site-packages\keras\engine\saving.py", line 584, in load_model
    model = _deserialize_model(h5dict, custom_objects, compile)
  File "C:\Program Files\Python37\lib\site-packages\keras\engine\saving.py", line 274, in _deserialize_model
    model = model_from_config(model_config, custom_objects=custom_objects)
  File "C:\Program Files\Python37\lib\site-packages\keras\engine\saving.py", line 627, in model_from_config
    return deserialize(config, custom_objects=custom_objects)
  File "C:\Program Files\Python37\lib\site-packages\keras\layers\__init__.py", line 168, in deserialize
    printable_module_name='layer')
  File "C:\Program Files\Python37\lib\site-packages\keras\utils\generic_utils.py", line 147, in deserialize_keras_object
    list(custom_objects.items())))
  File "C:\Program Files\Python37\lib\site-packages\keras\engine\network.py", line 1075, in from_config
    process_node(layer, node_data)
  File "C:\Program Files\Python37\lib\site-packages\keras\engine\network.py", line 1025, in process_node
    layer(unpack_singleton(input_tensors), **kwargs)
  File "C:\Program Files\Python37\lib\site-packages\keras\engine\base_layer.py", line 506, in __call__
    output_shape = self.compute_output_shape(input_shape)
  File "C:\Program Files\Python37\lib\site-packages\keras\layers\embeddings.py", line 136, in compute_output_shape
    (str(self.input_length), str(input_shape)))
ValueError: "input_length" is 33, but received input has shape (None, 50)

Can someone please help me resolve this issue?

YananSunn commented 2 years ago

I am trying to run the baseline.py file to test the model for Emotion classification and text modality by using the already trained models (the source of which were provided in the README file).

I am using the following command: python baseline.py -classify Emotion -modality text -test

The error that I am getting after running this command is as follows:

Using TensorFlow backend.
Model initiated for Emotion classification
Loading data
Labels used for this classification:  {'neutral': 0, 'surprise': 1, 'fear': 2, 'sadness': 3, 'joy': 4, 'disgust': 5, 'anger': 6}
Traceback (most recent call last):
  File "baseline.py", line 286, in <module>
    model.test_model()
  File "baseline.py", line 234, in test_model
    model = load_model(self.PATH)
  File "C:\Program Files\Python37\lib\site-packages\keras\engine\saving.py", line 492, in load_wrapper
    return load_function(*args, **kwargs)
  File "C:\Program Files\Python37\lib\site-packages\keras\engine\saving.py", line 584, in load_model
    model = _deserialize_model(h5dict, custom_objects, compile)
  File "C:\Program Files\Python37\lib\site-packages\keras\engine\saving.py", line 274, in _deserialize_model
    model = model_from_config(model_config, custom_objects=custom_objects)
  File "C:\Program Files\Python37\lib\site-packages\keras\engine\saving.py", line 627, in model_from_config
    return deserialize(config, custom_objects=custom_objects)
  File "C:\Program Files\Python37\lib\site-packages\keras\layers\__init__.py", line 168, in deserialize
    printable_module_name='layer')
  File "C:\Program Files\Python37\lib\site-packages\keras\utils\generic_utils.py", line 147, in deserialize_keras_object
    list(custom_objects.items())))
  File "C:\Program Files\Python37\lib\site-packages\keras\engine\network.py", line 1075, in from_config
    process_node(layer, node_data)
  File "C:\Program Files\Python37\lib\site-packages\keras\engine\network.py", line 1025, in process_node
    layer(unpack_singleton(input_tensors), **kwargs)
  File "C:\Program Files\Python37\lib\site-packages\keras\engine\base_layer.py", line 506, in __call__
    output_shape = self.compute_output_shape(input_shape)
  File "C:\Program Files\Python37\lib\site-packages\keras\layers\embeddings.py", line 136, in compute_output_shape
    (str(self.input_length), str(input_shape)))
ValueError: "input_length" is 33, but received input has shape (None, 50)

Can someone please help me resolve this issue?

Hi, I also met the error. Did you solve it? If so, could you tell me what did you do to fix the error?... Thanks a lot!