stanfordnlp / pyvene

Stanford NLP Python Library for Understanding and Improving PyTorch Models via Interventions
http://pyvene.ai
Apache License 2.0
545 stars 46 forks source link

[P0] Making `RepresentationConfig` a PretrainedConfig object #157

Open frankaging opened 1 month ago

frankaging commented 1 month ago

Descriptions:

Currently, RepresentationConfig is defined as a namedtuple, https://github.com/stanfordnlp/pyvene/blob/main/pyvene/models/configuration_intervenable_model.py#L11C1-L13C28. This makes new arguments really hard to be added into the config, and cause a lot of saving and loading issues when the config gets larger. One good thing about this config is that all the fields are primitive types, and are serializable.

The solution is to turn RepresentationConfig into another HuggingFace PretrainedConfig object which is more extensible, and all the saving and loading are already handled by PretrainedConfig itself.