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

Fix QA pipeline on Windows #8947

Merged
merged 1 commit into from
Dec 7, 2020
Merged

Fix QA pipeline on Windows #8947

merged 1 commit into from
Dec 7, 2020

Conversation

sgugger
Copy link
Collaborator

@sgugger sgugger commented Dec 6, 2020

What does this PR do?

As reported on the forum, there is a problem in the current pipeline on Windows. The problem's root is that numpy int arrays have a different default on Linux and Windows, the current snippet:

import numpy as np
x = np.array([1, 2, 3])
x.dtype

will print dtype('int64') on Linux/MacOS but dtype('int32') on Windows. So this means that just doing torch.tensor(some_numpy_array) may result in a tensor of dtype int32 which PyTorch does not like. For future reference, the error:

Expected tensor for argument #1 'xxx' to have scalar type Long; but got torch.IntTensor instead

is usually a clear indicator of this behavior happening.

The PR fixes the QA pipeline by casting the tensors to long if they have the int type.

Copy link
Member

@LysandreJik LysandreJik left a comment

Choose a reason for hiding this comment

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

LGTM, thanks @sgugger!

@LysandreJik LysandreJik merged commit 28c77dd into master Dec 7, 2020
@LysandreJik LysandreJik deleted the fix_qa_pipeline_windows branch December 7, 2020 14:50
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.

None yet

2 participants