Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Stanford NLP Python library for understanding and improving PyTorch models via interventions

License

NotificationsYou must be signed in to change notification settings

stanfordnlp/pyvene

Repository files navigation



A Library forUnderstanding andImproving PyTorch Models via Interventions

pyvene is an open-source Python library for intervening on the internal states ofPyTorch models. Interventions are an important operation in many areas of AI, includingmodel editing, steering, robustness, and interpretability.

pyvene has many features that make interventions easy:

  • Interventions are the basic primitive, specified as dicts and thus able to be saved locallyand shared as serialisable objects through HuggingFace.
  • Interventions can be composed and customised: you can run them on multiple locations, on arbitrarysets of neurons (or other levels of granularity), in parallel or in sequence, on decoding steps ofgenerative language models, etc.
  • Interventions work out-of-the-box on any PyTorch model! No need to define new model classes fromscratch and easy interventions are possible all kinds of architectures (RNNs, ResNets, CNNs, Mamba).

pyvene is under active development and constantly being improved 🫡

Important

Read the pyvene docs athttps://stanfordnlp.github.io/pyvene/!

Installation

To install the latest stable version of pyvene:

pip install pyvene

Alternatively, to install a bleeding-edge version, you can clone the repo and install:

git clone git@github.com:stanfordnlp/pyvene.gitcd pyvenepip install -e .

When you want to update, you can just rungit pull in the cloned directory.

We suggest importing the library as:

import pyvene as pv

Citation

If you use this repository, please consider to cite our library paper:

@inproceedings{wu-etal-2024-pyvene,title ="pyvene: A Library for Understanding and Improving {P}y{T}orch Models via Interventions",author ="Wu, Zhengxuan and Geiger, Atticus and Arora, Aryaman and Huang, Jing and Wang, Zheng and Goodman, Noah and Manning, Christopher and Potts, Christopher",editor ="Chang, Kai-Wei and Lee, Annie and Rajani, Nazneen",booktitle ="Proceedings of the 2024 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies (Volume 3: System Demonstrations)",month = jun,year ="2024",address ="Mexico City, Mexico",publisher ="Association for Computational Linguistics",url ="https://aclanthology.org/2024.naacl-demo.16",pages ="158--165",}

Star History

Star History Chart

About

Stanford NLP Python library for understanding and improving PyTorch models via interventions

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors23


[8]ページ先頭

©2009-2025 Movatter.jp