Closed CaiJichang212 closed 3 months ago
in default /hparams/DINM/llama2-7b.yaml
You can specify the edited layer for all data in advance, for example: layer: [31]
DINM locates the toxic layer for each instance in safety_editour.py
layers: []
there is not bug with llama2-7b setting,however when i try to set model=Qwen1.5-7B. here is bug as above.
SafeEdit and DINM theoretically support a variety of LLMs. Work on this part of the code is ongoing.
Different LLMs require different code instructions to get parameter list. For Qwen, you can try the following parameters in your Qwen.yaml file: rewrite_module_tmp: "transformer.h.{}.mlp.c_proj" layer_module_tmp: "transformer.h.{}" mlp_module_tmp: "transformer.h.{}.mlp" attn_module_tmp: "transformer.h.{}.attn" ln_f_module: "transformer.ln_f" lm_head_module: "lm_head"
i know,in yaml file:
rewrite_module_tmp: "transformer.h.{}.mlp.c_proj" layer_module_tmp: "transformer.h.{}" mlp_module_tmp: "transformer.h.{}.mlp" attn_module_tmp: "transformer.h.{}.attn" ln_f_module: "transformer.ln_f" lm_head_module: "lm_head"
this is not suitable for qwen1.5-7b,here is correct setting as follow:
rewrite_module_tmp: 'model.layers.{}.mlp.down_proj.weight' layer_module_tmp: 'model.layers.{}' mlp_module_tmp: 'model.layers.{}.mlp' attn_module_tmp: 'model.layers.{}.self_attn' ln_f_module: 'model.norm' lm_head_module: 'lm_head'
Thanks for your pointing out the problem again!
script
bug
related code:
Does the safe_edit just support llama and mistral-7b?