diff --git a/fastNLP/core/instance.py b/fastNLP/core/instance.py index a2877a8f..a102b51c 100644 --- a/fastNLP/core/instance.py +++ b/fastNLP/core/instance.py @@ -30,5 +30,7 @@ class Instance(object): return self.add_field(name, field) def __repr__(self): + s = '\'' return "{" + ",\n".join( - "\'" + field_name + "\': " + str(self.fields[field_name]) for field_name in self.fields) + "}" + "\'" + field_name + "\': " + str(self.fields[field_name]) +\ + f" type={(str(type(self.fields[field_name]))).split(s)[1]}" for field_name in self.fields) + "}" diff --git a/fastNLP/core/losses.py b/fastNLP/core/losses.py index c11f538c..9b8b8d8f 100644 --- a/fastNLP/core/losses.py +++ b/fastNLP/core/losses.py @@ -195,7 +195,7 @@ class CrossEntropyLoss(LossBase): def get_loss(self, pred, target): return F.cross_entropy(input=pred, target=target, - ignore_index=self.padding_idx) + ignore_index=self.padding_idx) class L1Loss(LossBase):