harvardnlp/pytorch-struct

notebooks are broken

volkancirik opened this issue · 7 comments

CTC, CTC_with_padding, and Unsupervised_CFG notebooks are not working. in sparse.py L591 too many values to unpack for CTCs and no module named torch_struct.networks for CFG.

srush commented

Oh thanks for the heads up. I will update these and figure out how to test them.

Do you need a particular example in the short term? I can prioritize what you are looking for.

Thanks for the prompt response! any chance of having a notebook with Semi-Markov or Alignment models?

srush commented

Sure. I will do that. I might switch to just files though as notebooks are hard to keep current.

If you are looking for demos, you might find the docs helpful as well http://nlp.seas.harvard.edu/pytorch-struct/model.html#Semi-Markov

thanks for the pointer!

this works but super slow. I tried to use cuda instead.

log_potentials = torch.rand(batch, N, M, 3)
dist = AlignmentCRF(log_potentials)
show_deps(dist.argmax[0])

this fails:

log_potentials = torch.rand(batch, N, M, 3).cuda()

~/bin/anaconda2/envs/torchstruct/lib/python3.7/site-packages/genbmm/sparse.py in forward(ctx, a, a_lu, a_ld, b, b_lu, b_ld, o_lu, o_ld)
589
590 _, indices2 = _genbmm.forward_band(
--> 591 bt.data.contiguous(), bt.lu, bt.ld, at.data.contiguous(), at.lu, at.ld, 1
592 )
593
ValueError: too many values to unpack (expected 2)

srush commented

I'll take a look. Are you on CPU or GPU? The alignment code only really runs on GPU (if you want CPU there are much better libraries).

I'm on GPU. SemiMarkovCRF works fine but too many values to unpack error is still there for the alignment model.