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

error with lengths = [1, 1, 1, 1,...., 1, 1, 1] #1756

Open
xiexbing opened this issue Mar 5, 2024 · 1 comment
Open

error with lengths = [1, 1, 1, 1,...., 1, 1, 1] #1756

xiexbing opened this issue Mar 5, 2024 · 1 comment

Comments

@xiexbing
Copy link

xiexbing commented Mar 5, 2024

Hello, I generated the KJT with lengths is a tensor with full of 1s. then I get an error as:

keys = ['f0', 'f1', 'f2', 'f3', 'f4', 'f5', ...], stride = 105, length_per_key = None, lengths = tensor([1, 1, 1, ..., 1, 1, 1], device='cuda:0'), offsets = None

def _maybe_compute_length_per_key(
    keys: List[str],
    stride: int,
    length_per_key: Optional[List[int]],
    lengths: Optional[torch.Tensor],
    offsets: Optional[torch.Tensor],
) -> List[int]:
    if length_per_key is None:
        if len(keys) and offsets is not None and len(offsets) > 0:
            _length: List[int] = torch.sum(
                torch.diff(offsets).view(-1, stride), dim=1
            ).tolist()
        elif len(keys) and lengths is not None:
            _length: List[int] = (
              torch.sum(lengths.view(-1, stride), dim=1).tolist()
                if lengths.numel() != 0
                else [0] * len(keys)
            )

E RuntimeError: shape '[-1, 105]' is invalid for input of size 2114

../../../../../miniconda3/envs/pr-gpu/lib/python3.8/site-packages/torchrec/sparse/jagged_tensor.py:523: RuntimeError

@PaulZhang12
Copy link
Contributor

Can we see the whole stack trace please?

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

No branches or pull requests

2 participants