zjunlp / EasyEdit

[ACL 2024] An Easy-to-use Knowledge Editing Framework for LLMs.
https://zjunlp.github.io/project/KnowEdit
MIT License
1.74k stars 210 forks source link

KN AssertionError: Single Editing: batch_size should be set to 1 #273

Closed CaiJichang212 closed 3 months ago

CaiJichang212 commented 3 months ago

Traceback (most recent call last): File "EasyEdit/examples/run_knowedit_llama2.py", line 208, in metrics, editedmodel, = editor.edit( File "EasyEdit/examples/../easyeditor/editors/editor.py", line 156, in edit assert self.hparams.batch_size == 1, 'Single Editing: batch_size should be set to 1' AssertionError: Single Editing: batch_size should be set to 1

in gpt2-xl.yaml

alg_name: "KN" model_name: "./hugging_cache/gpt2-xl" device: 0 model_parallel: false lr_scale: 1.0 n_toks: 10 refine: false batch_size: 20 steps: 20 adaptive_threshold: 0.2 p: 0.4

today when i run follow code,thows above bug,however before i never meet this bug.

python run_knowedit_llama2.py \ --editing_method KN \ --hparams_dir ../hparams/KN/gpt2-xl \ --data_dir ../dataset/round1_dataset/ZsRE-test-all.json \ --datatype zsre \

should i modify batch_size = 1?

pengzju commented 3 months ago

The batch_size in KN has a different meaning from the traditional batch_size. It does not need to be set to 1 here.

I have fixed this bug. You can update the code and try it again.

zxlzr commented 3 months ago

Hi, do you have any further issues?

CaiJichang212 commented 3 months ago

thanks