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

UserWarning: __floordiv__ is deprecated #15086

Closed
ypirkani opened this issue Jan 10, 2022 · 4 comments · Fixed by #15702
Closed

UserWarning: __floordiv__ is deprecated #15086

ypirkani opened this issue Jan 10, 2022 · 4 comments · Fixed by #15702
Assignees

Comments

@ypirkani
Copy link

ypirkani commented Jan 10, 2022

Dear All,

I am trying to Fine-tune XLSR for Speech Recognition "facebook/wav2vec2-base" model for Urdu Language.

However when I run the trainer, I am getting the following warning:

/home/e-team/anaconda3/lib/python3.9/site-packages/transformers/models/wav2vec2/modeling_wav2vec2.py:704: UserWarning: __floordiv__ is deprecated, and its behavior will change in a future version of pytorch. It currently rounds toward 0 (like the 'trunc' function NOT 'floor'). This results in incorrect rounding for negative values. To keep the current behavior, use torch.div(a, b, rounding_mode='trunc'), or for actual floor division, use torch.div(a, b, rounding_mode='floor').
  return (input_length - kernel_size) // stride + 1

Also Consequently my WER is 1.00 which means training is not being done correctly.
Can anyone guide ? What changes to make and where?

Torch Version: 1.10.1+cu102
Python Version: 3.9.7
CUDA Version: 11.2
Tensorflow Version: 2.7.0

image

Best regards,
Yasir

@NielsRogge
Copy link
Contributor

The same warning is shown for LayoutLMv2, see #14577

@github-actions
Copy link

github-actions bot commented Feb 9, 2022

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the contributing guidelines are likely to be ignored.

@anton-l
Copy link
Member

anton-l commented Feb 9, 2022

Fixed by #15180

@anton-l anton-l closed this as completed Feb 9, 2022
@gautierdag
Copy link
Contributor

gautierdag commented Feb 17, 2022

Running in the same issue for the DetrModel model:

dim_t = self.temperature ** (2 * (dim_t // 2) / self.embedding_dim)

Happy to submit a quick PR using the torch_int_div function added in #15180:

dim_t = self.temperature ** (2 * torch_int_div(dim_t, 2) / self.embedding_dim)

EDIT: I've submitted the PR (#15702) since it was a quick fix.

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 a pull request may close this issue.

4 participants