Le-Xiaohuai-speech / DPCRN_DNS3

Implementation of paper "DPCRN: Dual-Path Convolution Recurrent Network for Single Channel Speech Enhancement"
186 stars 41 forks source link

Use of CuDNNLSTM for training and LSTM for testing #14

Open rohithmars opened 2 years ago

rohithmars commented 2 years ago

Hello, I have used self.intra_rnn = keras.layers.Bidirectional(keras.layers.CuDNNLSTM(units=self.numUnits//2, return_sequences=True)) and self.inter_rnn = keras.layers.CuDNNLSTM(units=self.numUnits, return_sequences=True) during the training process, which significantly increases the training speed.

However, is it possible to use LSTM using inference to run on cpu?

If so, what would be the LSTM parameters? Using the below may give different result compared to CuDNNLSTM? keras.layers.LSTM(units=self.numUnits//2, return_sequences=True,implementation = 2,recurrent_activation = 'hard_sigmoid')

Le-Xiaohuai-speech commented 2 years ago

In TenosrFlow 2.X the requirements to use the cuDNN implementation are:

  1. activation == tanh
  2. recurrent_activation == sigmoid
  3. recurrent_dropout == 0
  4. unroll is False
  5. use_bias is True
  6. Inputs are not masked or strictly right padded.
  7. implementation == 2, I haven't compared the code of LSTM in tf1 with tf2. Maybe they are a little different. If you use the above parameters, be careful of the alignment when loading the weights.