meta-pytorch / meta-pytorch/data
KeyError when wrapping a dict with a SequenceWrapper
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.3k
- Forks
- 179
- Avg merge
- 6d 1h
- Merged PRs (30d)
- 2
Description
🐛 Describe the bug
I get the following errors.
from torchdata.datapipes.map import SequenceWrapper
tuple(SequenceWrapper({'a': 100, 'b': 200, 'c': 300, 'd': 400})) # produces KeyError: 0
tuple(SequenceWrapper({0: "100", 1: "200"})) # produces KeyError: 2
I expect them to return (100, 200, 300, 400) and ("100", "200"), respectively, instead.
Versions
torchdata 0.4.1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the torchdata.datapipes.map.SequenceWrapper entry point and reproduce both dictionary examples from the issue. Check how iteration handles mappings versus sequences, then verify that both examples yield their values in the expected order and no KeyError occurs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, pytorch
- Domain
- data
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100