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

Add beam search #95

Merged
merged 10 commits into from
Jun 29, 2017
Merged

Add beam search #95

merged 10 commits into from
Jun 29, 2017

Conversation

ryanleary
Copy link
Collaborator

@ryanleary ryanleary commented Jun 19, 2017

This is a WIP integration of beam search based on my port of the ctc beam decoder in tensorflow. Will address #86.

Remaining:

  • additional testing
  • add optional dictionary constraint
  • add optional lm functionality
  • Add documentation
  • Update requirements.txt

If you want to test it out, you will need to manually install my pytorch_ctc bindings: https://github.com/ryanleary/pytorch-ctc

@ryanleary
Copy link
Collaborator Author

@SeanNaren - do you notice anything in here that would break training? I consistently get OOM errors during clip_grad in this branch for some reason. Cannot explain at the moment.

Traceback (most recent call last):
  File "train.py", line 382, in <module>
    main()
  File "train.py", line 248, in main
    torch.nn.utils.clip_grad_norm(model.parameters(), args.max_norm)
File "/home/ryan/anaconda3/envs/pytorch/lib/python3.6/site-packages/torch/nn/utils/clip_grad.py", line 25, in clip_grad_norm
    param_norm = p.grad.data.norm(norm_type)
RuntimeError: cuda runtime error (2) : out of memory at /py/conda-bld/pytorch_1493680494901/work/torch/lib/THC/THCGeneral.c:833

Perhaps something with the new BatchSoftmax layer? I've tried commenting out large swaths but it still seems to OOM.

@SeanNaren
Copy link
Owner

Hey man its definitely involving the new batch softmax layer i think, but the behaviour is really strange, will be digging a little further into it.

@ryanleary
Copy link
Collaborator Author

ryanleary commented Jun 20, 2017

I was referencing pytorch/pytorch#1020 in the implementation of that module.

@ryanleary
Copy link
Collaborator Author

Fixed it. Accidentally omitted the final transform when in training mode.

@ryanleary
Copy link
Collaborator Author

Working through the kenlm integration now.

@willfrey
Copy link

@SeanNaren
Copy link
Owner

SeanNaren commented Jun 21, 2017

@ryanleary nice catch :)
@willfrey that's whats being merged

@ryanleary ryanleary changed the title WIP: Add beam search Add beam search Jun 26, 2017
@ryanleary
Copy link
Collaborator Author

@SeanNaren it may be best to consider this experimental still, but I think it's probably safe to merge.

@SeanNaren SeanNaren merged commit a52830f into SeanNaren:master Jun 29, 2017
@SeanNaren
Copy link
Owner

Thanks a lot for this!

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.

None yet

3 participants