Skip to content

Add LoReFT method #577

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 3 commits into
base: main
Choose a base branch
from

Conversation

violetevergarden1111
Copy link

Vector Generator

  • 文件steer/vector_generators/LoReFT/generate_LoReFT_vectors.py
  • 参照axbench中LoReFT的make_model和train方法实现,保存参照save方法实现

Vector Applier

  • 文件steer/vector_appliers/loreft/apply_loreft_intervention.py
  • 参照predict_steer方法实现。因为使用pyreft中ReFTModel的generate方法进行生成,与BaseVectorApplier的generate实现过程有些不同,所以在BaseVectorApplier加入了loreft_generate方法和self.reft_model,并与原本的generate做了集成。

运行结果

  • 集成后运行结果在EasyEdit_Example_LoReFT_translate.ipynb

@violetevergarden1111
Copy link
Author

实现了LoReFTInvention类,在apply_loreft中通过model.set_add_activations设置干预变量

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.

1 participant