diff --git a/examples/research_projects/rag/distributed_pytorch_retriever.py b/examples/research_projects/rag/distributed_pytorch_retriever.py index 0edbc969a5d022..e2403ff8e5b5fb 100644 --- a/examples/research_projects/rag/distributed_pytorch_retriever.py +++ b/examples/research_projects/rag/distributed_pytorch_retriever.py @@ -22,10 +22,10 @@ class RagPyTorchDistributedRetriever(RagRetriever): Args: config (:class:`~transformers.RagConfig`): The configuration of the RAG model this Retriever is used with. Contains parameters indicating which ``Index`` to build. - question_encoder_tokenizer (:class:`~transformers.PretrainedTokenizer`): + question_encoder_tokenizer (:class:`~transformers.PreTrainedTokenizer`): The tokenizer that was used to tokenize the question. It is used to decode the question and then use the generator_tokenizer. - generator_tokenizer (:class:`~transformers.PretrainedTokenizer`): + generator_tokenizer (:class:`~transformers.PreTrainedTokenizer`): The tokenizer used for the generator part of the RagModel. index (:class:`~transformers.models.rag.retrieval_rag.Index`, optional, defaults to the one defined by the configuration): If specified, use this index instead of the one built using the configuration diff --git a/examples/research_projects/rag/distributed_ray_retriever.py b/examples/research_projects/rag/distributed_ray_retriever.py index 69fd719cbcc44f..4ee4f963f9a39c 100644 --- a/examples/research_projects/rag/distributed_ray_retriever.py +++ b/examples/research_projects/rag/distributed_ray_retriever.py @@ -50,10 +50,10 @@ class RagRayDistributedRetriever(RagRetriever): Args: config (:class:`~transformers.RagConfig`): The configuration of the RAG model this Retriever is used with. Contains parameters indicating which ``Index`` to build. - question_encoder_tokenizer (:class:`~transformers.PretrainedTokenizer`): + question_encoder_tokenizer (:class:`~transformers.PreTrainedTokenizer`): The tokenizer that was used to tokenize the question. It is used to decode the question and then use the generator_tokenizer. - generator_tokenizer (:class:`~transformers.PretrainedTokenizer`): + generator_tokenizer (:class:`~transformers.PreTrainedTokenizer`): The tokenizer used for the generator part of the RagModel. retrieval_workers (:obj:`List[ray.ActorClass(RayRetriever)]`): A list of already initialized `RayRetriever` actors. These actor classes run on remote processes and are responsible for performing the index lookup. diff --git a/src/transformers/generation_beam_search.py b/src/transformers/generation_beam_search.py index 063bda641fa411..1fea43e1d7e503 100644 --- a/src/transformers/generation_beam_search.py +++ b/src/transformers/generation_beam_search.py @@ -27,7 +27,7 @@ input_ids (:obj:`torch.LongTensor` of shape :obj:`(batch_size * num_beams, sequence_length)`): Indices of input sequence tokens in the vocabulary. - Indices can be obtained using any class inheriting from :class:`~transformers.PretrainedTokenizer`. See + Indices can be obtained using any class inheriting from :class:`~transformers.PreTrainedTokenizer`. See :meth:`transformers.PreTrainedTokenizer.encode` and :meth:`transformers.PreTrainedTokenizer.__call__` for details. @@ -60,7 +60,7 @@ input_ids (:obj:`torch.LongTensor` of shape :obj:`(batch_size * num_beams, sequence_length)`): Indices of input sequence tokens in the vocabulary. - Indices can be obtained using any class inheriting from :class:`~transformers.PretrainedTokenizer`. See + Indices can be obtained using any class inheriting from :class:`~transformers.PreTrainedTokenizer`. See :meth:`transformers.PreTrainedTokenizer.encode` and :meth:`transformers.PreTrainedTokenizer.__call__` for details. @@ -86,8 +86,8 @@ class BeamScorer(ABC): """ - Abstract base class for all beam scorers that are used for :meth:`~transformers.PretrainedModel.beam_search` and - :meth:`~transformers.PretrainedModel.beam_sample`. + Abstract base class for all beam scorers that are used for :meth:`~transformers.PreTrainedModel.beam_search` and + :meth:`~transformers.PreTrainedModel.beam_sample`. """ @abstractmethod diff --git a/src/transformers/generation_logits_process.py b/src/transformers/generation_logits_process.py index e40ca17116f6d3..c808d3ae4f6060 100644 --- a/src/transformers/generation_logits_process.py +++ b/src/transformers/generation_logits_process.py @@ -474,7 +474,7 @@ def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTensor) -> to class HammingDiversityLogitsProcessor(LogitsProcessor): r""" :class:`transformers.LogitsProcessor` that enforces diverse beam search. Note that this logits processor is only - effective for :meth:`transformers.PretrainedModel.group_beam_search`. See `Diverse Beam Search: Decoding Diverse + effective for :meth:`transformers.PreTrainedModel.group_beam_search`. See `Diverse Beam Search: Decoding Diverse Solutions from Neural Sequence Models `__ for more details. Args: diff --git a/src/transformers/models/ctrl/modeling_ctrl.py b/src/transformers/models/ctrl/modeling_ctrl.py index c883aa7bf730bb..bb31170bdcc97b 100644 --- a/src/transformers/models/ctrl/modeling_ctrl.py +++ b/src/transformers/models/ctrl/modeling_ctrl.py @@ -586,7 +586,7 @@ def forward( def _reorder_cache(past: Tuple[Tuple[torch.Tensor]], beam_idx: torch.Tensor) -> Tuple[Tuple[torch.Tensor]]: """ This function is used to re-order the :obj:`past_key_values` cache if - :meth:`~transformers.PretrainedModel.beam_search` or :meth:`~transformers.PretrainedModel.beam_sample` is + :meth:`~transformers.PreTrainedModel.beam_search` or :meth:`~transformers.PreTrainedModel.beam_sample` is called. This is required to match :obj:`past_key_values` with the correct beam_idx at every generation step. """ return tuple( diff --git a/src/transformers/models/encoder_decoder/modeling_encoder_decoder.py b/src/transformers/models/encoder_decoder/modeling_encoder_decoder.py index f314106677b0e1..bcb85df33528cd 100644 --- a/src/transformers/models/encoder_decoder/modeling_encoder_decoder.py +++ b/src/transformers/models/encoder_decoder/modeling_encoder_decoder.py @@ -89,7 +89,7 @@ :obj:`past_key_values`). Provide for sequence to sequence training to the decoder. Indices can be obtained using - :class:`~transformers.PretrainedTokenizer`. See :meth:`transformers.PreTrainedTokenizer.encode` and + :class:`~transformers.PreTrainedTokenizer`. See :meth:`transformers.PreTrainedTokenizer.encode` and :meth:`transformers.PreTrainedTokenizer.__call__` for details. decoder_attention_mask (:obj:`torch.BoolTensor` of shape :obj:`(batch_size, target_sequence_length)`, `optional`): Default behavior: generate a tensor that ignores pad tokens in :obj:`decoder_input_ids`. Causal mask will diff --git a/src/transformers/models/gpt2/modeling_gpt2.py b/src/transformers/models/gpt2/modeling_gpt2.py index bcfb8af80b10db..2a8fb28162053c 100644 --- a/src/transformers/models/gpt2/modeling_gpt2.py +++ b/src/transformers/models/gpt2/modeling_gpt2.py @@ -951,7 +951,7 @@ def forward( def _reorder_cache(past: Tuple[Tuple[torch.Tensor]], beam_idx: torch.Tensor) -> Tuple[Tuple[torch.Tensor]]: """ This function is used to re-order the :obj:`past_key_values` cache if - :meth:`~transformers.PretrainedModel.beam_search` or :meth:`~transformers.PretrainedModel.beam_sample` is + :meth:`~transformers.PreTrainedModel.beam_search` or :meth:`~transformers.PreTrainedModel.beam_sample` is called. This is required to match :obj:`past_key_values` with the correct beam_idx at every generation step. """ return tuple( @@ -1157,7 +1157,7 @@ def forward( def _reorder_cache(past: Tuple[Tuple[torch.Tensor]], beam_idx: torch.Tensor) -> Tuple[Tuple[torch.Tensor]]: """ This function is used to re-order the :obj:`past_key_values` cache if - :meth:`~transformers.PretrainedModel.beam_search` or :meth:`~transformers.PretrainedModel.beam_sample` is + :meth:`~transformers.PreTrainedModel.beam_search` or :meth:`~transformers.PreTrainedModel.beam_sample` is called. This is required to match :obj:`past_key_values` with the correct beam_idx at every generation step. """ return tuple( diff --git a/src/transformers/models/transfo_xl/modeling_transfo_xl.py b/src/transformers/models/transfo_xl/modeling_transfo_xl.py index b036cf71d8ad1a..8d0fa11e59eb61 100644 --- a/src/transformers/models/transfo_xl/modeling_transfo_xl.py +++ b/src/transformers/models/transfo_xl/modeling_transfo_xl.py @@ -1141,8 +1141,8 @@ def _resize_cutoffs(self, new_num_tokens, new_emb_size, new_embedding_shapes, la @staticmethod def _reorder_cache(mems: List[torch.Tensor], beam_idx: torch.Tensor) -> List[torch.Tensor]: """ - This function is used to re-order the :obj:`mems` cache if :meth:`~transformers.PretrainedModel.beam_search` or - :meth:`~transformers.PretrainedModel.beam_sample` is called. This is required to match :obj:`mems` with the + This function is used to re-order the :obj:`mems` cache if :meth:`~transformers.PreTrainedModel.beam_search` or + :meth:`~transformers.PreTrainedModel.beam_sample` is called. This is required to match :obj:`mems` with the correct beam_idx at every generation step. """ return [layer_past.index_select(1, beam_idx.to(layer_past.device)) for layer_past in mems] diff --git a/src/transformers/models/xlnet/modeling_xlnet.py b/src/transformers/models/xlnet/modeling_xlnet.py index 9d5813d21c70fe..7a6a51d456ca4c 100755 --- a/src/transformers/models/xlnet/modeling_xlnet.py +++ b/src/transformers/models/xlnet/modeling_xlnet.py @@ -1470,8 +1470,8 @@ def forward( @staticmethod def _reorder_cache(mems: List[torch.Tensor], beam_idx: torch.Tensor) -> List[torch.Tensor]: """ - This function is used to re-order the :obj:`mems` cache if :meth:`~transformers.PretrainedModel.beam_search` or - :meth:`~transformers.PretrainedModel.beam_sample` is called. This is required to match :obj:`mems` with the + This function is used to re-order the :obj:`mems` cache if :meth:`~transformers.PreTrainedModel.beam_search` or + :meth:`~transformers.PreTrainedModel.beam_sample` is called. This is required to match :obj:`mems` with the correct beam_idx at every generation step. """ return [layer_past.index_select(1, beam_idx.to(layer_past.device)) for layer_past in mems] diff --git a/src/transformers/pipelines/__init__.py b/src/transformers/pipelines/__init__.py index 638ac6ecef31ed..2455f47c09fb5a 100755 --- a/src/transformers/pipelines/__init__.py +++ b/src/transformers/pipelines/__init__.py @@ -351,7 +351,7 @@ def pipeline( # Impossible to guest what is the right tokenizer here raise Exception( "Impossible to guess which tokenizer to use. " - "Please provided a PretrainedTokenizer class or a path/identifier to a pretrained tokenizer." + "Please provided a PreTrainedTokenizer class or a path/identifier to a pretrained tokenizer." ) modelcard = None diff --git a/src/transformers/tokenization_utils_base.py b/src/transformers/tokenization_utils_base.py index 449a88d24f9b8b..6ccf3f48f7444d 100644 --- a/src/transformers/tokenization_utils_base.py +++ b/src/transformers/tokenization_utils_base.py @@ -1930,7 +1930,7 @@ def _save_pretrained( """ if not legacy_format: raise ValueError( - "Only fast tokenizers (instances of PretrainedTokenizerFast) can be saved in non legacy format." + "Only fast tokenizers (instances of PreTrainedTokenizerFast) can be saved in non legacy format." ) save_directory = str(save_directory)