Unverified Commit 2382706a authored by Matt's avatar Matt Committed by GitHub
Browse files

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
parent 4fb3d3a0
...@@ -295,7 +295,7 @@ class RegNetPreTrainedModel(PreTrainedModel): ...@@ -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:
......
...@@ -456,11 +456,12 @@ class TFRegNetPreTrainedModel(TFPreTrainedModel): ...@@ -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.
......
...@@ -654,6 +654,8 @@ OBJECTS_TO_IGNORE = [ ...@@ -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): ...@@ -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:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment