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

Stop warnings from unnecessary torch.tensor() overuse #36538

Merged
merged 1 commit into from
Mar 11, 2025

Conversation

Rocketknight1
Copy link
Member

Users are getting errors caused by calling torch.tensor() on an input that is already a tensor. This is unnecessary because kernel_size - stride will already be a new tensor object, and so it doesn't need to be cloned/detached/converted with torch.tensor().

Fixes #36533

@github-actions github-actions bot marked this pull request as draft March 4, 2025 14:03
Copy link

github-actions bot commented Mar 4, 2025

Hi 👋, thank you for opening this pull request! The pull request is converted to draft by default. When it is ready for review, please click the Ready for review button (at the bottom of the PR page).

@Rocketknight1
Copy link
Member Author

cc @ArthurZucker @Cyrilvallez for core maintainer review

Copy link
Member

@Cyrilvallez Cyrilvallez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, types and dtypes will be correctly preserved so LGTM!
Thanks for fixing

@Rocketknight1 Rocketknight1 force-pushed the stop_torch_tensor_warnings branch from 143b536 to 2856b39 Compare March 11, 2025 13:30
@Rocketknight1 Rocketknight1 merged commit b80b3ec into main Mar 11, 2025
15 checks passed
@Rocketknight1 Rocketknight1 deleted the stop_torch_tensor_warnings branch March 11, 2025 13:41
@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

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.

Warning related to torch.tensor() usage in transformers.models.encodec.modeling_encodec.py (Version 4.47.0)
3 participants