text
stringlengths
1
1.02k
class_index
int64
0
10.8k
source
stringlengths
85
188
<Tip> `nan_inf_filter` only influences the logging of loss values, it does not change the behavior the gradient is computed or applied to the model. </Tip> on_each_node (`bool`, *optional*, defaults to `True`): In multinode distributed train...
179
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py
>>> args = TrainingArguments("working_dir") >>> args = args.set_logging(strategy="steps", steps=100) >>> args.logging_steps 100 ``` """ self.logging_strategy = IntervalStrategy(strategy) if self.logging_strategy == IntervalStrategy.STEPS and steps == 0: ...
179
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py
def set_push_to_hub( self, model_id: str, strategy: Union[str, HubStrategy] = "every_save", token: Optional[str] = None, private_repo: Optional[bool] = None, always_push: bool = False, ): """ A method that regroups all arguments linked to synchronizing...
179
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py
Args: model_id (`str`): The name of the repository to keep in sync with the local *output_dir*. It can be a simple model ID in which case the model will be pushed in your namespace. Otherwise it should be the whole repository name, for instance `"user_name/mod...
179
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py
- `"end"`: push the model, its configuration, the processing_class e.g. tokenizer (if passed along to the [`Trainer`]) and a draft of a model card when the [`~Trainer.save_model`] method is called. - `"every_save"`: push the model, its configuration, the processing_class e.g. tokenizer (...
179
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py
- `"all_checkpoints"`: like `"checkpoint"` but all checkpoints are pushed like they appear in the output folder (so you will get one checkpoint folder per folder in your final repository)
179
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py
token (`str`, *optional*): The token to use to push the model to the Hub. Will default to the token in the cache folder obtained with `huggingface-cli login`. private_repo (`bool`, *optional*, defaults to `False`): Whether to make the repo private. If `None` (...
179
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py
>>> args = TrainingArguments("working_dir") >>> args = args.set_push_to_hub("me/awesome-model") >>> args.hub_model_id 'me/awesome-model' ``` """ self.push_to_hub = True self.hub_model_id = model_id self.hub_strategy = HubStrategy(strategy) self.hub...
179
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py
Args: name (`str` or [`training_args.OptimizerNames`], *optional*, defaults to `"adamw_torch"`): The optimizer to use: `"adamw_hf"`, `"adamw_torch"`, `"adamw_torch_fused"`, `"adamw_apex_fused"`, `"adamw_anyprecision"` or `"adafactor"`. learning_rate (`float`, *opt...
179
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py
args (`str`, *optional*): Optional arguments that are supplied to AnyPrecisionAdamW (only useful when `optim="adamw_anyprecision"`).
179
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py
Example: ```py >>> from transformers import TrainingArguments >>> args = TrainingArguments("working_dir") >>> args = args.set_optimizer(name="adamw_torch", beta1=0.8) >>> args.optim 'adamw_torch' ``` """ self.optim = OptimizerNames(name) ...
179
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py
Args: name (`str` or [`SchedulerType`], *optional*, defaults to `"linear"`): The scheduler type to use. See the documentation of [`SchedulerType`] for all possible values. num_epochs(`float`, *optional*, defaults to 3.0): Total number of training epochs to perform...
179
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py
Number of steps used for a linear warmup from 0 to `learning_rate`. Overrides any effect of `warmup_ratio`.
179
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py
Example: ```py >>> from transformers import TrainingArguments >>> args = TrainingArguments("working_dir") >>> args = args.set_lr_scheduler(name="cosine", warmup_ratio=0.05) >>> args.warmup_ratio 0.05 ``` """ self.lr_scheduler_type = SchedulerType...
179
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py
def set_dataloader( self, train_batch_size: int = 8, eval_batch_size: int = 8, drop_last: bool = False, num_workers: int = 0, pin_memory: bool = True, persistent_workers: bool = False, prefetch_factor: Optional[int] = None, auto_find_batch_size: bo...
179
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py
Args: drop_last (`bool`, *optional*, defaults to `False`): Whether to drop the last incomplete batch (if the length of the dataset is not divisible by the batch size) or not. num_workers (`int`, *optional*, defaults to 0): Number of subprocesses to...
179
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py
prefetch_factor (`int`, *optional*): Number of batches loaded in advance by each worker. 2 means there will be a total of 2 * num_workers batches prefetched across all workers. auto_find_batch_size (`bool`, *optional*, defaults to `False`) Whether to find a ba...
179
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py
Random seed to be used with data samplers. If not set, random generators for data sampling will use the same seed as `self.seed`. This can be used to ensure reproducibility of data sampling, independent of the model seed.
179
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py
Example: ```py >>> from transformers import TrainingArguments >>> args = TrainingArguments("working_dir") >>> args = args.set_dataloader(train_batch_size=16, eval_batch_size=64) >>> args.per_device_train_batch_size 16 ``` """ self.per_device_trai...
179
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py
class ParallelMode(Enum): NOT_PARALLEL = "not_parallel" NOT_DISTRIBUTED = "not_distributed" DISTRIBUTED = "distributed" SAGEMAKER_MODEL_PARALLEL = "sagemaker_model_parallel" SAGEMAKER_DATA_PARALLEL = "sagemaker_data_parallel" TPU = "tpu"
180
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/training_args.py
class GGUFTensor(NamedTuple): weights: np.ndarray name: str metadata: dict
181
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_gguf_pytorch_utils.py
class TensorProcessor: def __init__(self, config=None): self.config = config or {} def process(self, weights, name, **kwargs): return GGUFTensor(weights, name, {})
182
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_gguf_pytorch_utils.py
class LlamaTensorProcessor(TensorProcessor): def __init__(self, config=None): super().__init__(config=config) def process(self, weights, name, **kwargs): if ".attn_k." in name or ".attn_q." in name: num_heads = self.config.get("num_attention_heads") num_kv_heads = self.c...
183
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_gguf_pytorch_utils.py
def _reverse_permute_weights( self, weights: np.ndarray, n_head: int, num_kv_heads: Optional[int] = None ) -> np.ndarray: # Original permutation implementation # https://github.com/ggerganov/llama.cpp/blob/a38b884c6c4b0c256583acfaaabdf556c62fabea/convert_hf_to_gguf.py#L1402-L1408 if ...
183
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_gguf_pytorch_utils.py
class Qwen2MoeTensorProcessor(TensorProcessor): def __init__(self, config=None): super().__init__(config=config) def process(self, weights, name, **kwargs): if "_exp" in name: tensor_key_mapping = kwargs.get("tensor_key_mapping") parsed_parameters = kwargs.get("parsed_pa...
184
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_gguf_pytorch_utils.py
def _split_moe_expert_tensor( self, weights: np.ndarray, parsed_parameters: Dict[str, Dict], name: str, tensor_key_mapping: dict ): # Original merge implementation # https://github.com/ggerganov/llama.cpp/blob/master/convert_hf_to_gguf.py#L1994-L2022 name = tensor_key_mapping[name] ...
184
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_gguf_pytorch_utils.py
class BloomTensorProcessor(TensorProcessor): def __init__(self, config=None): super().__init__(config=config) def process(self, weights, name, **kwargs): if "attn_qkv" in name: num_heads = self.config["n_head"] n_embed = self.config["hidden_size"] if "weight"...
185
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_gguf_pytorch_utils.py
q = q.reshape(n_head, n_embed // n_head, n_embed) k = k.reshape(n_head, n_embed // n_head, n_embed) v = v.reshape(n_head, n_embed // n_head, n_embed) qkv_weights = np.stack([q, k, v], axis=1) return qkv_weights.reshape(n_head * 3 * (n_embed // n_head), n_embed) def _reverse_reshape...
185
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_gguf_pytorch_utils.py
class T5TensorProcessor(TensorProcessor): def __init__(self, config=None): super().__init__(config=config) def process(self, weights, name, **kwargs): bid = None for chunk in name.split("."): if chunk.isdigit(): bid = int(chunk) break ...
186
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_gguf_pytorch_utils.py
class GPT2TensorProcessor(TensorProcessor): def __init__(self, config=None): super().__init__(config=config) def process(self, weights, name, **kwargs): # Original transpose implementation # https://github.com/ggerganov/llama.cpp/blob/a38b884c6c4b0c256583acfaaabdf556c62fabea/convert_hf_...
187
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_gguf_pytorch_utils.py
# Handle special case for output.weight if name == "output.weight": # output.weight has conflicts with attn_output.weight in name checking # Store the tensor directly and signal to skip further processing name = "lm_head.weight" parsed_parameters = kwargs.get("par...
187
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_gguf_pytorch_utils.py
class MambaTensorProcessor(TensorProcessor): def __init__(self, config=None): super().__init__(config=config) def process(self, weights, name, **kwargs): if "ssm_conv1d.weight" in name: # for compatibility tensor ssm_conv1d must be (5120, 1, 4]) dim, # quantized one is (...
188
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_gguf_pytorch_utils.py
class NemotronTensorProcessor(TensorProcessor): def __init__(self, config=None): super().__init__(config=config) # ref : https://github.com/ggerganov/llama.cpp/blob/master/convert_hf_to_gguf.py#L4666 def process(self, weights, name, **kwargs): if "norm.weight" in name: weights =...
189
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_gguf_pytorch_utils.py
class Gemma2TensorProcessor(TensorProcessor): def __init__(self, config=None): super().__init__(config=config) # ref: https://github.com/ggerganov/llama.cpp/blob/d79d8f39b4da6deca4aea8bf130c6034c482b320/convert_hf_to_gguf.py#L3191 # ref: https://github.com/huggingface/transformers/blob/fc37f3891537...
190
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_gguf_pytorch_utils.py
class FlaxBaseModelOutput(ModelOutput): """ Base class for model's outputs, with potential hidden states and attentions. Args: last_hidden_state (`jnp.ndarray` of shape `(batch_size, sequence_length, hidden_size)`): Sequence of hidden-states at the output of the last layer of the model....
191
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_flax_outputs.py
Hidden-states of the model at the output of each layer plus the initial embedding outputs. attentions (`tuple(jnp.ndarray)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): Tuple of `jnp.ndarray` (one for each layer) of shape `(batch_size, num_h...
191
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_flax_outputs.py
class FlaxBaseModelOutputWithNoAttention(ModelOutput): """ Base class for model's outputs, with potential hidden states. Args: last_hidden_state (`jnp.ndarray` of shape `(batch_size, num_channels, height, width)`): Sequence of hidden-states at the output of the last layer of the model. ...
192
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_flax_outputs.py
class FlaxBaseModelOutputWithPoolingAndNoAttention(ModelOutput): """ Base class for model's outputs that also contains a pooling of the last hidden states. Args: last_hidden_state (`jnp.ndarray` of shape `(batch_size, num_channels, height, width)`): Sequence of hidden-states at the outp...
193
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_flax_outputs.py
last_hidden_state: jnp.ndarray = None pooler_output: jnp.ndarray = None hidden_states: Optional[Tuple[jnp.ndarray]] = None
193
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_flax_outputs.py
class FlaxImageClassifierOutputWithNoAttention(ModelOutput): """ Base class for outputs of image classification models. Args: logits (`jnp.ndarray` of shape `(batch_size, config.num_labels)`): Classification (or regression if config.num_labels==1) scores (before SoftMax). hidden...
194
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_flax_outputs.py
class FlaxBaseModelOutputWithPast(ModelOutput): """ Base class for model's outputs, with potential hidden states and attentions. Args: last_hidden_state (`jnp.ndarray` of shape `(batch_size, sequence_length, hidden_size)`): Sequence of hidden-states at the output of the last layer of th...
195
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_flax_outputs.py
Hidden-states of the model at the output of each layer plus the initial embedding outputs. attentions (`tuple(jnp.ndarray)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): Tuple of `jnp.ndarray` (one for each layer) of shape `(batch_size, num_h...
195
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_flax_outputs.py
class FlaxBaseModelOutputWithPooling(ModelOutput): """ Base class for model's outputs that also contains a pooling of the last hidden states.
196
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_flax_outputs.py
Args: last_hidden_state (`jnp.ndarray` of shape `(batch_size, sequence_length, hidden_size)`): Sequence of hidden-states at the output of the last layer of the model. pooler_output (`jnp.ndarray` of shape `(batch_size, hidden_size)`): Last layer hidden-state of the first token of...
196
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_flax_outputs.py
Hidden-states of the model at the output of each layer plus the initial embedding outputs. attentions (`tuple(jnp.ndarray)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): Tuple of `jnp.ndarray` (one for each layer) of shape `(batch_size, num_h...
196
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_flax_outputs.py
class FlaxBaseModelOutputWithPoolingAndCrossAttentions(ModelOutput): """ Base class for model's outputs that also contains a pooling of the last hidden states.
197
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_flax_outputs.py
Args: last_hidden_state (`jnp.ndarray` of shape `(batch_size, sequence_length, hidden_size)`): Sequence of hidden-states at the output of the last layer of the model. pooler_output (`jnp.ndarray` of shape `(batch_size, hidden_size)`): Last layer hidden-state of the first token of...
197
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_flax_outputs.py
for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`.
197
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_flax_outputs.py
Hidden-states of the model at the output of each layer plus the optional initial embedding outputs. attentions (`tuple(jnp.ndarray)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): Tuple of `jnp.ndarray` (one for each layer) of shape `(batch_si...
197
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_flax_outputs.py
Attentions weights of the decoder's cross-attention layer, after the attention softmax, used to compute the weighted average in the cross-attention heads. past_key_values (`tuple(tuple(jnp.ndarray))`, *optional*, returned when `use_cache=True` is passed or when `config.use_cache=True`): ...
197
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_flax_outputs.py
last_hidden_state: jnp.ndarray = None pooler_output: jnp.ndarray = None hidden_states: Optional[Tuple[jnp.ndarray]] = None past_key_values: Optional[Tuple[Tuple[jnp.ndarray]]] = None attentions: Optional[Tuple[jnp.ndarray]] = None cross_attentions: Optional[Tuple[jnp.ndarray]] = None
197
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_flax_outputs.py
class FlaxBaseModelOutputWithPastAndCrossAttentions(ModelOutput): """ Base class for model's outputs that may also contain a past key/values (to speed up sequential decoding). Args: last_hidden_state (`jnp.ndarray` of shape `(batch_size, sequence_length, hidden_size)`): Sequence of hidd...
198
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_flax_outputs.py
If `past_key_values` is used only the last hidden-state of the sequences of shape `(batch_size, 1, hidden_size)` is output. past_key_values (`tuple(tuple(jnp.ndarray))`, *optional*, returned when `use_cache=True` is passed or when `config.use_cache=True`): Tuple of `tuple(jnp.ndarray)` o...
198
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_flax_outputs.py
Contains pre-computed hidden-states (key and values in the self-attention blocks and optionally if `config.is_encoder_decoder=True` in the cross-attention blocks) that can be used (see `past_key_values` input) to speed up sequential decoding. hidden_states (`tuple(jnp.ndarray)`, *optiona...
198
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_flax_outputs.py
Attentions weights after the attention softmax, used to compute the weighted average in the self-attention heads. cross_attentions (`tuple(jnp.ndarray)`, *optional*, returned when `output_attentions=True` and `config.add_cross_attention=True` is passed or when `config.output_attentions=True`): ...
198
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_flax_outputs.py
class FlaxSeq2SeqModelOutput(ModelOutput): """ Base class for model encoder's outputs that also contains : pre-computed hidden states that can speed up sequential decoding. Args: last_hidden_state (`jnp.ndarray` of shape `(batch_size, sequence_length, hidden_size)`): Sequence of hid...
199
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_flax_outputs.py
Contains pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention blocks) that can be used (see `past_key_values` input) to speed up sequential decoding. decoder_hidden_states (`tuple(jnp.ndarray)`, *optional*, returned when `output_hidden_states=True` is pa...
199
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_flax_outputs.py
Attentions weights of the decoder, after the attention softmax, used to compute the weighted average in the self-attention heads. cross_attentions (`tuple(jnp.ndarray)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): Tuple of `jnp.n...
199
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_flax_outputs.py
Attentions weights of the decoder's cross-attention layer, after the attention softmax, used to compute the weighted average in the cross-attention heads. encoder_last_hidden_state (`jnp.ndarray` of shape `(batch_size, sequence_length, hidden_size)`, *optional*): Sequence of hidden-state...
199
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_flax_outputs.py
Hidden-states of the encoder at the output of each layer plus the initial embedding outputs. encoder_attentions (`tuple(jnp.ndarray)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): Tuple of `jnp.ndarray` (one for each layer) of shape `(batch_s...
199
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_flax_outputs.py
last_hidden_state: jnp.ndarray = None past_key_values: Optional[Tuple[Tuple[jnp.ndarray]]] = None decoder_hidden_states: Optional[Tuple[jnp.ndarray]] = None decoder_attentions: Optional[Tuple[jnp.ndarray]] = None cross_attentions: Optional[Tuple[jnp.ndarray]] = None encoder_last_hidden_state: Option...
199
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_flax_outputs.py
class FlaxCausalLMOutputWithCrossAttentions(ModelOutput): """ Base class for causal language model (or autoregressive) outputs. Args: logits (`jnp.ndarray` of shape `(batch_size, sequence_length, config.vocab_size)`): Prediction scores of the language modeling head (scores for each voca...
200
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_flax_outputs.py
Hidden-states of the model at the output of each layer plus the initial embedding outputs. attentions (`tuple(jnp.ndarray)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): Tuple of `jnp.ndarray` (one for each layer) of shape `(batch_size, num_h...
200
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_flax_outputs.py
Cross attentions weights after the attention softmax, used to compute the weighted average in the cross-attention heads. past_key_values (`tuple(tuple(jnp.ndarray))`, *optional*, returned when `use_cache=True` is passed or when `config.use_cache=True`): Tuple of `jnp.ndarray` tuples of l...
200
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_flax_outputs.py
logits: jnp.ndarray = None past_key_values: Optional[Tuple[Tuple[jnp.ndarray]]] = None hidden_states: Optional[Tuple[jnp.ndarray]] = None attentions: Optional[Tuple[jnp.ndarray]] = None cross_attentions: Optional[Tuple[jnp.ndarray]] = None
200
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_flax_outputs.py
class FlaxMaskedLMOutput(ModelOutput): """ Base class for masked language models outputs. Args: logits (`jnp.ndarray` of shape `(batch_size, sequence_length, config.vocab_size)`): Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax). ...
201
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_flax_outputs.py
Hidden-states of the model at the output of each layer plus the initial embedding outputs. attentions (`tuple(jnp.ndarray)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): Tuple of `jnp.ndarray` (one for each layer) of shape `(batch_size, num_h...
201
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_flax_outputs.py
class FlaxSeq2SeqLMOutput(ModelOutput): """ Base class for sequence-to-sequence language models outputs. Args: logits (`jnp.ndarray` of shape `(batch_size, sequence_length, config.vocab_size)`): Prediction scores of the language modeling head (scores for each vocabulary token before Sof...
202
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_flax_outputs.py
Contains pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention blocks) that can be used (see `past_key_values` input) to speed up sequential decoding. decoder_hidden_states (`tuple(jnp.ndarray)`, *optional*, returned when `output_hidden_states=True` is pa...
202
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_flax_outputs.py
Attentions weights of the decoder, after the attention softmax, used to compute the weighted average in the self-attention heads. cross_attentions (`tuple(jnp.ndarray)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): Tuple of `jnp.n...
202
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_flax_outputs.py
Attentions weights of the decoder's cross-attention layer, after the attention softmax, used to compute the weighted average in the cross-attention heads. encoder_last_hidden_state (`jnp.ndarray` of shape `(batch_size, sequence_length, hidden_size)`, *optional*): Sequence of hidden-state...
202
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_flax_outputs.py
Hidden-states of the encoder at the output of each layer plus the initial embedding outputs. encoder_attentions (`tuple(jnp.ndarray)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): Tuple of `jnp.ndarray` (one for each layer) of shape `(batch_s...
202
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_flax_outputs.py
class FlaxNextSentencePredictorOutput(ModelOutput): """ Base class for outputs of models predicting if two sentences are consecutive or not. Args: logits (`jnp.ndarray` of shape `(batch_size, 2)`): Prediction scores of the next sequence prediction (classification) head (scores of True/F...
203
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_flax_outputs.py
Hidden-states of the model at the output of each layer plus the initial embedding outputs. attentions (`tuple(jnp.ndarray)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): Tuple of `jnp.ndarray` (one for each layer) of shape `(batch_size, num_h...
203
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_flax_outputs.py
class FlaxSequenceClassifierOutput(ModelOutput): """ Base class for outputs of sentence classification models. Args: logits (`jnp.ndarray` of shape `(batch_size, config.num_labels)`): Classification (or regression if config.num_labels==1) scores (before SoftMax). hidden_states (...
204
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_flax_outputs.py
Attentions weights after the attention softmax, used to compute the weighted average in the self-attention heads. """ logits: jnp.ndarray = None hidden_states: Optional[Tuple[jnp.ndarray]] = None attentions: Optional[Tuple[jnp.ndarray]] = None
204
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_flax_outputs.py
class FlaxSeq2SeqSequenceClassifierOutput(ModelOutput): """ Base class for outputs of sequence-to-sequence sentence classification models. Args: logits (`jnp.ndarray` of shape `(batch_size, config.num_labels)`): Classification (or regression if config.num_labels==1) scores (before SoftM...
205
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_flax_outputs.py
Contains pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention blocks) that can be used (see `past_key_values` input) to speed up sequential decoding. decoder_hidden_states (`tuple(jnp.ndarray)`, *optional*, returned when `output_hidden_states=True` is pa...
205
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_flax_outputs.py
Attentions weights of the decoder, after the attention softmax, used to compute the weighted average in the self-attention heads. cross_attentions (`tuple(jnp.ndarray)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): Tuple of `jnp.n...
205
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_flax_outputs.py
Attentions weights of the decoder's cross-attention layer, after the attention softmax, used to compute the weighted average in the cross-attention heads. encoder_last_hidden_state (`jnp.ndarray` of shape `(batch_size, sequence_length, hidden_size)`, *optional*): Sequence of hidden-state...
205
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_flax_outputs.py
Hidden-states of the encoder at the output of each layer plus the initial embedding outputs. encoder_attentions (`tuple(jnp.ndarray)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): Tuple of `jnp.ndarray` (one for each layer) of shape `(batch_s...
205
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_flax_outputs.py
class FlaxMultipleChoiceModelOutput(ModelOutput): """ Base class for outputs of multiple choice models. Args: logits (`jnp.ndarray` of shape `(batch_size, num_choices)`): *num_choices* is the second dimension of the input tensors. (see *input_ids* above). Classification sco...
206
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_flax_outputs.py
Hidden-states of the model at the output of each layer plus the initial embedding outputs. attentions (`tuple(jnp.ndarray)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): Tuple of `jnp.ndarray` (one for each layer) of shape `(batch_size, num_h...
206
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_flax_outputs.py
class FlaxTokenClassifierOutput(ModelOutput): """ Base class for outputs of token classification models. Args: logits (`jnp.ndarray` of shape `(batch_size, sequence_length, config.num_labels)`): Classification scores (before SoftMax). hidden_states (`tuple(jnp.ndarray)`, *option...
207
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_flax_outputs.py
Attentions weights after the attention softmax, used to compute the weighted average in the self-attention heads. """ logits: jnp.ndarray = None hidden_states: Optional[Tuple[jnp.ndarray]] = None attentions: Optional[Tuple[jnp.ndarray]] = None
207
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_flax_outputs.py
class FlaxQuestionAnsweringModelOutput(ModelOutput): """ Base class for outputs of question answering models. Args: start_logits (`jnp.ndarray` of shape `(batch_size, sequence_length)`): Span-start scores (before SoftMax). end_logits (`jnp.ndarray` of shape `(batch_size, sequenc...
208
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_flax_outputs.py
Hidden-states of the model at the output of each layer plus the initial embedding outputs. attentions (`tuple(jnp.ndarray)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): Tuple of `jnp.ndarray` (one for each layer) of shape `(batch_size, num_h...
208
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_flax_outputs.py
class FlaxSeq2SeqQuestionAnsweringModelOutput(ModelOutput): """ Base class for outputs of sequence-to-sequence question answering models. Args: start_logits (`jnp.ndarray` of shape `(batch_size, sequence_length)`): Span-start scores (before SoftMax). end_logits (`jnp.ndarray` of...
209
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_flax_outputs.py
Contains pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention blocks) that can be used (see `past_key_values` input) to speed up sequential decoding. decoder_hidden_states (`tuple(jnp.ndarray)`, *optional*, returned when `output_hidden_states=True` is pa...
209
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_flax_outputs.py
Attentions weights of the decoder, after the attention softmax, used to compute the weighted average in the self-attention heads. cross_attentions (`tuple(jnp.ndarray)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): Tuple of `jnp.n...
209
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_flax_outputs.py
Attentions weights of the decoder's cross-attention layer, after the attention softmax, used to compute the weighted average in the cross-attention heads. encoder_last_hidden_state (`jnp.ndarray` of shape `(batch_size, sequence_length, hidden_size)`, *optional*): Sequence of hidden-state...
209
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_flax_outputs.py
Hidden-states of the encoder at the output of each layer plus the initial embedding outputs. encoder_attentions (`tuple(jnp.ndarray)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): Tuple of `jnp.ndarray` (one for each layer) of shape `(batch_s...
209
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_flax_outputs.py
start_logits: jnp.ndarray = None end_logits: jnp.ndarray = None past_key_values: Optional[Tuple[Tuple[jnp.ndarray]]] = None decoder_hidden_states: Optional[Tuple[jnp.ndarray]] = None decoder_attentions: Optional[Tuple[jnp.ndarray]] = None cross_attentions: Optional[Tuple[jnp.ndarray]] = None enc...
209
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/modeling_flax_outputs.py
class Cache(torch.nn.Module): """ Base, abstract class for all caches. The actual data structure is specific to each subclass. """ def __init__(self): super().__init__() def update( self, key_states: torch.Tensor, value_states: torch.Tensor, layer_idx: int, ...
210
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/cache_utils.py
Parameters: key_states (`torch.Tensor`): The new key states to cache. value_states (`torch.Tensor`): The new value states to cache. layer_idx (`int`): The index of the layer to cache the states for. cache_kwargs (`Dict[str, ...
210
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/cache_utils.py
def get_max_cache_shape(self) -> Optional[int]: """Returns the maximum sequence length (i.e. max capacity) of the cache object""" raise NotImplementedError("Make sure to implement `get_max_cache_shape` in a subclass.") def get_usable_length(self, new_seq_length: int, layer_idx: Optional[int] = 0) -...
210
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/cache_utils.py
def reorder_cache(self, beam_idx: torch.LongTensor): """Reorders the cache for beam search, given the selected beam indices.""" for layer_idx in range(len(self.key_cache)): if self.key_cache[layer_idx] != []: device = self.key_cache[layer_idx].device self.key_...
210
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/cache_utils.py
class CacheConfig: """ Base class for cache configs """ cache_implementation: None @classmethod def from_dict(cls, config_dict, **kwargs): """ Constructs a CacheConfig instance from a dictionary of parameters. Args: config_dict (Dict[str, Any]): Dictionary c...
211
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/cache_utils.py
# Copied from transformers.utils.quantization_config.QuantizationConfigMixin.to_json_file def to_json_file(self, json_file_path: Union[str, os.PathLike]): """ Save this instance to a JSON file. Args: json_file_path (`str` or `os.PathLike`): Path to the JSON file ...
211
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/cache_utils.py
# Copied from transformers.utils.quantization_config.QuantizationConfigMixin.to_dict def to_dict(self) -> Dict[str, Any]: """ Serializes this instance to a Python dictionary. Returns: `Dict[str, Any]`: Dictionary of all the attributes that make up this configuration instance. """...
211
/Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/cache_utils.py