Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/DAMO-NLP-SG/multilingual_analysis
/ functions
Functions
1,603 in github.com/DAMO-NLP-SG/multilingual_analysis
⨍
Functions
1,603
◇
Types & classes
462
↳
Endpoints
11
↓ 1 callers
Method
_validate_model_class
Confirms that the model class is compatible with generation. If not, raises an exception that points to the right class to use.
neuron_deactivate/transformers/generation/utils.py:1180
↓ 1 callers
Method
_validate_model_class
Confirms that the model class is compatible with generation. If not, raises an exception that points to the right class to use.
neuron_deactivate/transformers/generation/flax_utils.py:226
↓ 1 callers
Method
_validate_model_class
Confirms that the model class is compatible with generation. If not, raises an exception that points to the right class to use.
neuron_deactivate/transformers/generation/tf_utils.py:597
↓ 1 callers
Method
_validate_model_kwargs
Validates model kwargs for generation. Generate argument typos will also be caught here.
neuron_detection/transformers/generation/utils.py:1091
↓ 1 callers
Method
_validate_model_kwargs
Validates model kwargs for generation. Generate argument typos will also be caught here.
neuron_detection/transformers/generation/flax_utils.py:250
↓ 1 callers
Method
_validate_model_kwargs
Validates model kwargs for generation. Generate argument typos will also be caught here.
neuron_detection/transformers/generation/tf_utils.py:622
↓ 1 callers
Method
_validate_model_kwargs
Validates model kwargs for generation. Generate argument typos will also be caught here.
layers/transformers/generation/utils.py:1091
↓ 1 callers
Method
_validate_model_kwargs
Validates model kwargs for generation. Generate argument typos will also be caught here.
neuron_deactivate/transformers/generation/utils.py:1206
↓ 1 callers
Method
_validate_model_kwargs
Validates model kwargs for generation. Generate argument typos will also be caught here.
neuron_deactivate/transformers/generation/flax_utils.py:250
↓ 1 callers
Method
_validate_model_kwargs
Validates model kwargs for generation. Generate argument typos will also be caught here.
neuron_deactivate/transformers/generation/tf_utils.py:622
↓ 1 callers
Method
add
(self, token_id: int)
neuron_detection/transformers/generation/beam_constraints.py:433
↓ 1 callers
Method
add
(self, token_id: int)
neuron_deactivate/transformers/generation/beam_constraints.py:433
↓ 1 callers
Method
add_callback
Add a callback to the current list of [`~transformers.TrainerCallback`]. Args: callback (`type` or [`~transformers.Traine
neuron_enhancement/transformers/trainer.py:693
↓ 1 callers
Function
apply_rotary_pos_emb
Applies Rotary Position Embedding to the query and key tensors. Args: q (`tf.Tensor`): The query tensor. k (`tf.Tensor`): The key
neuron_detection/transformers/models/mistral/modeling_tf_mistral.py:161
↓ 1 callers
Function
apply_rotary_pos_emb
Applies Rotary Position Embedding to the query and key tensors. Args: q (`tf.Tensor`): The query tensor. k (`tf.Tensor`): The key
neuron_deactivate/transformers/models/mistral/modeling_tf_mistral.py:161
↓ 1 callers
Method
assisted_decoding
r""" Generates sequences of token ids for models with a language modeling head using **greedy decoding** or **sample** (depending on `
neuron_deactivate/transformers/generation/utils.py:4261
↓ 1 callers
Method
autocast_smart_context_manager
A helper wrapper that creates an appropriate context manager for `autocast` while feeding it the desired arguments, depending on the
neuron_enhancement/transformers/trainer.py:2948
↓ 1 callers
Function
average_layerwise_lang_distribution
(lst_lang_distribution, candidate_langs=['en', 'zh', 'es', 'ru', 'de', 'fr'])
layers/test_layer.py:104
↓ 1 callers
Method
beam_sample
r""" Generates sequences of token ids for models with a language modeling head using **beam search multinomial sampling** and can be u
neuron_detection/transformers/generation/utils.py:2983
↓ 1 callers
Method
beam_sample
r""" Generates sequences of token ids for models with a language modeling head using **beam search multinomial sampling** and can be u
layers/transformers/generation/utils.py:2977
↓ 1 callers
Method
beam_sample
r""" Generates sequences of token ids for models with a language modeling head using **beam search multinomial sampling** and can be u
neuron_deactivate/transformers/generation/utils.py:3215
↓ 1 callers
Method
beam_search
r""" Generates sequences of token ids for models with a language modeling head using **beam search decoding** and can be used for text
neuron_detection/transformers/generation/utils.py:2660
↓ 1 callers
Method
beam_search
r""" Generates sequences of token ids for models with a language modeling head using **beam search decoding** and can be used for text
layers/transformers/generation/utils.py:2654
↓ 1 callers
Method
beam_search
r""" Generates sequences of token ids for models with a language modeling head using **beam search decoding** and can be used for text
neuron_deactivate/transformers/generation/utils.py:2892
↓ 1 callers
Function
bloom_gelu_back
gradient of tanh approximation of gelu gradient of actual gelu is: 0.5 * (1. + torch.erf(x * 0.70710678)) + 0.3989423 * x * torch.exp(-0.5 *
layers/transformers/models/modeling_bloom.py:162
↓ 1 callers
Function
build_alibi_tensor
Link to paper: https://arxiv.org/abs/2108.12409 Alibi tensor is not causal as the original paper mentions, it relies on a translation invaria
layers/transformers/models/modeling_bloom.py:87
↓ 1 callers
Method
build_alibi_tensor
(self, attention_mask: torch.Tensor, num_heads: int, dtype: torch.dtype)
layers/transformers/models/modeling_bloom.py:640
↓ 1 callers
Method
calc_banned_ngram_tokens
(self, input_ids, num_hypos, cur_len)
neuron_detection/transformers/generation/tf_logits_process.py:403
↓ 1 callers
Method
calc_banned_ngram_tokens
(self, input_ids, num_hypos, cur_len)
neuron_deactivate/transformers/generation/tf_logits_process.py:403
↓ 1 callers
Method
clean_and_embed_tokens_with_cache
(self, token_list, token_indices, stop_strings, tokenizer)
neuron_detection/transformers/generation/stopping_criteria.py:284
↓ 1 callers
Method
clean_and_embed_tokens_with_cache
(self, token_list, token_indices, stop_strings, tokenizer)
neuron_deactivate/transformers/generation/stopping_criteria.py:286
↓ 1 callers
Method
clean_tokenizer_vocab
This method turns a tokenizer vocab into a "clean" vocab where each token represents the actual string it will yield, without any spe
neuron_detection/transformers/generation/stopping_criteria.py:306
↓ 1 callers
Method
clean_tokenizer_vocab
This method turns a tokenizer vocab into a "clean" vocab where each token represents the actual string it will yield, without any spe
neuron_deactivate/transformers/generation/stopping_criteria.py:308
↓ 1 callers
Function
compute_intermediate_size
(n, ffn_dim_multiplier=1, multiple_of=256)
neuron_detection/transformers/models/llama/convert_llama_weights_to_hf.py:91
↓ 1 callers
Function
compute_intermediate_size
(n, ffn_dim_multiplier=1, multiple_of=256)
neuron_deactivate/transformers/models/llama/convert_llama_weights_to_hf.py:96
↓ 1 callers
Method
constrained_beam_search
r""" Generates sequences of token ids for models with a language modeling head using **constrained beam search decoding** and can be u
neuron_detection/transformers/generation/utils.py:3696
↓ 1 callers
Method
constrained_beam_search
r""" Generates sequences of token ids for models with a language modeling head using **constrained beam search decoding** and can be u
layers/transformers/generation/utils.py:3690
↓ 1 callers
Method
constrained_beam_search
r""" Generates sequences of token ids for models with a language modeling head using **constrained beam search decoding** and can be u
neuron_deactivate/transformers/generation/utils.py:3926
↓ 1 callers
Method
contrastive_search
r""" Generates sequences of token ids for models with a language modeling head using **contrastive search** and can be used for text-d
neuron_detection/transformers/generation/utils.py:1714
↓ 1 callers
Method
contrastive_search
r""" Generates sequences of token ids for models with a language modeling head using **contrastive search** and can be used for text-d
neuron_detection/transformers/generation/tf_utils.py:2683
↓ 1 callers
Method
contrastive_search
r""" Generates sequences of token ids for models with a language modeling head using **contrastive search** and can be used for text-d
layers/transformers/generation/utils.py:1717
↓ 1 callers
Method
contrastive_search
r""" Generates sequences of token ids for models with a language modeling head using **contrastive search** and can be used for text-d
neuron_deactivate/transformers/generation/utils.py:1876
↓ 1 callers
Method
contrastive_search
r""" Generates sequences of token ids for models with a language modeling head using **contrastive search** and can be used for text-d
neuron_deactivate/transformers/generation/tf_utils.py:2683
↓ 1 callers
Method
convert_tokens_to_string
Converts a sequence of tokens (string) in a single string.
neuron_detection/transformers/models/llama/tokenization_llama.py:282
↓ 1 callers
Method
convert_tokens_to_string
Converts a sequence of tokens (string) in a single string.
neuron_deactivate/transformers/models/llama/tokenization_llama.py:281
↓ 1 callers
Method
count_leaves
(self, root)
neuron_detection/transformers/generation/beam_constraints.py:246
↓ 1 callers
Method
count_leaves
(self, root)
neuron_deactivate/transformers/generation/beam_constraints.py:246
↓ 1 callers
Method
create_model_card
Creates a draft of a model card using the information available to the `Trainer`. Args: language (`str`, *optional*):
neuron_enhancement/transformers/trainer.py:3782
↓ 1 callers
Method
create_optimizer
Setup the optimizer. We provide a reasonable default that works well. If you want to use something else, you can pass a tuple in the
neuron_enhancement/transformers/trainer.py:975
↓ 1 callers
Method
create_scheduler
Setup the scheduler. The optimizer of the trainer must have been set up either before this method is called or passed as an argument.
neuron_enhancement/transformers/trainer.py:1166
↓ 1 callers
Function
create_sinusoidal_positions
(num_pos, dim)
neuron_detection/transformers/models/llama/modeling_flax_llama.py:131
↓ 1 callers
Function
create_sinusoidal_positions
(num_pos, dim)
neuron_detection/transformers/models/mistral/modeling_flax_mistral.py:201
↓ 1 callers
Function
create_sinusoidal_positions
(num_pos, dim)
neuron_deactivate/transformers/models/llama/modeling_flax_llama.py:131
↓ 1 callers
Function
create_sinusoidal_positions
(num_pos, dim)
neuron_deactivate/transformers/models/mistral/modeling_flax_mistral.py:201
↓ 1 callers
Function
deduplicate
(neuron_target, neuron_delete)
neuron_deactivate/test_mistral_gsm.py:60
↓ 1 callers
Method
does_advance
(self, token_id: int)
neuron_detection/transformers/generation/beam_constraints.py:157
↓ 1 callers
Method
does_advance
(self, token_id: int)
neuron_detection/transformers/generation/beam_constraints.py:301
↓ 1 callers
Method
does_advance
(self, token_id: int)
neuron_deactivate/transformers/generation/beam_constraints.py:157
↓ 1 callers
Method
does_advance
(self, token_id: int)
neuron_deactivate/transformers/generation/beam_constraints.py:301
↓ 1 callers
Method
evaluate
Run evaluation and returns metrics. The calling script will be responsible for providing a method to compute metrics, as they are ta
neuron_enhancement/transformers/trainer.py:3246
↓ 1 callers
Method
floating_point_ops
For models that inherit from [`PreTrainedModel`], uses that method to compute the number of floating point operations for every backw
neuron_enhancement/transformers/trainer.py:3747
↓ 1 callers
Method
forward
(self, hidden_state, early_layers)
neuron_detection/transformers/models/mistral/modeling_mistral.py:156
↓ 1 callers
Method
forward
(self, x, early_layers)
neuron_detection/transformers/models/gemma2/modeling_gemma2.py:167
↓ 1 callers
Method
forward
( self, input_ids: torch.LongTensor = None, attention_mask: Optional[torch.Tensor] = N
neuron_detection/transformers/models/gemma2/diff_gemma2.py:458
↓ 1 callers
Method
forward
(self, x)
layers/transformers/models/modeling_qwen2.py:184
↓ 1 callers
Method
forward
(self, x, deactivate_keys_fwd_up, deactivate_keys_fwd_down)
neuron_deactivate/transformers/models/llama/modeling_llama.py:292
↓ 1 callers
Method
forward
(self, hidden_state, deactivate_keys_fwd_up, deactivate_keys_fwd_down)
neuron_deactivate/transformers/models/mistral/modeling_mistral.py:158
↓ 1 callers
Method
forward
(self, x, deactivate_keys_fwd_up, deactivate_keys_fwd_down)
neuron_deactivate/transformers/models/gemma2/modeling_gemma2.py:204
↓ 1 callers
Method
forward
( self, input_ids: torch.LongTensor = None, attention_mask: Optional[torch.Tensor] = N
neuron_deactivate/transformers/models/gemma2/diff_gemma2.py:329
↓ 1 callers
Method
generate
r""" Generates sequences of token ids for models with a language modeling head. <Tip warning={true}> Most generation-contro
layers/transformers/generation/utils.py:1115
↓ 1 callers
Method
get_bank
(self)
neuron_detection/transformers/generation/beam_constraints.py:375
↓ 1 callers
Method
get_bank
(self)
neuron_deactivate/transformers/generation/beam_constraints.py:375
↓ 1 callers
Method
get_banned_tokens_mask
Determines which tokens must be banned given latest tokens and the previously seen ngrams.
neuron_detection/transformers/generation/flax_logits_process.py:510
↓ 1 callers
Method
get_banned_tokens_mask
Determines which tokens must be banned given latest tokens and the previously seen ngrams.
neuron_deactivate/transformers/generation/flax_logits_process.py:510
↓ 1 callers
Method
get_decay_parameter_names
Get all parameter names that weight decay will be applied to Note that some models implement their own layernorm instead of calling
neuron_enhancement/transformers/trainer.py:964
↓ 1 callers
Method
get_eval_dataloader
Returns the evaluation [`~torch.utils.data.DataLoader`]. Subclass and override this method if you want to inject some custom behavio
neuron_enhancement/transformers/trainer.py:878
↓ 1 callers
Method
get_optimizer_cls_and_kwargs
Returns the optimizer class and optimizer parameters based on the training arguments. Args: args (`transformers.training
neuron_enhancement/transformers/trainer.py:1024
↓ 1 callers
Method
get_previous_ngrams
get a matrix of size (batch_size,) + (vocab_size,)*n (for n-grams) that represent the n-grams that occurred previously. The B
neuron_detection/transformers/generation/flax_logits_process.py:476
↓ 1 callers
Method
get_previous_ngrams
get a matrix of size (batch_size,) + (vocab_size,)*n (for n-grams) that represent the n-grams that occurred previously. The B
neuron_deactivate/transformers/generation/flax_logits_process.py:476
↓ 1 callers
Method
get_spm_processor
(self, from_slow=False)
neuron_detection/transformers/models/llama/tokenization_llama.py:195
↓ 1 callers
Method
get_spm_processor
(self, from_slow=False)
neuron_deactivate/transformers/models/llama/tokenization_llama.py:195
↓ 1 callers
Method
get_test_dataloader
Returns the test [`~torch.utils.data.DataLoader`]. Subclass and override this method if you want to inject some custom behavior.
neuron_enhancement/transformers/trainer.py:914
↓ 1 callers
Method
get_train_dataloader
Returns the training [`~torch.utils.data.DataLoader`]. Will use no sampler if `train_dataset` does not implement `__len__`, a random
neuron_enhancement/transformers/trainer.py:821
↓ 1 callers
Method
get_unconditional_logits
(self, input_ids)
neuron_detection/transformers/generation/logits_process.py:2241
↓ 1 callers
Method
get_unconditional_logits
(self, input_ids)
neuron_deactivate/transformers/generation/logits_process.py:2241
↓ 1 callers
Method
greedy_search
r""" Generates sequences of token ids for models with a language modeling head using **greedy decoding** and can be used for text-deco
neuron_detection/transformers/generation/utils.py:2083
↓ 1 callers
Method
greedy_search
r""" Generates sequences for models with a language modeling head using greedy decoding. Parameters: input_ids (`tf.Tenso
neuron_detection/transformers/generation/tf_utils.py:1526
↓ 1 callers
Method
greedy_search
r""" Generates sequences of token ids for models with a language modeling head using **greedy decoding** and can be used for text-deco
layers/transformers/generation/utils.py:2086
↓ 1 callers
Method
greedy_search
r""" Generates sequences of token ids for models with a language modeling head using **greedy decoding** and can be used for text-deco
neuron_deactivate/transformers/generation/utils.py:2319
↓ 1 callers
Method
greedy_search
r""" Generates sequences for models with a language modeling head using greedy decoding. Parameters: input_ids (`tf.Tenso
neuron_deactivate/transformers/generation/tf_utils.py:1526
↓ 1 callers
Method
group_beam_search
r""" Generates sequences of token ids for models with a language modeling head using **diverse beam search decoding** and can be used
neuron_detection/transformers/generation/utils.py:3316
↓ 1 callers
Method
group_beam_search
r""" Generates sequences of token ids for models with a language modeling head using **diverse beam search decoding** and can be used
layers/transformers/generation/utils.py:3310
↓ 1 callers
Method
group_beam_search
r""" Generates sequences of token ids for models with a language modeling head using **diverse beam search decoding** and can be used
neuron_deactivate/transformers/generation/utils.py:3547
↓ 1 callers
Method
has_subsets
Returns whether # of leaves == # of words. Otherwise some word is a subset of another.
neuron_detection/transformers/generation/beam_constraints.py:253
↓ 1 callers
Method
has_subsets
Returns whether # of leaves == # of words. Otherwise some word is a subset of another.
neuron_deactivate/transformers/generation/beam_constraints.py:253
↓ 1 callers
Method
init_cache
r""" Args: batch_size (`int`): batch_size used for fast auto-regressive decoding. Defines the batch size of the in
neuron_detection/transformers/models/llama/modeling_flax_llama.py:451
↓ 1 callers
Method
init_cache
r""" Args: batch_size (`int`): batch_size used for fast auto-regressive decoding. Defines the batch size of the in
neuron_detection/transformers/models/mistral/modeling_flax_mistral.py:439
↓ 1 callers
Method
init_cache
r""" Args: batch_size (`int`): batch_size used for fast auto-regressive decoding. Defines the batch size of the in
neuron_deactivate/transformers/models/llama/modeling_flax_llama.py:451
↓ 1 callers
Method
init_cache
r""" Args: batch_size (`int`): batch_size used for fast auto-regressive decoding. Defines the batch size of the in
neuron_deactivate/transformers/models/mistral/modeling_flax_mistral.py:439
↓ 1 callers
Method
ipex_optimize_model
(self, model, training=False, dtype=torch.float32)
neuron_enhancement/transformers/trainer.py:1352
← previous
next →
401–500 of 1,603, ranked by callers