pytorch-struct icon indicating copy to clipboard operation
pytorch-struct copied to clipboard

notebooks are broken

Open volkancirik opened this issue 3 years ago • 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.

volkancirik avatar Feb 16 '21 02:02 volkancirik

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.

srush avatar Feb 16 '21 02:02 srush

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

volkancirik avatar Feb 16 '21 02:02 volkancirik

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

srush avatar Feb 16 '21 02:02 srush

thanks for the pointer!

volkancirik avatar Feb 16 '21 03:02 volkancirik

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)

volkancirik avatar Feb 16 '21 03:02 volkancirik

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).

srush avatar Feb 16 '21 04:02 srush

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

volkancirik avatar Feb 16 '21 14:02 volkancirik