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

IterableDataset.with_format("torch") not working #5793

Closed
jiangwangyi opened this issue Apr 26, 2023 · 1 comment · Fixed by #5852
Closed

IterableDataset.with_format("torch") not working #5793

jiangwangyi opened this issue Apr 26, 2023 · 1 comment · Fixed by #5852
Assignees
Labels
bug Something isn't working enhancement New feature or request streaming

Comments

@jiangwangyi
Copy link

Describe the bug

After calling the with_format("torch") method on an IterableDataset instance, the data format is unchanged.

Steps to reproduce the bug

from datasets import IterableDataset
def gen():
    for i in range(4):
        yield {"a": [i] * 4}
dataset = IterableDataset.from_generator(gen).with_format("torch")
next(iter(dataset))

Expected behavior

{"a": torch.tensor([0, 0, 0, 0])} is expected, but {"a": [0, 0, 0, 0]} is observed.

Environment info

platform==ubuntu 22.04.01
python==3.10.9
datasets==2.11.0
@lhoestq
Copy link
Member

lhoestq commented Apr 26, 2023

Hi ! Thanks for reporting, I'm working on it ;)

@lhoestq lhoestq self-assigned this Apr 26, 2023
@lhoestq lhoestq added bug Something isn't working enhancement New feature or request streaming labels Apr 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request streaming
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants