NVIDIA / NVIDIA/apex

RuntimeError: Tensor: invalid storage offset

Open
#102 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
9k
Forks
1.5k
Avg merge
2d 4h
Merged PRs (30d)
3

Description

This error raised when the weights of RNN are not part of single contiguous chunk of memory. In pure pytorch calculation it is just a warning, but with apex it will fail: https://github.com/NVIDIA/apex/blob/4212b3e943ea8d1b4c0c2749f4b7753de39a6d3a/apex/amp/utils.py#L177-L188

(the offsets may become negative, which are invalid)

While I am not sure why this (weights are not part of single contiguous chunk of memory) happens in PyTorch, but a simple workaround is to call rnn.flatten_parameters() before each forward call.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading apex/amp/utils.py at lines 177-188 and reproducing the RuntimeError with RNN weights that are not in one contiguous memory chunk. Compare the failing Apex path with the reported rnn.flatten_parameters() workaround; the issue does not specify a final fix or test, so the expected completion criteria need clarification.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.