Copy existing tensors without a PyTorch warning by jinchuntan · Pull Request #8845 · huggingface/datasets · GitHub
Skip to content

Copy existing tensors without a PyTorch warning - #8845

Open
jinchuntan wants to merge 1 commit into
huggingface:mainfrom
jinchuntan:fix/torch-tensor-copy
Open

jinchuntan wants to merge 1 commit into
huggingface:mainfrom
jinchuntan:fix/torch-tensor-copy

Conversation

@jinchuntan

@jinchuntan jinchuntan commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Streaming with_format("torch").map(...) warns for every row when a transform returns tensors. Copy existing tensors directly while keeping dtype/device overrides, independent storage and leaf gradient settings. Fixes #7088.

Added 18 regression cases, including batched maps. Formatting checks: 59 passed, 12 skipped. One audio test needs the missing torchcodec dependency. it also fails on unchanged main. Lint and formatting pass.

Preserve independent storage, dtype and device overrides, and leaf gradient settings when formatting mapped tensors.

Fixes huggingface#7088

Assisted-by: Codex
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

Successfully merging this pull request may close these issues.

Disable warning when using with_format format on tensors

1 participant