Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multi-inputs #163

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

arlapin
Copy link
Contributor

@arlapin arlapin commented Mar 2, 2021

  • Add SamplesBatch class
  • Utilize SamplesBatch class

Reference Issues/PRs

Resolves #161

What does this implement/fix? Explain your changes.

I've added a SamplesBatch class, which holds multiple inputs and single target.

Inputs are stored as a dict(str, np.ndarray). Sequence is stored at inputs_batch['sequence_batch'].

If only sequence is provided as an input, then inputs() getter will return just a sequence.

It also has a function to convert inputs and targets to torch.Tensors. The sequence's tensor is transposed to [batch_size, channels_size, sequnece_length], so we don't need to do transpose it everywhere in the code.

What testing did you do to verify the changes in this PR?

I added unit tests for the SamplesBatch class.

I also ran case2/1_train_with_online_sampler.yml with a validation on every other step. So intervals_sampler, train, and validate do work.

Please let me know if this is sufficient, or may be you have a list of commands you run to check that everything works.

@arlapin
Copy link
Contributor Author

arlapin commented Mar 2, 2021

PTAL @jzthree @kathyxchen

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.

Support NN models with multiple inputs
1 participant