You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello
I get this error when I try to run this line:
#Converting these to cuda tensors
seq, attn_masks, labels = seq.cpu(), attn_masks.cpu(), labels.cpu()
#Obtaining the logits from the model
logits = net(seq, attn_masks)
TypeError Traceback (most recent call last)
/tmp/ipykernel_3563350/327820057.py in <module>
37 print("Let the training begin")
38 st = time.time()
---> 39 train(net, criterion, opti, train_loader, val_loader, args)
40 print("Done in {} seconds".format(time.time() - st))
/tmp/ipykernel_3563350/2996746533.py in train(net, criterion, opti, train_loader, val_loader, args)
49
50 #Obtaining the logits from the model
---> 51 logits = net(seq, attn_masks)
52
53 #Computing loss
~/anaconda3/envs/trans/lib/python3.7/site-packages/torch/nn/modules/module.py in __call__(self, *input, **kwargs)
539 result = self._slow_forward(*input, **kwargs)
540 else:
--> 541 result = self.forward(*input, **kwargs)
542 for hook in self._forward_hooks.values():
543 hook_result = hook(self, input, result)
~/Tests/FineTuneBERT/src/model.py in forward(self, seq, attn_masks)
29
30 #Obtaining the representation of [CLS] head
---> 31 cls_rep = cont_reps[:, 0]
32
33 #Feeding cls_rep to the classifier layer
TypeError: string indices must be integers
How can I solve this?
The text was updated successfully, but these errors were encountered:
Hello
I get this error when I try to run this line:
How can I solve this?
The text was updated successfully, but these errors were encountered: