jmschrei / pomegranate

Fast, flexible and easy to use probabilistic modelling in Python.
http://pomegranate.readthedocs.org/en/latest/
MIT License
3.35k stars 589 forks source link

[BUG] ragged input to HMM #1095

Closed hammondm closed 2 months ago

hammondm commented 5 months ago

Describe the bug

HMM inputs can be "ragged" in dimension 1. But there doesn't seem to be a way to move such inputs to the GPU.

I tried using a nested tensor from pytorch for this, but that doesn't work.

To Reproduce

jmschrei commented 2 months ago

I can reproduce the issue when I pass a list of 3D tensors which are on the CPU and fit to a model that is on the GPU, but can resolve the issue by moving each element of the list to CUDA, e.g. X = [torch.randn(n, m, 1).cuda() * 5, torch.randn(5, m+5, 1).cuda() * 5]. This also works when each element in the list is a 2D tensor. I'm not sure what you mean by a nested tensor from PyTorch, but just move each individual element in your ragged element to CUDA. Please re-open if you still encounter issues.