MCPcopy Create free account

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

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

↓ 6 callersMethodmaybe_t
(self, w)
src/adapters/methods/lora.py:861
↓ 6 callersMethodpad
(self, x, lora, fill_value=None)
src/adapters/methods/lora.py:1182
↓ 6 callersMethodpredict
Run prediction and returns predictions and potential metrics. Depending on the dataset and your use case, your test dataset may cont
examples/pytorch/dependency-parsing/utils_udp.py:242
↓ 6 callersMethodtraining_pass
(self, model)
tests/test_misc/test_adapter_composition.py:66
↓ 5 callersMethod__init__
(self, dim, mlp_ratio)
tests/test_methods/test_all_custom_interfaces.py:67
↓ 5 callersMethodadd_seq2seq_lm_head
Adds a sequence-to-sequence language modeling head on top of the model. Args: head_name (str): The name of the head.
src/adapters/heads/model_mixin.py:518
↓ 5 callersMethodadd_tagging_head
Adds a token classification head on top of the model. Args: head_name (str): The name of the head. num_label
src/adapters/heads/model_mixin.py:438
↓ 5 callersMethodbatched_training_pass
(self, model)
tests/test_misc/test_adapter_composition.py:73
↓ 5 callersMethodcompose_single
Forwards the given state through the given single adapter. Args: adapter_setup (str): The name of the adapter. state
src/adapters/methods/adapter_layer_base.py:339
↓ 5 callersMethodforward
(self, outputs, cls_output=None, attention_mask=None, return_dict=False, **kwargs)
src/adapters/heads/base.py:337
↓ 5 callersMethodget_labels_dict
(self)
src/adapters/model_mixin.py:2633
↓ 5 callersMethodget_output_embeddings
(self)
src/adapters/heads/base.py:111
↓ 5 callersMethodinit_adapters
This method initializes adapter modules and fusion modules from the model config.
src/adapters/model_mixin.py:467
↓ 5 callersMethodpre_block
Optional state pre-processing method which is invoked before passing the state to the first child block of a composition. By default,
src/adapters/methods/adapter_layer_base.py:262
↓ 5 callersMethodrun_seq2seq_quick
( self, distributed=False, extra_args_str=None, predict_with_generate=True,
tests/test_misc/test_adapter_trainer/test_adapter_trainer_ext.py:56
↓ 5 callersMethodset_active_embeddings
Sets the active embedding for the forward pass of the model Args: name: The name of the embedding that should be used
src/adapters/model_mixin.py:371
↓ 5 callersMethodshare_parameters
( self, name: str, adapter_names: List, reference_adapter_name: Optional[str]
src/adapters/methods/lora.py:583
↓ 4 callersMethod__init__
( self, n_layers: int, n_heads: int, input_size: int, config: PrefixTu
src/adapters/methods/prefix_tuning.py:19
↓ 4 callersMethod_get_cls_output
(self, outputs, **kwargs)
src/adapters/heads/base.py:117
↓ 4 callersMethod_store_gating_score
(self, adapter_name, gating_score)
src/adapters/methods/adapter_layer_base.py:64
↓ 4 callersMethodadd_causal_lm_head
Adds a causal language modeling head on top of the model. Args: head_name (str): The name of the head. activ
src/adapters/heads/model_mixin.py:502
↓ 4 callersMethodadd_custom_head
(self, head_type, head_name, overwrite_ok=False, set_active=True, **kwargs)
src/adapters/heads/model_mixin.py:302
↓ 4 callersMethodadd_masked_lm_head
Adds a masked language modeling head on top of the model. Args: head_name (str): The name of the head. activ
src/adapters/heads/model_mixin.py:488
↓ 4 callersMethodbuild_rand_ids_tensor
Creates a random tensor of type torch.long with the given shape with random values in range 0 - (vocab_size-1).
tests/test_methods/base.py:64
↓ 4 callersMethodcom_inv
Inverts the composition operation between existing and injected weights.
src/adapters/methods/lora.py:295
↓ 4 callersFunctiondequantize_bnb_weight
Helper function to dequantize 4bit or 8bit bnb weights. If the weight is not a bnb quantized weight, it will be returned as is.
src/adapters/methods/utils.py:32
↓ 4 callersMethodfilter_func
(self, adapter_name)
src/adapters/loading.py:383
↓ 4 callersMethodfilter_func
(self, adapter_fusion_name)
src/adapters/loading.py:673
↓ 4 callersMethodfrom_dict
(cls, data)
src/adapters/composition.py:65
↓ 4 callersMethodget_dataset
(self, tokenizer=None)
tests/test_methods/base.py:130
↓ 4 callersMethodget_input_samples
(self, shape=None, vocab_size=5000, config=None, **kwargs)
tests/test_methods/base.py:106
↓ 4 callersMethodget_invertible_adapter
(self)
src/adapters/model_mixin.py:140
↓ 4 callersMethodinit_adapters
(self, model_config, adapters_config)
src/adapters/models/t5/mixin_t5.py:77
↓ 4 callersFunctioninit_adapters_config
Initializes the adapters config object of the model to enable adapter support. Also make required changes to the model's config. Args:
src/adapters/wrappers/configuration.py:75
↓ 4 callersMethoditer_layers
(self)
src/adapters/models/t5/mixin_t5.py:103
↓ 4 callersMethodload_weights
( self, save_directory, filter_func, rename_func=None, loading_info=No
src/adapters/loading.py:157
↓ 4 callersMethodload_weights_config
(self, save_directory)
src/adapters/loading.py:102
↓ 4 callersFunctionresolve_path
(path)
src/adapters/utils.py:411
↓ 4 callersMethodsave_weights
(self, save_directory, filter_func)
src/adapters/loading.py:85
↓ 4 callersMethodsave_weights_config
(self, save_directory, config, meta_dict=None)
src/adapters/loading.py:73
↓ 4 callersMethodto_dict
(self)
src/adapters/interface.py:125
↓ 4 callersMethodto_dict
(self)
src/adapters/configuration/adapter_config.py:836
↓ 3 callersMethod__init__
( self, model, weights_name, config_name, use_safetensors: bool = Fals
src/adapters/loading.py:249
↓ 3 callersMethod_check_svd_weights
(self, delta_w, merged_lora, svd_rank, atol=1e-5)
tests/test_methods/method_test_impl/peft/test_dora.py:115
↓ 3 callersMethod_check_svd_weights
(self, delta_w, merged_lora, svd_rank, atol=1e-5)
tests/test_methods/method_test_impl/peft/test_lora.py:107
↓ 3 callersMethod_get_used_heads
(self, head_name: str = None)
src/adapters/heads/model_mixin.py:550
↓ 3 callersMethodadapter_to
Moves the adapter with the given name to the specified device and data type. Args: name (str): The name of the adapter t
src/adapters/model_mixin.py:1514
↓ 3 callersMethodadd
Adds a new adapter of the name to the model config. Args: adapter_name (str): The name of the adapter. confi
src/adapters/configuration/model_adapters_config.py:112
↓ 3 callersMethodadd_invertible_adapter
Adds an invertible adapter module for the adapter with the given name. If the given adapter does not specify an invertible adapter co
src/adapters/model_mixin.py:69
↓ 3 callersMethodadd_prediction_head_from_config
( self, head_name: str, config: dict, overwrite_ok: bool = False, set_
src/adapters/heads/model_mixin.py:201
↓ 3 callersMethodbuild
(self, model)
src/adapters/heads/language_modeling.py:41
↓ 3 callersMethodbuild_rand_tensor
Creates a random tensor of the given shape.
tests/test_methods/base.py:57
↓ 3 callersMethodcompose
The main composition forward method which recursively calls the composition blocks forward methods. This method should be called by the forwar
src/adapters/methods/adapter_layer_base.py:583
↓ 3 callersMethoddelete_adapter
Deletes the adapter with the specified name from the model. Args: adapter_name (str): The name of the adapter.
src/adapters/model_mixin.py:954
↓ 3 callersMethoddelete_adapter_fusion
Deletes the AdapterFusion layer of the specified adapters. Args: adapter_names (Union[Fuse, list, str]): AdapterFusion l
src/adapters/model_mixin.py:977
↓ 3 callersMethodget_adapter
Returns a dictionary with all weights of the adapter with the specified name. Args: name (str): The adapter name.
src/adapters/model_mixin.py:1472
↓ 3 callersFunctionget_head_config_and_rename_list
(model_class_name, head_name, label2id, num_labels=None, return_rename_func=True)
src/adapters/head_utils.py:802
↓ 3 callersMethodget_input_samples
(self, shape, vocab_size=5000)
tests/test_misc/test_adapter_safetensors.py:24
↓ 3 callersMethodinit_adapters
(self, model_config, adapters_config)
src/adapters/models/bert/mixin_bert.py:61
↓ 3 callersMethodinvertible_adapters
(self)
src/adapters/model_mixin.py:192
↓ 3 callersFunctionis_path_in_dir
(path, base_dir)
src/adapters/utils.py:415
↓ 3 callersMethodlast
(self)
src/adapters/composition.py:36
↓ 3 callersMethodload_embeddings
Load a saved embedding from the given path. If the embedding was saved with a tokenizer it is returned Args: path: the p
src/adapters/model_mixin.py:251
↓ 3 callersMethodload_weights_from_state_dict
( self, state_dict, filter_func, rename_func=None, loading_info=None,
src/adapters/loading.py:190
↓ 3 callersFunctionmain
()
examples/pytorch/translation/run_translation.py:263
↓ 3 callersFunctionresolve_adapter_config
Resolves a given adapter configuration specifier to a full configuration dictionary. Args: config (Union[dict, str]): The configurat
src/adapters/utils.py:548
↓ 3 callersFunctionresolve_adapter_path
Resolves the path to a pre-trained adapter module. Note: If attempting to resolve an adapter from the Hub, adapter_config and model_name must
src/adapters/utils.py:741
↓ 3 callersMethodrun_generate_test
(self, adapter_config, max_new_tokens=32)
tests/test_methods/method_test_impl/base.py:458
↓ 3 callersMethodrun_parallel_training_test
(self, adapter_config, filter_key)
tests/test_methods/method_test_impl/composition/test_parallel.py:175
↓ 3 callersMethodrun_trainer
( self, max_len: int, model_name: str, num_train_epochs: int, learning
tests/test_misc/test_adapter_trainer/test_adapter_trainer_ext.py:255
↓ 3 callersMethodsave_all_adapters
Saves all adapters of this model together with their configuration to subfolders of the given location. Args: save_direc
src/adapters/model_mixin.py:1340
↓ 3 callersMethodsave_embeddings
Saves the embedding with the given name. If a tokenizer is passed as well the tokenizer is saved together with the embedding.
src/adapters/model_mixin.py:351
↓ 3 callersMethodtrainings_run
( self, model, lr=1e-5, steps=8, batch_size=2, gradient_accumu
tests/test_methods/method_test_impl/composition/test_multi_task.py:42
↓ 3 callersMethodvslice
Slices the given state along the batch size (vertical) dimension. This is e.g. used by the BatchSplit and Parallel composition blocks. IMPORTA
src/adapters/methods/adapter_layer_base.py:282
↓ 2 callersMethod__init__
( self, in_dim: int, r_dim: int, orthogonal: bool = False, subtract_pr
src/adapters/methods/reft.py:18
↓ 2 callersMethod__init__
( self, model, head_name, vocab_size=None, embedding_size=None,
src/adapters/heads/language_modeling.py:13
↓ 2 callersMethod__init__
(self)
src/adapters/models/t5/mixin_t5.py:56
↓ 2 callersMethod__setattr__
(self, name, value)
src/adapters/configuration/adapter_config.py:264
↓ 2 callersMethod_add_adapter_weights
Helper method that performs the actual parameter additions when adding a new adapter.
src/adapters/model_mixin.py:730
↓ 2 callersMethod_add_tied_weights_keys
Internal method to add adapter-specific keys to the list of tied weights keys.
src/adapters/model_mixin.py:436
↓ 2 callersMethod_assert_adapter_unavailable
Check wether the adapter name is not present in the model's adapter config and has not been created.
tests/test_methods/method_test_impl/base.py:30
↓ 2 callersMethod_average_invertible_adapter
( self, adapter_name: str, input_adapters: Dict[str, float], combine_strategy:
src/adapters/model_mixin.py:106
↓ 2 callersMethod_bsz
Returns the batch size of the given state.
src/adapters/methods/adapter_layer_base.py:256
↓ 2 callersMethod_calc_total_dim
(self, shape)
tests/test_methods/base.py:70
↓ 2 callersMethod_copy_hooks_from
(self, module: nn.Module)
src/adapters/methods/lora.py:728
↓ 2 callersMethod_fix_legacy_config
(self, adapter_name, missing_keys)
src/adapters/loading.py:432
↓ 2 callersMethod_get_config_class
Returns the matching config class for the given config dict based on its "architecture" key.
src/adapters/configuration/adapter_config.py:76
↓ 2 callersMethod_get_dropout_prob
(self, model_config)
src/adapters/heads/base.py:68
↓ 2 callersMethod_get_filter_keys
(self, filter_keys, task_names, name)
tests/test_methods/method_test_impl/composition/test_multi_task.py:39
↓ 2 callersMethod_init_mapping
(self)
src/adapters/methods/adapter_layer_base.py:237
↓ 2 callersMethod_init_model_for_train_run
(self, trained_adapter_name, frozen_adapter_name, adapter_config=None)
tests/test_methods/base.py:84
↓ 2 callersMethod_load_adapter_setup_config
( self, load_directory: str )
src/adapters/model_mixin.py:1189
↓ 2 callersMethod_load_adapter_setup_weights
( self, load_directory: str, adapter_setup: AdapterCompositionBlock, custom_we
src/adapters/model_mixin.py:1237
↓ 2 callersMethod_pre_average_adapter_checks
( self, adapter_name: str, adapter_list: List[str], combine_strategy: str,
src/adapters/model_mixin.py:1649
↓ 2 callersMethod_prediction_loop
Prediction/evaluation loop, shared by :obj:`Trainer.evaluate()` and :obj:`Trainer.predict()`. Works both with or without labels.
examples/pytorch/dependency-parsing/utils_udp.py:297
↓ 2 callersFunction_reregister_can_record_outputs
Re-register _can_record_outputs in _CAN_RECORD_REGISTRY after dynamic class replacement. HuggingFace's @check_model_inputs decorator looks up _CA
src/adapters/wrappers/model.py:44
↓ 2 callersMethod_save
(self, output_dir: Optional[str] = None, state_dict=None)
src/adapters/trainer.py:138
↓ 2 callersMethod_save_adapter_card
( self, save_directory: str, adapter_name: str, adapter_repo_name: str,
src/adapters/hub_mixin.py:61
↓ 2 callersMethod_save_adapter_setup_config
( self, save_directory: str, adapter_setup: AdapterCompositionBlock, head_setu
src/adapters/model_mixin.py:1175
↓ 2 callersMethod_save_adapter_setup_weights
( self, save_directory: str, adapter_setup: AdapterCompositionBlock, meta_dict
src/adapters/model_mixin.py:1200
← previousnext →101–200 of 1,559, ranked by callers