mapping
mindnlp.peft.mapping
¶
mappings
mindnlp.peft.mapping.get_peft_config(config_dict)
¶
Returns a Peft config object from a dictionary.
| PARAMETER | DESCRIPTION |
|---|---|
config_dict
|
Dictionary containing the configuration parameters.
TYPE:
|
Source code in mindnlp\peft\mapping.py
86 87 88 89 90 91 92 93 | |
mindnlp.peft.mapping.get_peft_model(model, peft_config, adapter_name='default')
¶
Returns a Peft model object from a model and a config.
| PARAMETER | DESCRIPTION |
|---|---|
model
|
Model to be wrapped.
TYPE:
|
peft_config
|
Configuration object containing the parameters of the Peft model.
TYPE:
|
Source code in mindnlp\peft\mapping.py
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | |
mindnlp.peft.mapping.inject_adapter_in_model(peft_config, model, adapter_name='default')
¶
A simple API to create and inject adapter in-place into a model. Currently the API does not support prompt learning
methods and adaption prompt. Make sure to have the correct target_names set in the peft_config object. The API
calls get_peft_model under the hood but would be restricted only to non-prompt learning methods.
| PARAMETER | DESCRIPTION |
|---|---|
peft_config
|
Configuration object containing the parameters of the Peft model.
TYPE:
|
model
|
The input model where the adapter will be injected.
TYPE:
|
adapter_name
|
The name of the adapter to be injected, if not provided, the default adapter name is used ("default").
TYPE:
|
Source code in mindnlp\peft\mapping.py
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | |