2
.github/workflows/self-push.yml
vendored
2
.github/workflows/self-push.yml
vendored
@@ -36,7 +36,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
source .env/bin/activate
|
source .env/bin/activate
|
||||||
pip install --upgrade pip
|
pip install --upgrade pip
|
||||||
pip install torch --no-cache-dir
|
pip install torch!=1.6.0 --no-cache-dir
|
||||||
pip install .[sklearn,testing]
|
pip install .[sklearn,testing]
|
||||||
|
|
||||||
- name: Are GPUs recognized by our DL frameworks
|
- name: Are GPUs recognized by our DL frameworks
|
||||||
|
|||||||
@@ -496,11 +496,13 @@ class XLMModel(XLMPreTrainedModel):
|
|||||||
else:
|
else:
|
||||||
bs, slen = inputs_embeds.size()[:-1]
|
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 lengths is None:
|
||||||
if input_ids is not None:
|
if input_ids is not None:
|
||||||
lengths = (input_ids != self.pad_index).sum(dim=1).long()
|
lengths = (input_ids != self.pad_index).sum(dim=1).long()
|
||||||
else:
|
else:
|
||||||
lengths = torch.LongTensor([slen] * bs)
|
lengths = torch.tensor([slen] * bs, device=device)
|
||||||
# mask = input_ids != self.pad_index
|
# mask = input_ids != self.pad_index
|
||||||
|
|
||||||
# check inputs
|
# check inputs
|
||||||
|
|||||||
Reference in New Issue
Block a user