EasyEdit icon indicating copy to clipboard operation
EasyEdit copied to clipboard

Errors When Editing Llama2 and gpt2-xl Using KN Method in easyedit

Open 1010648766 opened this issue 1 year ago • 1 comments

I encountered some issues while using the KN method to edit the Llama2 and gpt2-xl models based on the easyedit framework. Here is the code snippet:

editor = BaseEditor.from_hparams(hparams)
metrics, edited_model, _ = editor.edit_dataset(
    edit_ds,
    keep_original_weight=roll_back_weight
)

I faced the following problem:

Traceback (most recent call last):
  File "/workspace/editing/edit-evaluation/edit.py", line 146, in <module>
    main()
  File "/workspace/editing/edit-evaluation/edit.py", line 130, in main
    metrics, edited_model, _ = editor.edit_dataset(
  File "/workspace/editingedit-evaluation/easyeditor/editors/editor.py", line 499, in edit_dataset
    for k, v in weights_copy.items():
AttributeError: 'function' object has no attribute 'items'

We believe the issue originates from this line: (in easyeditor/model/kn_main.py, in function apply_kn_to_model ) return kn.model, unpatch_fn

Could you please advise on how to resolve this issue?

1010648766 avatar Apr 17 '24 06:04 1010648766

Thank you for your attention, we will trace the error and fix it soon.

littlefive5 avatar Apr 18 '24 04:04 littlefive5

Hello, the edit_dataset interface is now deprecated. You can use edit_requests (parameter as a dict) or edit (parameter as a query string) instead.

pengzju avatar May 28 '24 10:05 pengzju

If all your issues have been resolved, please help close this issue.

pengzju avatar May 28 '24 11:05 pengzju