thomeou / SALSA

This is the public repository for eigenvector-based SALSA features for polyphonic sound event localization and detection.
MIT License
91 stars 19 forks source link

LSTM and BI-LSTM hidden size errors #16

Closed Peter-72 closed 2 years ago

Peter-72 commented 2 years ago

In decoders.py, you will find that both lstm and bi-lstm hidden size is assigned the value self.gru_size instead of self.lstm_size:

elif self.decoder_type == 'lstm':
            self.lstm_input_size = n_output_channels
            self.lstm_size = decoder_size
            self.fc_size = self.lstm_size

            self.lstm = nn.LSTM(input_size=self.lstm_input_size, hidden_size=self.gru_size,
                                num_layers=2, batch_first=True, bidirectional=False, dropout=0.3)
            init_gru(self.lstm)
        elif self.decoder_type == 'bilstm':
            self.lstm_input_size = n_output_channels
            self.lstm_size = decoder_size
            self.fc_size = self.lstm_size * 2

            self.lstm = nn.LSTM(input_size=self.lstm_input_size, hidden_size=self.gru_size,
                               num_layers=2, batch_first=True, bidirectional=True, dropout=0.3)

which will cause AttributeError: 'SeldDecoder' object has no attribute 'gru_size'. Both hidden sizes needs to be hidden_size=self.lstm_size

Using Windows 10, Chrome Browser v101.0.4951.67