Spaces:
Build error
Build error
PeteBleackley
commited on
Commit
·
1a9032d
1
Parent(s):
3fc3a1b
Diagnostics
Browse files- qarac/models/QaracEncoderModel.py +4 -0
- qarac/models/QaracTrainerModel.py +1 -5
- scripts.py +0 -1
qarac/models/QaracEncoderModel.py
CHANGED
@@ -47,8 +47,12 @@ class QaracEncoderModel(transformers.PreTrainedModel):
|
|
47 |
Vector representing the document
|
48 |
|
49 |
"""
|
|
|
|
|
50 |
if attention_mask is None and 'attention_mask' in input_ids:
|
51 |
(input_ids,attention_mask) = (input_ids['input_ids'],input_ids['attention_mask'])
|
|
|
|
|
52 |
return self.head(self.encoder(input_ids,
|
53 |
attention_mask).last_hidden_state,
|
54 |
attention_mask)
|
|
|
47 |
Vector representing the document
|
48 |
|
49 |
"""
|
50 |
+
print('Encoder',self.encoder.device)
|
51 |
+
print('Head',self.head.device)
|
52 |
if attention_mask is None and 'attention_mask' in input_ids:
|
53 |
(input_ids,attention_mask) = (input_ids['input_ids'],input_ids['attention_mask'])
|
54 |
+
print('input_ids',input_ids.device)
|
55 |
+
print('attention_mask',attention_mask.device)
|
56 |
return self.head(self.encoder(input_ids,
|
57 |
attention_mask).last_hidden_state,
|
58 |
attention_mask)
|
qarac/models/QaracTrainerModel.py
CHANGED
@@ -99,8 +99,4 @@ class QaracTrainerModel(torch.nn.Module):
|
|
99 |
|
100 |
consistency = self.cosine(s0,s1)
|
101 |
return (encode_decode,question_answering,reasoning,consistency)
|
102 |
-
|
103 |
-
def devices(self):
|
104 |
-
print("Question encoder",self.question_encoder.device)
|
105 |
-
print('Answer Encoder',self.answer_encoder.device)
|
106 |
-
print('Decoer',self.decoder.device)
|
|
|
99 |
|
100 |
consistency = self.cosine(s0,s1)
|
101 |
return (encode_decode,question_answering,reasoning,consistency)
|
102 |
+
|
|
|
|
|
|
|
|
scripts.py
CHANGED
@@ -125,7 +125,6 @@ def train_models(path,progress=gradio.Progress(track_tqdm=True)):
|
|
125 |
tokenizer)
|
126 |
|
127 |
trainer.to(device)
|
128 |
-
trainer.devices()
|
129 |
loss_fn = CombinedLoss()
|
130 |
loss_fn.cuda()
|
131 |
optimizer = torch.optim.NAdam(trainer.parameters(),lr=5.0e-5)
|
|
|
125 |
tokenizer)
|
126 |
|
127 |
trainer.to(device)
|
|
|
128 |
loss_fn = CombinedLoss()
|
129 |
loss_fn.cuda()
|
130 |
optimizer = torch.optim.NAdam(trainer.parameters(),lr=5.0e-5)
|