Check if docstring is None before formating it (#20592)
docstrings could be `None` if Python optimize level is set to 2.
This commit is contained in:
@@ -3768,6 +3768,7 @@ def get_fast_tokenizer_file(tokenization_files: List[str]) -> str:
|
||||
|
||||
# To update the docstring, we need to copy the method, otherwise we change the original docstring.
|
||||
PreTrainedTokenizerBase.push_to_hub = copy_func(PreTrainedTokenizerBase.push_to_hub)
|
||||
PreTrainedTokenizerBase.push_to_hub.__doc__ = PreTrainedTokenizerBase.push_to_hub.__doc__.format(
|
||||
object="tokenizer", object_class="AutoTokenizer", object_files="tokenizer files"
|
||||
)
|
||||
if PreTrainedTokenizerBase.push_to_hub.__doc__ is not None:
|
||||
PreTrainedTokenizerBase.push_to_hub.__doc__ = PreTrainedTokenizerBase.push_to_hub.__doc__.format(
|
||||
object="tokenizer", object_class="AutoTokenizer", object_files="tokenizer files"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user