Open jack657166 opened 1 year ago
You need to change code: line 133 def repackage_hidden(self,h): """Wraps hidden states in new Variables, to detach them from their history.""" if type(h) == Variable: return Variable(h.data) else: return tuple(self.repackage_hidden(v) for v in h) to def repackage_hidden(self, h): """Wraps hidden states in new Variables, to detach them from their history.""" if isinstance(h, torch.Tensor): return h.detach() else: return tuple(self.repackage_hidden(v) for v in h) and all acc.data[0], loss.data[0] should be changed to acc.item(),loss.item().
then you can run the code with newest pytorch.
Have you solved this problem