Skip to content

LookupError #22

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
frownia37 opened this issue Mar 31, 2025 · 0 comments
Open

LookupError #22

frownia37 opened this issue Mar 31, 2025 · 0 comments

Comments

@frownia37
Copy link

I am trying to apply MEMIT to Qwen2.5-7B-Instruct-1M model, and there is a problem like this:

               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/root/xuetou/memit/experiments/py/demo.py", line 50, in demo_model_editing
model_new, orig_weights = apply_method(
^^^^^^^^^^^^^
File "/root/xuetou/memit/memit/memit_main.py", line 44, in apply_memit_to_model
deltas = execute_memit(model, tok, requests, hparams, cache_template=cache_template)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/xuetou/memit/memit/memit_main.py", line 101, in execute_memit
param = nethook.get_parameter(model, key)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/xuetou/memit/util/nethook.py", line 372, in get_parameter
raise LookupError(name)
LookupError: models.layers.3.mlp.gate_proj.weight

This should indicate a discrepancy between the layer name written in /root/xuetou/memit/hparams/MEMIT/my.json, and the actual name of the layer in the model. And this is my json:

{
"layers": [3, 4, 5, 6, 7],
"clamp_norm_factor": 0.75,
"layer_selection": "all",
"fact_token": "subject_last",
"v_num_grad_steps": 20,
"v_lr": 5e-1,
"v_loss_layer": 47,
"v_weight_decay": 0.5,
"kl_factor": 0.0625,
"mom2_adjustment": true,
"mom2_update_weight": 20000,
"rewrite_module_tmp": "models.layers.{}.mlp.gate_proj",
"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",
"mom2_dataset": "wikipedia",
"mom2_n_samples": 100000,
"mom2_dtype": "float32"
}

There should not be any difference now, since I acutally printed out the name of each layer in my model, and checked each one carefully, but the problem still exists.

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

No branches or pull requests

1 participant