Docs: Fix broken cross-references, i.e. ~transformer. -> ~transformers. (#27740)

~transformer. -> ~transformers.
This commit is contained in:
Tom Aarsen
2023-11-28 17:40:44 +01:00
committed by GitHub
parent dfbd209c25
commit f2ad4b537b
5 changed files with 15 additions and 15 deletions

View File

@@ -49,7 +49,7 @@ You will then be able to use the auto classes like you would usually do!
<Tip warning={true}> <Tip warning={true}>
If your `NewModelConfig` is a subclass of [`~transformer.PretrainedConfig`], make sure its If your `NewModelConfig` is a subclass of [`~transformers.PretrainedConfig`], make sure its
`model_type` attribute is set to the same key you use when registering the config (here `"new-model"`). `model_type` attribute is set to the same key you use when registering the config (here `"new-model"`).
Likewise, if your `NewModel` is a subclass of [`PreTrainedModel`], make sure its Likewise, if your `NewModel` is a subclass of [`PreTrainedModel`], make sure its

View File

@@ -43,7 +43,7 @@ AutoModel.register(NewModelConfig, NewModel)
<Tip warning={true}> <Tip warning={true}>
あなたの`NewModelConfig`が[`~transformer.PretrainedConfig`]のサブクラスである場合、その`model_type`属性がコンフィグを登録するときに使用するキー(ここでは`"new-model"`)と同じに設定されていることを確認してください。 あなたの`NewModelConfig`が[`~transformers.PretrainedConfig`]のサブクラスである場合、その`model_type`属性がコンフィグを登録するときに使用するキー(ここでは`"new-model"`)と同じに設定されていることを確認してください。
同様に、あなたの`NewModel`が[`PreTrainedModel`]のサブクラスである場合、その`config_class`属性がモデルを登録する際に使用するクラス(ここでは`NewModelConfig`)と同じに設定されていることを確認してください。 同様に、あなたの`NewModel`が[`PreTrainedModel`]のサブクラスである場合、その`config_class`属性がモデルを登録する際に使用するクラス(ここでは`NewModelConfig`)と同じに設定されていることを確認してください。

View File

@@ -151,7 +151,7 @@ class BeamSearchScorer(BeamScorer):
beam search algorithm). beam search algorithm).
num_beam_hyps_to_keep (`int`, *optional*, defaults to 1): num_beam_hyps_to_keep (`int`, *optional*, defaults to 1):
The number of beam hypotheses that shall be returned upon calling The number of beam hypotheses that shall be returned upon calling
[`~transformer.BeamSearchScorer.finalize`]. [`~transformers.BeamSearchScorer.finalize`].
num_beam_groups (`int`, *optional*, defaults to 1): num_beam_groups (`int`, *optional*, defaults to 1):
Number of groups to divide `num_beams` into in order to ensure diversity among different groups of beams. Number of groups to divide `num_beams` into in order to ensure diversity among different groups of beams.
See [this paper](https://arxiv.org/pdf/1610.02424.pdf) for more details. See [this paper](https://arxiv.org/pdf/1610.02424.pdf) for more details.
@@ -444,7 +444,7 @@ class ConstrainedBeamSearchScorer(BeamScorer):
beam search algorithm). beam search algorithm).
num_beam_hyps_to_keep (`int`, *optional*, defaults to 1): num_beam_hyps_to_keep (`int`, *optional*, defaults to 1):
The number of beam hypotheses that shall be returned upon calling The number of beam hypotheses that shall be returned upon calling
[`~transformer.BeamSearchScorer.finalize`]. [`~transformers.BeamSearchScorer.finalize`].
num_beam_groups (`int`, *optional*, defaults to 1): num_beam_groups (`int`, *optional*, defaults to 1):
Number of groups to divide `num_beams` into in order to ensure diversity among different groups of beams. Number of groups to divide `num_beams` into in order to ensure diversity among different groups of beams.
See [this paper](https://arxiv.org/pdf/1610.02424.pdf) for more details. See [this paper](https://arxiv.org/pdf/1610.02424.pdf) for more details.

View File

@@ -650,38 +650,38 @@ class Trainer:
def add_callback(self, callback): def add_callback(self, callback):
""" """
Add a callback to the current list of [`~transformer.TrainerCallback`]. Add a callback to the current list of [`~transformers.TrainerCallback`].
Args: Args:
callback (`type` or [`~transformer.TrainerCallback`]): callback (`type` or [`~transformers.TrainerCallback`]):
A [`~transformer.TrainerCallback`] class or an instance of a [`~transformer.TrainerCallback`]. In the A [`~transformers.TrainerCallback`] class or an instance of a [`~transformers.TrainerCallback`]. In the
first case, will instantiate a member of that class. first case, will instantiate a member of that class.
""" """
self.callback_handler.add_callback(callback) self.callback_handler.add_callback(callback)
def pop_callback(self, callback): def pop_callback(self, callback):
""" """
Remove a callback from the current list of [`~transformer.TrainerCallback`] and returns it. Remove a callback from the current list of [`~transformers.TrainerCallback`] and returns it.
If the callback is not found, returns `None` (and no error is raised). If the callback is not found, returns `None` (and no error is raised).
Args: Args:
callback (`type` or [`~transformer.TrainerCallback`]): callback (`type` or [`~transformers.TrainerCallback`]):
A [`~transformer.TrainerCallback`] class or an instance of a [`~transformer.TrainerCallback`]. In the A [`~transformers.TrainerCallback`] class or an instance of a [`~transformers.TrainerCallback`]. In the
first case, will pop the first member of that class found in the list of callbacks. first case, will pop the first member of that class found in the list of callbacks.
Returns: Returns:
[`~transformer.TrainerCallback`]: The callback removed, if found. [`~transformers.TrainerCallback`]: The callback removed, if found.
""" """
return self.callback_handler.pop_callback(callback) return self.callback_handler.pop_callback(callback)
def remove_callback(self, callback): def remove_callback(self, callback):
""" """
Remove a callback from the current list of [`~transformer.TrainerCallback`]. Remove a callback from the current list of [`~transformers.TrainerCallback`].
Args: Args:
callback (`type` or [`~transformer.TrainerCallback`]): callback (`type` or [`~transformers.TrainerCallback`]):
A [`~transformer.TrainerCallback`] class or an instance of a [`~transformer.TrainerCallback`]. In the A [`~transformers.TrainerCallback`] class or an instance of a [`~transformers.TrainerCallback`]. In the
first case, will remove the first member of that class found in the list of callbacks. first case, will remove the first member of that class found in the list of callbacks.
""" """
self.callback_handler.remove_callback(callback) self.callback_handler.remove_callback(callback)

View File

@@ -207,7 +207,7 @@ class TrainerCallback:
The argument `args`, `state` and `control` are positionals for all events, all the others are grouped in `kwargs`. The argument `args`, `state` and `control` are positionals for all events, all the others are grouped in `kwargs`.
You can unpack the ones you need in the signature of the event using them. As an example, see the code of the You can unpack the ones you need in the signature of the event using them. As an example, see the code of the
simple [`~transformer.PrinterCallback`]. simple [`~transformers.PrinterCallback`].
Example: Example: