Patch GPU failures (#6281)

* Pin to 1.5.0

* Patch XLM GPU test
This commit is contained in:
Lysandre Debut 2020-08-07 02:58:15 -04:00 committed by GitHub
parent 80a0676a51
commit 0d9328f2ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -36,7 +36,7 @@ jobs:
run: |
source .env/bin/activate
pip install --upgrade pip
pip install torch --no-cache-dir
pip install torch!=1.6.0 --no-cache-dir
pip install .[sklearn,testing]
- name: Are GPUs recognized by our DL frameworks

View File

@ -496,11 +496,13 @@ class XLMModel(XLMPreTrainedModel):
else:
bs, slen = inputs_embeds.size()[:-1]
device = input_ids.device if input_ids is not None else inputs_embeds.device
if lengths is None:
if input_ids is not None:
lengths = (input_ids != self.pad_index).sum(dim=1).long()
else:
lengths = torch.LongTensor([slen] * bs)
lengths = torch.tensor([slen] * bs, device=device)
# mask = input_ids != self.pad_index
# check inputs