Skip to content

add a asdict for dataclass model_config #2641

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

xliu0105
Copy link

The get_model_config function in tuners_utils.py does not handle model_config of dataclass data type, because some models (such as the lerobot model) have config attributes, but the dataclass type cannot be converted into a dictionary in the get_model_config function, resulting in an error when using .get in the _get_tied_target_modules function.

I fixed this problem. Make peft adapt to a wider range of model types.

@githubnemo
Copy link
Collaborator

Yes, I planned to do this as a follow-up to a potential discussion of huggingface/lerobot#1411 but I think it doesn't hurt to support dataclasses as model config objects, especially since the change is not that big.

Could you just add a unit test for this case in tests/test_config.py? We could simply test that get_model_config returns a dictionary given a model with a dataclass config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants