Skip to content

Mulcat option#416

Merged
mpariente merged 23 commits intoasteroid-team:masterfrom
JunzheJosephZhu:master
Feb 12, 2021
Merged

Mulcat option#416
mpariente merged 23 commits intoasteroid-team:masterfrom
JunzheJosephZhu:master

Conversation

@JunzheJosephZhu
Copy link
Contributor

No description provided.

@mpariente
Copy link
Collaborator

Great this time, thanks !

@mpariente mpariente requested a review from JorisCos January 21, 2021 17:50
@mpariente
Copy link
Collaborator

@JorisCos do you mind reviewing please?

Copy link
Collaborator

@JorisCos JorisCos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR, this looks really nice. A minor fix on the docs is needed otherwise LGTM

self.intra_linear = nn.Linear(self.intra_RNN.output_size, in_chan)
self.intra_norm = norms.get(norm_type)(in_chan)

# InterRNN block and linear projection layer (uni or bi-directional)
Copy link
Collaborator

@JorisCos JorisCos Feb 1, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment should be before self.inter_RNN = DoubleRNN(...)

self.inter_RNN = SingleRNN(
rnn_type, in_chan, hid_size, num_layers, dropout=dropout, bidirectional=bidirectional
)
# IntraRNN and linear projection layer (always bi-directional)
Copy link
Collaborator

@JorisCos JorisCos Feb 1, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

Copy link
Collaborator

@mpariente mpariente left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's think about a way which doesn't copy paste the SingleRNN code in DoubleRNN.



class DoubleRNN(nn.Module):
"""Module for a RNN block.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to be more explicit.

@mpariente
Copy link
Collaborator

@JunzheJosephZhu ?

@JunzheJosephZhu
Copy link
Contributor Author

I guess the best way to do it would be combining them into s single object, adding an option for single/doubleRNN and adding a switch statement into the code?

For example,
class singleRNN(...):
def init(...,...,mulcat=False)
If mulcat:
self.inter_RNN = ...
else:
self.inter_RNN1 =
self.inter_RNN2 =

The code would be somewhat more confusing to readers though

@mpariente
Copy link
Collaborator

Let's keep the code like this for now.
Please

  • Rename DoubleRNN to MulCatRNN
  • Add a description in the docstring.
  • Test the mul_cat option in jit_test.py

@JunzheJosephZhu
Copy link
Contributor Author

JunzheJosephZhu commented Feb 9, 2021

It looks like when running the jit test, sudormrf always fails the test. Is this something I need to worry about, or is this unrelated to DPRNN?
Also, there's this super weird issue:

The two lines below would work with torch jit:
return torch.cat((rnn_output1 * rnn_output2, inp), 2)
return torch.cat((rnn_output1, inp), -1)

but this line throws an error:
return torch.cat((rnn_output1 * rnn_output2, inp), -1)
E torch.jit.TracingCheckError: Tracing failed sanity checks!
E Encountered an exception while running the trace with test inputs.
E Exception:
E The following operation failed in the TorchScript interpreter.
E Traceback of TorchScript (most recent call last):
E RuntimeError: vector::_M_range_check: __n (which is 18446744073709551615) >= this->size() (which is 3)

I ended up with:
return torch.cat((rnn_output1 * rnn_output2, inp), 2)
which works fine

Copy link
Collaborator

@mpariente mpariente left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are getting much closer, thanks ! What's left

  • Add use_mulcat is get_config so that serialization will work
  • Add the use_mulcat parameterize in tests/models/models_test.py to ensure serialization will work.
  • Fix the jit tests which don't look right to me.
  • Add the reference to the original MulCat paper in MulCatRNN

@JunzheJosephZhu
Copy link
Contributor Author

JunzheJosephZhu commented Feb 9, 2021

Also, do you want to implement multi-stage loss? That was also in the facebook paper.
I personally would prefer to first include it in my own recipe, since I'm gonna re-write the backbone anyway.

@mpariente
Copy link
Collaborator

Eventually, yes, but in the recipe sounds fine.

since I'm gonna re-write the backbone anyway.

What do you mean?

@JunzheJosephZhu
Copy link
Contributor Author

I mean I will use DPRNNBlock but not DPRNN for my separator, since the part starting from Conv2D diverge.

@mpariente
Copy link
Collaborator

Alright.
Can you fix the other issues I mentioned so that we can merge?

@JunzheJosephZhu
Copy link
Contributor Author

JunzheJosephZhu commented Feb 9, 2021

Ok, I'll do it ASAP. Btw, how do you write test cases for dataset objects? Can I just write if name == "main" in my recipe?

@mpariente
Copy link
Collaborator

We don't have tests for datasets.. Which is a large limitation.

@JunzheJosephZhu
Copy link
Contributor Author

I just finished my work with variable speaker wsj0mix dataset in my recipe folder. Should I start a PR yet?

@JunzheJosephZhu
Copy link
Contributor Author

I have no clue why it's not passing the test_save_and_load_dprnn. Do you have any idea?

@mpariente
Copy link
Collaborator

The loading is failing.

We need to test the mulcat version, but still keep the old tests. For that, we can use @pytest.mark.parameterize.

Regarding the recipe, yes, you can make a PR 😃 Thanks

@mpariente
Copy link
Collaborator

Because use_mulcat is not returned in get_config (as I mentioned before) so the new model doesn't use it.

@JunzheJosephZhu
Copy link
Contributor Author

JunzheJosephZhu commented Feb 10, 2021

ok

@JunzheJosephZhu
Copy link
Contributor Author

JunzheJosephZhu commented Feb 10, 2021

Hi, I'm starting to write the model class. I noticed that in all your models that are in the source code just use make_optimizer, but those in the recipe define make_model_and_optimizer. Do I have to follow this?
Also, why do the models in the source code not have load_best_model function?

@mpariente
Copy link
Collaborator

No, you don't have to.
The most important is that loading the model for eval is easy.

@JunzheJosephZhu
Copy link
Contributor Author

how do i write test cases for models in my recipe?
Also, github send me an email everyday telling me the version consistency check failed. I have no clue what it means

@mpariente
Copy link
Collaborator

how do i write test cases for models in my recipe?

They aren't tested if they are in the recipe folder.

Also, github send me an email everyday telling me the version consistency check failed. I have no clue what it means

Sorry about that, I don't receive those e-mails.. Anybody else receives those e-mails?

@mpariente
Copy link
Collaborator

I

  • Fixed the jit tests
  • Parameterize model test with use_mulcat
  • Restore always bidirectional IntraRNN
  • Removed the recipe files (which should be added to another branch).

This is ready for merging on my side.
Next time, don't make PRs from your master branch please 😉

@mpariente mpariente merged commit 8912fd2 into asteroid-team:master Feb 12, 2021
@JunzheJosephZhu
Copy link
Contributor Author

JunzheJosephZhu commented Feb 13, 2021 via email

@mpariente
Copy link
Collaborator

Not sure..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants