MCPcopy Create free account

hub / github.com/adapter-hub/adapters / functions

Functions1,559 in github.com/adapter-hub/adapters

↓ 2 callersMethodadd
(self, gold, prediction)
examples/pytorch/dependency-parsing/utils_udp.py:96
↓ 2 callersMethodadd_adapter
Adds a new adapter module of the specified type to the model. Args: adapter_name (str): The name of the adapter module t
src/adapters/model_mixin.py:676
↓ 2 callersMethodadd_adapter
(self, adapter_name: str, layer_idx: int)
src/adapters/methods/lora.py:535
↓ 2 callersMethodadd_dependency_parsing_head
Adds a biaffine dependency parsing head on top of the model. The parsing head uses the architecture described in "Is Supervised Synta
src/adapters/heads/model_mixin.py:472
↓ 2 callersMethodadd_fusion
Adds a new AdapterFusion. Args: adapter_names (List[str]): The names of the adapters to fuse. config (Option
src/adapters/configuration/model_adapters_config.py:166
↓ 2 callersMethodadd_fusion_layer
See BertModel.add_fusion_layer
src/adapters/methods/bottleneck.py:120
↓ 2 callersMethodadd_image_classification_head
Adds an image classification head on top of the model. Args: head_name (str): The name of the head. num_labe
src/adapters/heads/model_mixin.py:378
↓ 2 callersFunctionadd_lm_head
Add appropriate language model head based on model type
tests/test_methods/method_test_impl/utils.py:31
↓ 2 callersMethodbuild_generate_input
(self, shape)
tests/test_methods/base.py:238
↓ 2 callersMethodcompose_single
(self, adapter_setup: str, state: BottleneckState, lvl: int = 0)
src/adapters/methods/bottleneck.py:239
↓ 2 callersFunctioncompute_dora_norm
This function calculates the column-wise norm of the pre-trained weights and the LoRA matrices eg: for LoRA, it would be ||w_0 + BA||c
src/adapters/methods/lora.py:455
↓ 2 callersMethodconfirm_prefix
Create Prefix Tuning module based on shim layer infications.
src/adapters/methods/prefix_tuning.py:192
↓ 2 callersFunctionconvert_tensors_to_list
Converts the model output, which consists of a Tuple of Tensors to a Tuple of lists, while preserving the original dimensions. The converted outpu
utils/back_comp/Utils.py:415
↓ 2 callersFunctioncreate_output
Given a model run a forward pass with some dummy data. Args: model: The model for which the forward pass is run. model_name: The n
utils/back_comp/Utils.py:41
↓ 2 callersMethodcreate_twin_adapters
(self, model, name, adapter_config)
tests/test_methods/method_test_impl/composition/test_parallel.py:139
↓ 2 callersMethoddelete_embeddings
Deletes the embedding with the given name Args: name: The name of the embedding that should be deleted
src/adapters/model_mixin.py:336
↓ 2 callersMethoddelete_head
Deletes the prediction head with the specified name from the model. Args: head_name (str): The name of the prediction to
src/adapters/heads/model_mixin.py:535
↓ 2 callersMethoddelete_invertible_adapter
(self, adapter_name: str)
src/adapters/model_mixin.py:136
↓ 2 callersFunctiondownload_cached
This method downloads a file and caches it. For more information on why this is needed, refer to the explanation in this Pull Request: https
src/adapters/utils.py:456
↓ 2 callersMethodeject
(self)
src/adapters/methods/prefix_tuning.py:47
↓ 2 callersMethodenable_adapters
Unfreezes a given list of adapters, the adapter fusion layer, or both Args: adapter_names: names of adapters to unfreeze
src/adapters/methods/bottleneck.py:139
↓ 2 callersMethodenable_input_require_grads
Enables the gradients for the input embeddings specifically for BEiT's tuple output format.
src/adapters/models/beit/adapter_model.py:35
↓ 2 callersMethodenable_invertible_adapters
(self, adapter_names)
src/adapters/model_mixin.py:148
↓ 2 callersMethodevaluate
(self, eval_dataset=None, eval_examples=None, ignore_keys=None, metric_key_prefix: str = "eval")
examples/pytorch/question-answering/trainer_qa.py:32
↓ 2 callersMethodfilter_func
The callable returned by this method is used to extract the module weights to be saved or loaded based on their names. Args:
src/adapters/loading.py:267
↓ 2 callersMethodfilter_func
(self, head_name)
src/adapters/loading.py:857
↓ 2 callersFunctionfind_in_index
( identifier: str, model_name: str, adapter_config: Optional[dict] = None, strict: bool = Fals
src/adapters/utils.py:625
↓ 2 callersFunctionfix_seeds
Sets seeds manually. Args: seed (int, optional): The seed value to use for random number generation.
utils/back_comp/Utils.py:383
↓ 2 callersMethodforward
(self, *args, **kwargs)
src/adapters/model_mixin.py:2069
↓ 2 callersMethodfreeze_embeddings
(self, freeze=True)
src/adapters/model_mixin.py:2646
↓ 2 callersMethodfreeze_model
Freezes all weights of the model.
src/adapters/model_mixin.py:1403
↓ 2 callersMethodfrom_dict
(cls, config)
src/adapters/configuration/adapter_config.py:846
↓ 2 callersFunctiongenerate_past_key_values
(model, batch_size, seq_len)
examples/pytorch/text-generation/run_generation.py:191
↓ 2 callersMethodget_invertible_adapter
(self)
src/adapters/methods/invertible.py:51
↓ 2 callersMethodget_labels_dict
Returns the id2label dict for the given hea Args: head_name: (str, optional) the name of the head which labels should be
src/adapters/heads/model_mixin.py:710
↓ 2 callersMethodget_model
(self)
tests/test_methods/test_on_custom_interface.py:52
↓ 2 callersFunctionget_model_names
Returns a list of strings representing the testable model names.
utils/back_comp/Utils.py:119
↓ 2 callersMethodget_n_heads
(self, lora: Union[LoRA, IA3, LoRAConfig])
src/adapters/methods/lora.py:1140
↓ 2 callersFunctionget_new_adapter_config_strings
Returns a list of strings representing new adapter configurations.
utils/back_comp/Utils.py:99
↓ 2 callersMethodget_output_embeddings
(self)
src/adapters/heads/model_mixin.py:138
↓ 2 callersMethodget_prefix
(self, prefix_name: str)
src/adapters/methods/prefix_tuning.py:252
↓ 2 callersFunctionget_subnet_constructor
(non_linearity, reduction_factor)
src/adapters/methods/modeling.py:462
↓ 2 callersMethodgradient_checkpointing_enable
Activates gradient checkpointing for the current model. Note that in other frameworks this feature can be referred to as "activation
src/adapters/model_mixin.py:1955
↓ 2 callersFunctioninit_W
Initialize the weights for the compacter module or the shared parameters
src/adapters/methods/modeling.py:822
↓ 2 callersMethodinit_adapters
(self, model_config, adapters_config)
src/adapters/models/clip/mixin_clip.py:52
↓ 2 callersMethoditer_layers
(self)
src/adapters/model_mixin.py:2035
↓ 2 callersMethodload
Loads a given adapter configuration specifier into a full AdapterConfig instance. Args: config (Union[dict, str]): The c
src/adapters/configuration/adapter_config.py:95
↓ 2 callersFunctionload_model
Loads a pre-trained model from a specified path based on the specified model_name. Args: model_name (str): The name of the model to be loa
utils/back_comp/Utils.py:59
↓ 2 callersFunctionload_model
Loads a pretrained model with adapters from the given path or url. Parameters: model_name_or_path (`str` or `os.PathLike`, *optional
src/adapters/wrappers/model.py:168
↓ 2 callersFunctionmain
()
examples/pytorch/adapterfusion/run_fusion_glue.py:66
↓ 2 callersFunctionmain
()
examples/pytorch/multiple-choice/run_swag.py:227
↓ 2 callersFunctionmain
()
examples/pytorch/token-classification/run_ner.py:219
↓ 2 callersFunctionmain
()
examples/pytorch/text-classification/run_glue.py:216
↓ 2 callersFunctionmain
()
examples/pytorch/question-answering/run_qa.py:230
↓ 2 callersFunctionmain
()
examples/pytorch/question-answering/run_seq2seq_qa.py:275
↓ 2 callersFunctionmain
()
examples/pytorch/summarization/run_summarization.py:314
↓ 2 callersFunctionmain
()
examples/pytorch/language-modeling/run_mlm.py:251
↓ 2 callersFunctionmain
()
examples/pytorch/language-modeling/run_clm.py:240
↓ 2 callersMethodmerge_adapter
(self, name: str)
src/adapters/methods/lora.py:864
↓ 2 callersFunctionmultihasattr
(o: object, name: str)
src/adapters/utils.py:177
↓ 2 callersMethodpad_and_concat
Concatenates the given states along the batch size dimension. Pads the states before concatenation if necessary. This is e.g. used by the Batc
src/adapters/methods/adapter_layer_base.py:297
↓ 2 callersFunctionparse_heads_from_composition
Parses a potential head configuration from a setup of adapters. Args: adapter_composition: The adapter setup to be parsed. r
src/adapters/composition.py:258
↓ 2 callersMethodpre_forward
Retrieves the hidden_states, query (for Fusion), and residual connection according to the set configuration. Args: adapt
src/adapters/methods/modeling.py:157
↓ 2 callersMethodpre_save_adapters
(self)
src/adapters/methods/reft.py:222
↓ 2 callersMethodpredict
(self, predict_dataset, predict_examples, ignore_keys=None, metric_key_prefix: str = "test")
examples/pytorch/question-answering/trainer_qa.py:85
↓ 2 callersFunctionpreprocess_squad_batch
( examples, question_column: str, context_column: str, answer_column: str,
examples/pytorch/question-answering/run_seq2seq_qa.py:470
↓ 2 callersFunctionpull_from_hf_model_hub
(specifier: str, version: str = None, **kwargs)
src/adapters/utils.py:730
↓ 2 callersMethodregister_custom_head
(self, identifier, head)
src/adapters/heads/model_mixin.py:242
↓ 2 callersMethodrename_func
(self, old_name, new_name)
src/adapters/loading.py:447
↓ 2 callersMethodrename_func
(self, old_name, new_name)
src/adapters/loading.py:676
↓ 2 callersMethodrun_parallel_training_equivalent_to_single
(self, adapter_config)
tests/test_methods/method_test_impl/composition/test_parallel.py:225
↓ 2 callersMethodrun_shared_parameters_are_equals
( self, model, shared_parameters, # name of adapter parameters / submodules s
tests/test_methods/method_test_impl/composition/test_multi_task.py:228
↓ 2 callersMethodsave
Saves a prediction head module into the given directory. Args: save_directory (str): The directory to save the weights i
src/adapters/loading.py:882
↓ 2 callersMethodsave_adapter_setup
Saves an adapter setup to a directory so that it can be shared or reloaded using `load_adapter_setup()`. Args: save_directory (st
src/adapters/model_mixin.py:1267
↓ 2 callersMethodset_pool
(self, pool: PrefixTuningPool)
src/adapters/methods/prefix_tuning.py:348
↓ 2 callersMethodtokenize
(element)
tests/test_misc/test_adapter_trainer/test_adapter_trainer.py:554
↓ 2 callersMethodtrainings_run
( self, model, lr=1.0, steps=8, batch_size=2, gradient_accumul
tests/test_methods/method_test_impl/base.py:274
↓ 2 callersMethodunshare_parameters
(self, name: str)
src/adapters/methods/lora.py:595
↓ 1 callersMethod__init__
(self, config, *args, **kwargs)
src/adapters/model_mixin.py:429
↓ 1 callersMethod__init__
( self, model: Union[PreTrainedModel, nn.Module] = None, args: TrainingArguments = Non
src/adapters/trainer.py:37
↓ 1 callersMethod__init__
( self, prefix_tuning: Optional[PrefixTuningConfig] = None, adapter: Optional[BnConfig
src/adapters/configuration/adapter_config.py:863
↓ 1 callersMethod__init__
( self, adapter_name: str, prompt_tuning_config: PromptTuningConfig, model_con
src/adapters/methods/prompt_tuning.py:35
↓ 1 callersMethod__init__
(self, n_in, n_out=1, bias_x=True, bias_y=True)
src/adapters/heads/dependency_parsing.py:30
↓ 1 callersMethod__init__
(self)
src/adapters/models/bert/mixin_bert.py:49
↓ 1 callersMethod__init__
(self)
examples/pytorch/dependency-parsing/utils_udp.py:117
↓ 1 callersMethod_average_adapter_lora_delta_w_svd
(self, input_adapters: Dict[str, float], avg_state_dict, svd_rank)
src/adapters/methods/lora.py:688
↓ 1 callersMethod_average_shared_parameters
( self, adapter_name: str, input_adapters: Dict[str, float], combine_strategy:
src/adapters/model_mixin.py:1625
↓ 1 callersMethod_call_forward
Calls the forward function of the model with the given arguments and keyword arguments.
src/adapters/context.py:110
↓ 1 callersMethod_check_lora_location
(self, config: LoRAConfig)
src/adapters/methods/lora.py:529
↓ 1 callersFunction_collate_dataset_with_padding
( features: List[Dict[str, Union[List[int], torch.Tensor]]], processor, decoder_start_token_id: int
tests/fixtures/audio_datasets/prepare_audio_datasets.py:50
↓ 1 callersMethod_compute_adapted_weight
(self, name, lora)
src/adapters/methods/lora.py:1216
↓ 1 callersMethod_compute_glue_metrics
(self, task_name)
tests/test_misc/test_adapter_hub.py:94
↓ 1 callersMethod_create_model_output
(loss, logits, base_outputs)
src/adapters/heads/language_modeling.py:85
↓ 1 callersMethod_default_init_adapter_methods
(self, model_config, adapters_config)
src/adapters/model_mixin.py:458
↓ 1 callersFunction_dict_extract
(d, primary_key, secondary_key=None)
src/adapters/utils.py:610
↓ 1 callersMethod_fix_backward_compat
(self, config)
src/adapters/loading.py:411
↓ 1 callersMethod_gather_adapted_states
(self, hidden_states: torch.Tensor)
src/adapters/methods/reft.py:89
↓ 1 callersMethod_get_active_setup
(self)
src/adapters/model_mixin.py:163
↓ 1 callersMethod_get_lora_shapes
(self, config: LoRAConfig)
src/adapters/methods/lora.py:532
↓ 1 callersMethod_get_loss
(self, arc_preds, rel_preds, labels_arc, labels_rel, loss_fn)
src/adapters/heads/dependency_parsing.py:169
← previousnext →201–300 of 1,559, ranked by callers