text
stringlengths
31
243k
type
stringclasses
1 value
start
int64
36
275k
end
int64
286
280k
depth
int64
0
1
filepath
stringlengths
85
188
parent_class
stringclasses
3 values
class_index
int64
0
10.8k
class TFLogitsProcessorList(list): """ This class can be used to create a list of [`TFLogitsProcessor`] to subsequently process a `scores` input tensor. This class inherits from list and adds a specific *__call__* method to apply each [`TFLogitsProcessor`] to the inputs. """ @add_start_docstrin...
class_definition
2,976
4,096
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/tf_logits_process.py
null
10,700
class TFTemperatureLogitsWarper(TFLogitsWarper): r""" [`TFLogitsWarper`] for temperature (exponential scaling output probability distribution). Args: temperature (`float`): The value used to module the logits distribution. """ def __init__(self, temperature: float): if ...
class_definition
4,099
4,782
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/tf_logits_process.py
null
10,701
class TFTopKLogitsWarper(TFLogitsWarper): r""" [`TFLogitsWarper`] that performs top-k, i.e. restricting to the k highest probability elements. Args: top_k (`int`): The number of highest probability vocabulary tokens to keep for top-k-filtering. filter_value (`float`, *optional*,...
class_definition
4,785
6,113
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/tf_logits_process.py
null
10,702
class TFTopPLogitsWarper(TFLogitsWarper): """ [`TFLogitsWarper`] that performs top-p, i.e. restricting to top tokens summing to <= prob_cut_off. Args: top_p (`float`): If set to < 1, only the smallest set of most probable tokens with probabilities that add up to `top_p` or h...
class_definition
6,116
8,982
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/tf_logits_process.py
null
10,703
class TFMinLengthLogitsProcessor(TFLogitsProcessor): r""" [`TFLogitsProcessor`] enforcing a min-length by setting EOS probability to 0. Args: min_length (`int`): The minimum length below which the score of `eos_token_id` is set to `-float("Inf")`. eos_token_id (`int`): ...
class_definition
8,985
10,416
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/tf_logits_process.py
null
10,704
class TFRepetitionPenaltyLogitsProcessor(TFLogitsProcessor): r""" [`TFLogitsProcessor`] enforcing an exponential penalty on repeated sequences. Args: repetition_penalty (`float`): The parameter for repetition penalty. 1.0 means no penalty. See [this paper](https://arxiv.org/...
class_definition
10,419
12,631
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/tf_logits_process.py
null
10,705
class TFNoBadWordsLogitsProcessor(TFLogitsProcessor): """ [`TFLogitsProcessor`] that enforces that specified sequences will never be sampled. Args: bad_words_ids (`List[List[int]]`): List of list of token ids that are not allowed to be generated. In order to get the tokens of the words ...
class_definition
12,634
18,398
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/tf_logits_process.py
null
10,706
class TFNoRepeatNGramLogitsProcessor(TFLogitsProcessor): r""" [`TFLogitsProcessor`] that enforces no repetition of n-grams. See [Fairseq](https://github.com/pytorch/fairseq/blob/a07cb6f40480928c9e0548b737aadd36ee66ac76/fairseq/sequence_generator.py#L345). Args: ngram_size (`int`): A...
class_definition
18,401
21,283
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/tf_logits_process.py
null
10,707
class TFForcedBOSTokenLogitsProcessor(TFLogitsProcessor): r""" [`TFLogitsProcessor`] that enforces the specified token as the first generated token. Args: bos_token_id (`int`): The id of the token to force as the first generated token. """ def __init__(self, bos_token_id: int):...
class_definition
21,286
22,543
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/tf_logits_process.py
null
10,708
class TFForcedEOSTokenLogitsProcessor(TFLogitsProcessor): r""" [`TFLogitsProcessor`] that enforces the specified token as the last generated token when `max_length` is reached. Args: max_length (`int`): The maximum length of the sequence to be generated. eos_token_id (`int`): ...
class_definition
22,546
24,022
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/tf_logits_process.py
null
10,709
class TFSuppressTokensAtBeginLogitsProcessor(TFLogitsProcessor): r""" [`TFSuppressTokensAtBeginLogitsProcessor`] suppresses a list of tokens as soon as the `generate` function starts generating using `begin_index` tokens. This should ensure that the tokens defined by `begin_suppress_tokens` at not sampl...
class_definition
24,025
25,357
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/tf_logits_process.py
null
10,710
class TFSuppressTokensLogitsProcessor(TFLogitsProcessor): r"""This processor can be used to suppress a list of tokens. The processor will set their log probs to `-inf` so that they are not sampled.""" def __init__(self, suppress_tokens): self.suppress_tokens = list(suppress_tokens) def __call_...
class_definition
25,360
26,363
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/tf_logits_process.py
null
10,711
class TFForceTokensLogitsProcessor(TFLogitsProcessor): r"""This processor takes a list of pairs of integers which indicates a mapping from generation indices to token indices that will be forced before sampling. The processor will set their log probs to `0` and all other tokens to `-inf` so that they are sa...
class_definition
26,366
28,713
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/tf_logits_process.py
null
10,712
class StoppingCriteria(ABC): """Abstract base class for all stopping criteria that can be applied during generation. If your stopping criteria depends on the `scores` input, make sure you pass `return_dict_in_generate=True, output_scores=True` to `generate`. """ @add_start_docstrings(STOPPING_CRIT...
class_definition
1,751
2,280
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/stopping_criteria.py
null
10,713
class MaxLengthCriteria(StoppingCriteria): """ This class can be used to stop generation whenever the full generated number of tokens exceeds `max_length`. Keep in mind for decoder-only type of transformers, this will include the initial prompted tokens. Args: max_length (`int`): Th...
class_definition
2,283
3,849
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/stopping_criteria.py
null
10,714
class MaxTimeCriteria(StoppingCriteria): """ This class can be used to stop generation whenever the full generation exceeds some amount of time. By default, the time will start being counted when you initialize this function. You can override this by passing an `initial_time`. Args: max_tim...
class_definition
3,852
4,945
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/stopping_criteria.py
null
10,715
class StopStringCriteria(StoppingCriteria): """ This class can be used to stop generation whenever specific string sequences are generated. It preprocesses the strings together with the tokenizer vocab to find positions where tokens can validly complete the stop strings. Generation is stopped as soon a...
class_definition
4,948
25,429
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/stopping_criteria.py
null
10,716
class EosTokenCriteria(StoppingCriteria): """ This class can be used to stop generation whenever the "end-of-sequence" token is generated. By default, it uses the `model.generation_config.eos_token_id`. Args: eos_token_id (`Union[int, List[int], torch.Tensor]`): The id(s) of the *en...
class_definition
25,432
26,435
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/stopping_criteria.py
null
10,717
class ConfidenceCriteria(StoppingCriteria): """ This class can be used to stop generation whenever assistant model's confidence in its prediction for the current token is lower than the threshold `model.generation_config.assistant_confidence_threshold` even if the number of speculative tokens (defined b...
class_definition
26,438
27,339
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/stopping_criteria.py
null
10,718
class StoppingCriteriaList(list): @add_start_docstrings(STOPPING_CRITERIA_INPUTS_DOCSTRING) def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTensor, **kwargs) -> torch.BoolTensor: is_done = torch.full((input_ids.shape[0],), False, device=input_ids.device, dtype=torch.bool) for ...
class_definition
27,342
28,009
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/stopping_criteria.py
null
10,719
class CandidateGenerator: """Abstract base class for all candidate generators that can be applied during assisted generation.""" def get_candidates(self, input_ids: torch.LongTensor) -> Tuple[torch.LongTensor, Optional[torch.FloatTensor]]: """ Fetches the candidates to be tried for the current ...
class_definition
1,176
3,271
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/candidate_generator.py
null
10,720
class AssistedCandidateGenerator(CandidateGenerator): """ `CandidateGenerator` class to be used for assisted generation and speculative decoding. This class generates candidates through the use of a smaller model. Read the following blog post for more information: https://huggingface.co/blog/assisted-ge...
class_definition
3,274
17,291
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/candidate_generator.py
null
10,721
class AssistedCandidateGeneratorDifferentTokenizers(AssistedCandidateGenerator): """ `CandidateGenerator` class to be used for Universal Assisted Generation (UAD): assisted generation with different tokenizers for the assistant and main models. This class generates candidates through the use of a smaller ...
class_definition
17,294
31,169
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/candidate_generator.py
null
10,722
class PromptLookupCandidateGenerator(CandidateGenerator): """ `CandidateGenerator` class to be used for prompt lookup generation. This class generates candidates by looking up likely continuations in the provided prompt (input_ids) itself. Read the following blog post for more information: https://githu...
class_definition
31,172
36,597
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/candidate_generator.py
null
10,723
class EarlyExitCandidateGenerator(AssistedCandidateGenerator): """ `CandidateGenerator` class to be used for assisted generation and speculative decoding. This class generates candidates through the use of **the model itself**, exiting early. Can only be used with models that support early exit, e.g., `...
class_definition
36,600
39,611
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/candidate_generator.py
null
10,724
class WatermarkDetectorOutput: """ Outputs of a watermark detector. Args: num_tokens_scored (np.array of shape (batch_size)): Array containing the number of tokens scored for each element in the batch. num_green_tokens (np.array of shape (batch_size)): Array containi...
class_definition
1,216
2,800
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/watermarking.py
null
10,725
class WatermarkDetector: r""" Detector for detection of watermark generated text. The detector needs to be given the exact same settings that were given during text generation to replicate the watermark greenlist generation and so detect the watermark. This includes the correct device that was used duri...
class_definition
2,803
11,084
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/watermarking.py
null
10,726
class BayesianDetectorConfig(PretrainedConfig): """ This is the configuration class to store the configuration of a [`BayesianDetectorModel`]. It is used to instantiate a Bayesian Detector model according to the specified arguments. Configuration objects inherit from [`PretrainedConfig`] and can be use...
class_definition
11,087
12,274
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/watermarking.py
null
10,727
class BayesianWatermarkDetectorModelOutput(ModelOutput): """ Base class for outputs of models predicting if the text is watermarked. Args: loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided): Language modeling loss. posterior_probabilities ...
class_definition
12,288
12,813
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/watermarking.py
null
10,728
class BayesianDetectorWatermarkedLikelihood(nn.Module): """Watermarked likelihood model for binary-valued g-values. This takes in g-values and returns p(g_values|watermarked). """ def __init__(self, watermarking_depth: int): """Initializes the model parameters.""" super().__init__() ...
class_definition
12,816
15,680
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/watermarking.py
null
10,729
class BayesianDetectorModel(PreTrainedModel): r""" Bayesian classifier for watermark detection. This detector uses Bayes' rule to compute a watermarking score, which is the sigmoid of the log of ratio of the posterior probabilities P(watermarked|g_values) and P(unwatermarked|g_values). Please see the s...
class_definition
15,683
21,423
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/watermarking.py
null
10,730
class SynthIDTextWatermarkDetector: r""" SynthID text watermark detector class. This class has to be initialized with the trained bayesian detector module check script in examples/synthid_text/detector_training.py for example in training/saving/loading this detector module. The folder also showcase...
class_definition
21,426
24,415
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/watermarking.py
null
10,731
class BeamScorer(ABC): """ Abstract base class for all beam scorers that are used for [`~PreTrainedModel.beam_search`] and [`~PreTrainedModel.beam_sample`]. """ @abstractmethod @add_start_docstrings(PROCESS_INPUTS_DOCSTRING) def process( self, input_ids: torch.LongTensor, ...
class_definition
4,463
5,409
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/beam_search.py
null
10,732
class BeamSearchScorer(BeamScorer): r""" [`BeamScorer`] implementing standard beam search decoding. Adapted in part from [Facebook's XLM beam search code](https://github.com/facebookresearch/XLM/blob/9e6f6814d17be4fe5b15f2e6c43eb2b2d76daeb4/src/model/transformer.py#L529). Reference for the diverse...
class_definition
5,412
20,004
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/beam_search.py
null
10,733
class ConstrainedBeamSearchScorer(BeamScorer): r""" [`BeamScorer`] implementing constrained beam search decoding. Args: batch_size (`int`): Batch Size of `input_ids` for which standard beam search decoding is run in parallel. num_beams (`int`): Number of beams for b...
class_definition
20,007
45,576
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/beam_search.py
null
10,734
class BeamHypotheses: def __init__(self, num_beams: int, length_penalty: float, early_stopping: bool, max_length: Optional[int] = None): """ Initialize n-best list of hypotheses. """ self.length_penalty = length_penalty self.early_stopping = early_stopping self.max_le...
class_definition
45,579
49,535
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/beam_search.py
null
10,735
class BaseStreamer: """ Base class from which `.generate()` streamers should inherit. """ def put(self, value): """Function that is called by `.generate()` to push new tokens""" raise NotImplementedError() def end(self): """Function that is called by `.generate()` to signal...
class_definition
790
1,171
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/streamers.py
null
10,736
class TextStreamer(BaseStreamer): """ Simple text streamer that prints the token(s) to stdout as soon as entire words are formed. <Tip warning={true}> The API for the streamer classes is still under development and may change in the future. </Tip> Parameters: tokenizer (`AutoTokenize...
class_definition
1,174
6,310
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/streamers.py
null
10,737
class TextIteratorStreamer(TextStreamer): """ Streamer that stores print-ready text in a queue, to be used by a downstream application as an iterator. This is useful for applications that benefit from acessing the generated text in a non-blocking way (e.g. in an interactive Gradio demo). <Tip warni...
class_definition
6,313
9,263
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/streamers.py
null
10,738
class AsyncTextIteratorStreamer(TextStreamer): """ Streamer that stores print-ready text in a queue, to be used by a downstream application as an async iterator. This is useful for applications that benefit from acessing the generated text asynchronously (e.g. in an interactive Gradio demo). <Tip w...
class_definition
9,266
13,025
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/streamers.py
null
10,739
class GenerateDecoderOnlyOutput(ModelOutput): """ Outputs of decoder-only generation models, when using non-beam methods. Args: sequences (`torch.LongTensor` of shape `(batch_size, sequence_length)`): The generated sequences. The second dimension (sequence_length) is either equal to `ma...
class_definition
3,694
6,275
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/utils.py
null
10,740
class GenerateEncoderDecoderOutput(ModelOutput): """ Outputs of encoder-decoder generation models, when using non-beam methods. Args: sequences (`torch.LongTensor` of shape `(batch_size*num_return_sequences, sequence_length)`): The generated sequences. The second dimension (sequence_len...
class_definition
6,289
10,073
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/utils.py
null
10,741
class GenerateBeamDecoderOnlyOutput(ModelOutput): """ Outputs of decoder-only generation models, when using beam methods. Args: sequences (`torch.LongTensor` of shape `(batch_size*num_return_sequences, sequence_length)`): The generated sequences. The second dimension (sequence_length) i...
class_definition
10,087
13,397
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/utils.py
null
10,742
class GenerateBeamEncoderDecoderOutput(ModelOutput): """ Outputs of encoder-decoder generation models, when using beam methods. Args: sequences (`torch.LongTensor` of shape `(batch_size*num_return_sequences, sequence_length)`): The generated sequences. The second dimension (sequence_len...
class_definition
13,411
17,925
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/utils.py
null
10,743
class GenerationMixin: """ A class containing all functions for auto-regressive text generation, to be used as a mixin in [`PreTrainedModel`]. The class exposes [`~generation.GenerationMixin.generate`], which can be used for: - *greedy decoding* if `num_beams=1` and `do_sample=False` - *con...
class_definition
19,398
237,926
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/utils.py
null
10,744
class TFGreedySearchDecoderOnlyOutput(ModelOutput): """ Base class for outputs of decoder-only generation models using greedy search. Args: sequences (`tf.Tensor` of shape `(batch_size, sequence_length)`): The generated sequences. The second dimension (sequence_length) is either equal ...
class_definition
1,894
3,678
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/tf_utils.py
null
10,745
class TFGreedySearchEncoderDecoderOutput(ModelOutput): """ Base class for outputs of encoder-decoder generation models using greedy search. Hidden states and attention weights of the decoder (respectively the encoder) can be accessed via the encoder_attentions and the encoder_hidden_states attributes (r...
class_definition
3,692
6,936
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/tf_utils.py
null
10,746
class TFSampleDecoderOnlyOutput(ModelOutput): """ Base class for outputs of decoder-only generation models using sampling. Args: sequences (`tf.Tensor` of shape `(batch_size*num_return_sequences, sequence_length)`): The generated sequences. The second dimension (sequence_length) is eit...
class_definition
6,950
8,807
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/tf_utils.py
null
10,747
class TFSampleEncoderDecoderOutput(ModelOutput): """ Base class for outputs of encoder-decoder generation models using sampling. Hidden states and attention weights of the decoder (respectively the encoder) can be accessed via the encoder_attentions and the encoder_hidden_states attributes (respectively...
class_definition
8,821
12,180
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/tf_utils.py
null
10,748
class TFBeamSearchDecoderOnlyOutput(ModelOutput): """ Base class for outputs of decoder-only generation models using beam search. Args: sequences (`tf.Tensor` of shape `(batch_size*num_return_sequences, sequence_length)`): The generated sequences. The second dimension (sequence_length) ...
class_definition
12,194
14,779
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/tf_utils.py
null
10,749
class TFBeamSearchEncoderDecoderOutput(ModelOutput): """ Base class for outputs of encoder-decoder generation models using beam search. Hidden states and attention weights of the decoder (respectively the encoder) can be accessed via the encoder_attentions and the encoder_hidden_states attributes (respe...
class_definition
14,793
18,882
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/tf_utils.py
null
10,750
class TFBeamSampleDecoderOnlyOutput(ModelOutput): """ Base class for outputs of decoder-only generation models using beam sample. Args: sequences (`tf.Tensor` of shape `(batch_size*num_return_sequences, sequence_length)`): The generated sequences. The second dimension (sequence_length) ...
class_definition
18,896
21,461
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/tf_utils.py
null
10,751
class TFBeamSampleEncoderDecoderOutput(ModelOutput): """ Base class for outputs of encoder-decoder generation models using beam sampling. Hidden states and attention weights of the decoder (respectively the encoder) can be accessed via the encoder_attentions and the encoder_hidden_states attributes (res...
class_definition
21,475
25,480
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/tf_utils.py
null
10,752
class TFContrastiveSearchDecoderOnlyOutput(ModelOutput): """ Base class for outputs of decoder-only generation models using contrastive search. Args: sequences (`tf.Tensor` of shape `(batch_size, sequence_length)`): The generated sequences. The second dimension (sequence_length) is eith...
class_definition
25,494
27,287
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/tf_utils.py
null
10,753
class TFContrastiveSearchEncoderDecoderOutput(ModelOutput): """ Base class for outputs of encoder-decoder generation models using contrastive search. Hidden states and attention weights of the decoder (respectively the encoder) can be accessed via the encoder_attentions and the encoder_hidden_states att...
class_definition
27,301
30,554
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/tf_utils.py
null
10,754
class TFGenerationMixin: """ A class containing all of the functions supporting generation, to be used as a mixin in [`TFPreTrainedModel`]. The class exposes [`~generation.TFGenerationMixin.generate`], which can be used for: - *greedy decoding* by calling [`~generation.TFGenerationMixin.greedy_sear...
class_definition
31,170
173,460
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/tf_utils.py
null
10,755
class FlaxLogitsProcessor: """Abstract base class for all logit processors that can be applied during generation.""" @add_start_docstrings(LOGITS_PROCESSOR_INPUTS_DOCSTRING) def __call__(self, input_ids: jnp.ndarray, scores: jnp.ndarray) -> jnp.ndarray: """Flax method for processing logits.""" ...
class_definition
1,743
2,207
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/flax_logits_process.py
null
10,756
class FlaxLogitsWarper: """Abstract base class for all logit warpers that can be applied during generation with multinomial sampling.""" @add_start_docstrings(LOGITS_PROCESSOR_INPUTS_DOCSTRING) def __call__(self, input_ids: jnp.ndarray, scores: jnp.ndarray) -> jnp.ndarray: """Flax method for warpin...
class_definition
2,210
2,691
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/flax_logits_process.py
null
10,757
class FlaxLogitsProcessorList(list): """ This class can be used to create a list of [`FlaxLogitsProcessor`] or [`FlaxLogitsWarper`] to subsequently process a `scores` input tensor. This class inherits from list and adds a specific *__call__* method to apply each [`FlaxLogitsProcessor`] or [`FlaxLogitsWa...
class_definition
2,694
3,871
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/flax_logits_process.py
null
10,758
class FlaxTemperatureLogitsWarper(FlaxLogitsWarper): r""" [`FlaxLogitsWarper`] for temperature (exponential scaling output probability distribution). Args: temperature (`float`): The value used to module the logits distribution. """ def __init__(self, temperature: float): ...
class_definition
3,874
4,569
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/flax_logits_process.py
null
10,759
class FlaxTopPLogitsWarper(FlaxLogitsWarper): """ [`FlaxLogitsWarper`] that performs top-p, i.e. restricting to top tokens summing to prob_cut_off <= prob_cut_off. Args: top_p (`float`): If set to < 1, only the smallest set of most probable tokens with probabilities that add up to `top_...
class_definition
4,572
6,592
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/flax_logits_process.py
null
10,760
class FlaxTopKLogitsWarper(FlaxLogitsWarper): r""" [`FlaxLogitsWarper`] that performs top-k, i.e. restricting to the k highest probability elements. Args: top_k (`int`): The number of highest probability vocabulary tokens to keep for top-k-filtering. filter_value (`float`, *opti...
class_definition
6,595
8,240
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/flax_logits_process.py
null
10,761
class FlaxForcedBOSTokenLogitsProcessor(FlaxLogitsProcessor): r""" [`FlaxLogitsProcessor`] that enforces the specified token as the first generated token. Args: bos_token_id (`int`): The id of the token to force as the first generated token. """ def __init__(self, bos_token_id:...
class_definition
8,243
8,938
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/flax_logits_process.py
null
10,762
class FlaxForcedEOSTokenLogitsProcessor(FlaxLogitsProcessor): r""" [`FlaxLogitsProcessor`] that enforces the specified token as the last generated token when `max_length` is reached. Args: max_length (`int`): The maximum length of the sequence to be generated. eos_token_id (`int...
class_definition
8,941
9,856
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/flax_logits_process.py
null
10,763
class FlaxMinLengthLogitsProcessor(FlaxLogitsProcessor): r""" [`FlaxLogitsProcessor`] enforcing a min-length by setting EOS probability to 0. Args: min_length (`int`): The minimum length below which the score of `eos_token_id` is set to `-float("Inf")`. eos_token_id (`int`): ...
class_definition
9,859
11,074
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/flax_logits_process.py
null
10,764
class FlaxSuppressTokensAtBeginLogitsProcessor(FlaxLogitsProcessor): r""" [`FlaxLogitsProcessor`] supressing a list of tokens as soon as the `generate` function starts generating using `begin_index` tokens. This should ensure that the tokens defined by `begin_suppress_tokens` are not sampled at the begi...
class_definition
11,077
12,023
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/flax_logits_process.py
null
10,765
class FlaxSuppressTokensLogitsProcessor(FlaxLogitsProcessor): r""" [`FlaxLogitsProcessor`] suppressing a list of tokens at each decoding step. The processor will set their log probs to be `-inf` so they are not sampled. Args: suppress_tokens (`list`): Tokens to not sample. """ ...
class_definition
12,026
12,640
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/flax_logits_process.py
null
10,766
class FlaxForceTokensLogitsProcessor(FlaxLogitsProcessor): r""" [`FlaxLogitsProcessor`] that takes a list of pairs of integers which indicates a mapping from generation indices to token indices that will be forced before sampling. The processor will set their log probs to 0 and all other tokens to `-inf...
class_definition
12,643
14,979
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/flax_logits_process.py
null
10,767
class FlaxWhisperTimeStampLogitsProcessor(FlaxLogitsProcessor): r""" Whisper specific Processor. This processor can be used to force a list of tokens. The processor will set their log probs to `inf` so that they are sampled at their corresponding index. Args: generate_config (`GenerateConfig`):...
class_definition
14,982
19,232
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/flax_logits_process.py
null
10,768
class FlaxNoRepeatNGramLogitsProcessor(FlaxLogitsProcessor): r""" [`FlaxLogitsProcessor`] that enforces no repetition of n-grams. See [Fairseq](https://github.com/pytorch/fairseq/blob/a07cb6f40480928c9e0548b737aadd36ee66ac76/fairseq/sequence_generator.py#L345). Args: ngram_size (`int`): ...
class_definition
19,235
23,006
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/flax_logits_process.py
null
10,769
class Constraint(ABC): r"""Abstract base class for all constraints that can be applied during generation. It must define how the constraint can be satisfied. All classes that inherit Constraint must follow the requirement that ```py completed = False while not completed: _, completed =...
class_definition
72
4,675
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/beam_constraints.py
null
10,770
class PhrasalConstraint(Constraint): r""" [`Constraint`] enforcing that an ordered sequence of tokens is included in the output. Args: token_ids (`List[int]`): The id of the token that must be generated by the output. """ def __init__(self, token_ids: List[int]): super(...
class_definition
4,678
7,136
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/beam_constraints.py
null
10,771
class DisjunctiveTrie: def __init__(self, nested_token_ids: List[List[int]], no_subsets=True): r""" A helper class that builds a trie with the words represented in `nested_token_ids`. """ self.max_height = max([len(one) for one in nested_token_ids]) root = {} for tok...
class_definition
7,139
8,945
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/beam_constraints.py
null
10,772
class DisjunctiveConstraint(Constraint): r""" A special [`Constraint`] that is fulfilled by fulfilling just one of several constraints. Args: nested_token_ids (`List[List[int]]`): A list of words, where each word is a list of ids. This constraint is fulfilled by generating just one from...
class_definition
8,948
12,003
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/beam_constraints.py
null
10,773
class ConstraintListState: r""" A class for beam scorers to track its progress through a list of constraints. Args: constraints (`List[Constraint]`): A list of [`Constraint`] objects that must be fulfilled by the beam scorer. """ def __init__(self, constraints: List[Constraint]...
class_definition
12,006
19,273
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/generation/beam_constraints.py
null
10,774
class SageMakerTrainer(Trainer): def __init__(self, args=None, **kwargs): warnings.warn( "`SageMakerTrainer` is deprecated and will be removed in v5 of Transformers. You can use `Trainer` " "instead.", FutureWarning, ) super().__init__(args=args, **kwargs)
class_definition
723
1,043
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/sagemaker/trainer_sm.py
null
10,775
class SageMakerTrainingArguments(TrainingArguments): mp_parameters: str = field( default="", metadata={"help": "Used by the SageMaker launcher to send mp-specific args. Ignored in SageMakerTrainer"}, ) def __post_init__(self): super().__post_init__() warnings.warn( ...
class_definition
2,085
5,388
0
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/sagemaker/training_args_sm.py
null
10,776