Fix docstrings and update docstring checker error message (#28460)

* Fix TF Regnet docstring

* Fix TF Regnet docstring

* Make a change to the PyTorch Regnet too to make sure the CI is checking it

* Add skips for TFRegnet

* Update error message for docstring checker
This commit is contained in:
Matt
2024-01-12 17:54:11 +00:00
committed by GitHub
parent 4fb3d3a0f6
commit 2382706a1c
3 changed files with 9 additions and 3 deletions

View File

@@ -295,7 +295,7 @@ class RegNetPreTrainedModel(PreTrainedModel):
REGNET_START_DOCSTRING = r""" REGNET_START_DOCSTRING = r"""
This model is a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) subclass. Use it This model is a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and as a regular PyTorch Module and refer to the PyTorch documentation for all matters related to general usage and
behavior. behavior.
Parameters: Parameters:

View File

@@ -456,11 +456,12 @@ class TFRegNetPreTrainedModel(TFPreTrainedModel):
REGNET_START_DOCSTRING = r""" REGNET_START_DOCSTRING = r"""
Parameters:
This model is a Tensorflow This model is a Tensorflow
[tf.keras.layers.Layer](https://www.tensorflow.org/api_docs/python/tf/keras/layers/Layer) sub-class. Use it as a [tf.keras.layers.Layer](https://www.tensorflow.org/api_docs/python/tf/keras/layers/Layer) sub-class. Use it as a
regular Tensorflow Module and refer to the Tensorflow documentation for all matter related to general usage and regular Tensorflow Module and refer to the Tensorflow documentation for all matter related to general usage and
behavior. behavior.
Parameters:
config ([`RegNetConfig`]): Model configuration class with all the parameters of the model. config ([`RegNetConfig`]): Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the [`~TFPreTrainedModel.from_pretrained`] method to load the model weights. configuration. Check out the [`~TFPreTrainedModel.from_pretrained`] method to load the model weights.

View File

@@ -654,6 +654,8 @@ OBJECTS_TO_IGNORE = [
"TFRagModel", "TFRagModel",
"TFRagSequenceForGeneration", "TFRagSequenceForGeneration",
"TFRagTokenForGeneration", "TFRagTokenForGeneration",
"TFRegNetForImageClassification",
"TFRegNetModel",
"TFRemBertForCausalLM", "TFRemBertForCausalLM",
"TFRemBertForMaskedLM", "TFRemBertForMaskedLM",
"TFRemBertForMultipleChoice", "TFRemBertForMultipleChoice",
@@ -1214,7 +1216,10 @@ def check_docstrings(overwrite: bool = False):
error_message += "\n" + "\n".join([f"- {name}" for name in hard_failures]) error_message += "\n" + "\n".join([f"- {name}" for name in hard_failures])
if len(failures) > 0: if len(failures) > 0:
error_message += ( error_message += (
"The following objects docstrings do not match their signature. Run `make fix-copies` to fix this." "The following objects docstrings do not match their signature. Run `make fix-copies` to fix this. "
"In some cases, this error may be raised incorrectly by the docstring checker. If you think this is the "
"case, you can manually check the docstrings and then add the object name to `OBJECTS_TO_IGNORE` in "
"`utils/check_docstrings.py`."
) )
error_message += "\n" + "\n".join([f"- {name}" for name in failures]) error_message += "\n" + "\n".join([f"- {name}" for name in failures])
if len(to_clean) > 0: if len(to_clean) > 0: