Spaces:
Running
Running
debugging for cuda
Browse files
new_test_saved_finetuned_model.py
CHANGED
|
@@ -55,7 +55,7 @@ class BERTFineTuneTrainer:
|
|
| 55 |
# available_gpus = list(range(torch.cuda.device_count()))
|
| 56 |
|
| 57 |
# This BERT model will be saved every epoch
|
| 58 |
-
self.model = bertFinetunedClassifierwithFeats.to(
|
| 59 |
print(self.model.parameters())
|
| 60 |
for param in self.model.parameters():
|
| 61 |
param.requires_grad = False
|
|
@@ -159,7 +159,7 @@ class BERTFineTuneTrainer:
|
|
| 159 |
logits = self.model.forward(data["input"], data["segment_label"], data["feat"])
|
| 160 |
else:
|
| 161 |
with torch.no_grad():
|
| 162 |
-
logits = self.model.forward(data["input"]
|
| 163 |
|
| 164 |
logits = logits.cpu()
|
| 165 |
loss = self.criterion(logits, data["label"])
|
|
|
|
| 55 |
# available_gpus = list(range(torch.cuda.device_count()))
|
| 56 |
|
| 57 |
# This BERT model will be saved every epoch
|
| 58 |
+
self.model = bertFinetunedClassifierwithFeats.to(self.device)
|
| 59 |
print(self.model.parameters())
|
| 60 |
for param in self.model.parameters():
|
| 61 |
param.requires_grad = False
|
|
|
|
| 159 |
logits = self.model.forward(data["input"], data["segment_label"], data["feat"])
|
| 160 |
else:
|
| 161 |
with torch.no_grad():
|
| 162 |
+
logits = self.model.forward(data["input"], data["segment_label"], data["feat"])
|
| 163 |
|
| 164 |
logits = logits.cpu()
|
| 165 |
loss = self.criterion(logits, data["label"])
|