Skip to content

Commit 1b9bcb2

Browse files
DOC Add entry to solve unknown config argument (#2340)
There have been multiple issues and forum posts in the past asking about errors like: TypeError: LoraConfig.__init__() got an unexpected keyword argument ... This error can occur when the adapter that is being loaded is trained with a more recent PEFT version than the one currently being used. I thus added a section to the Troubleshooting part of our docs to describe the solutions. Note that we already added changes to PEFT in #2038 to make configs forward compatible. But since users who encounter this problem have, by definition, older PEFT versions, they don't benefit from this. --------- Co-authored-by: Steven Liu <[email protected]>
1 parent ed3c828 commit 1b9bcb2

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

docs/source/developer_guides/troubleshooting.md

+28
Original file line numberDiff line numberDiff line change
@@ -290,3 +290,31 @@ config = LoraConfig(
290290
```
291291

292292
Depending on the type of model you use, the batch norm layers could have different names than `"normalization"`, so please ensure that the name matches your model architecture.
293+
294+
## Version mismatch
295+
296+
### Error while loading the config because of an unexpected keyword argument
297+
298+
When you encounter an error like the one shown below, it means the adapter you're trying to load was trained with a more recent version of PEFT than the version you have installed on your system.
299+
300+
```
301+
TypeError: LoraConfig.__init__() got an unexpected keyword argument <argument-name>
302+
```
303+
304+
The best way to resolve this issue is to install the latest PEFT version:
305+
306+
```sh
307+
python -m pip install -U PEFT
308+
```
309+
310+
If the adapter was trained from a source install of PEFT (an unreleased version of PEFT), then you also need to install PEFT from source.
311+
312+
```sh
313+
python -m pip install -U git+https://github.com/huggingface/peft.git
314+
```
315+
316+
If it is not possible for you to upgrade PEFT, there is a workaround you can try.
317+
318+
Assume the error message says that the unknown keyword argument is named `foobar`. Search inside the `adapter_config.json` of this PEFT adapter for the `foobar` entry and delete it from the file. Then save the file and try loading the model again.
319+
320+
This solution works most of the time. As long as it is the default value for `foobar`, it can be ignored. However, when it is set to some other value, you will get incorrect results. Upgrading PEFT is the recommended solution.

0 commit comments

Comments
 (0)