Upload MyLLaMa
Browse files- configure_for_hf.py +5 -6
configure_for_hf.py
CHANGED
@@ -64,13 +64,12 @@ class MyLLaMa(PreTrainedModel):
|
|
64 |
-torch.inf,
|
65 |
)
|
66 |
.transpose(0, 1)
|
67 |
-
.cuda()
|
68 |
-
)
|
69 |
-
pad_mask = (
|
70 |
-
torch.where(
|
71 |
-
tensor == self.model.tokenizer.pad_token_id, False, True
|
72 |
-
).cuda(),
|
73 |
)
|
|
|
|
|
|
|
|
|
74 |
logits = self.model(tensor, att_mask, pad_mask)["logits"]
|
75 |
if labels is not None:
|
76 |
loss = nn.functional.cross_entropy(logits, labels)
|
|
|
64 |
-torch.inf,
|
65 |
)
|
66 |
.transpose(0, 1)
|
67 |
+
.cuda()
|
|
|
|
|
|
|
|
|
|
|
68 |
)
|
69 |
+
|
70 |
+
pad_mask = torch.where(
|
71 |
+
tensor == self.model.tokenizer.pad_token_id, False, True
|
72 |
+
).cuda()
|
73 |
logits = self.model(tensor, att_mask, pad_mask)["logits"]
|
74 |
if labels is not None:
|
75 |
loss = nn.functional.cross_entropy(logits, labels)
|