Use google style to document properties (#6130)

* Use google style to document properties

* Update src/transformers/configuration_utils.py

Co-authored-by: Lysandre Debut <lysandre@huggingface.co>

Co-authored-by: Lysandre Debut <lysandre@huggingface.co>
This commit is contained in:
Sylvain Gugger
2020-07-29 12:28:12 -04:00
committed by GitHub
parent fc64559c45
commit 8a8ae27617
3 changed files with 17 additions and 18 deletions

View File

@@ -194,12 +194,18 @@ class PretrainedConfig(object):
raise err
@property
def use_return_tuple(self):
def use_return_tuple(self) -> bool:
"""
:obj:`bool`: Whether or not the model should return a tuple.
"""
# If torchscript is set, force return_tuple to avoid jit errors
return self.return_tuple or self.torchscript
@property
def num_labels(self) -> int:
"""
:obj:`int`: The number of labels for classification models.
"""
return len(self.id2label)
@num_labels.setter