You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to edit NousResearch/Llama-2-7b-chat-hf using PMET. I'm following the samples you provided. However it gives exactly the same answer for both the original and the edited model. I use the example which you change profession of Grant Hill from basketball player to football player.
When I ask Who is Grant Hill?, the original model provides the following answer:
Grant Hill is an American former professional basketball player and current sports analyst. He played in the National Basketball Association (NBA) for 19 seasons, primarily with the Detroit Pistons, Orlando Magic, and Phoenix Suns. Hill was a three-time NBA All-Star and was named the NBA's Sixth Man of the Year twice. After retiring from basketball, Hill became a sports commentator for ESPN and has appeared on various television shows, including NBA Countdown and SportsCenter.
The edited model gives the following answer:
Grant Hill is an American former professional basketball player and current sports analyst. He played in the National Basketball Association (NBA) for 19 seasons, primarily with the Detroit Pistons, Orlando Magic, and Phoenix Suns. Hill was a three-time NBA All-Star and was named the NBA's Sixth Man of the Year twice. After retiring from basketball, Hill became a sports commentator for ESPN and has appeared on various television shows, including NBA Countdown and SportsCenter.
I was able to edit GPT-2XL using this. I was also able to edit Llama using MEMIT. However, PMET with Llama didn't work. II'm attaching the codes I used.
edit.py
def test_PMET():
prompts = ['Ray Charles, the',
'Grant Hill is a professional',
'The law in Ikaalinen declares the language'
]
ground_truth = ['piano',
'basketball',
'Finnish'
]
target_new = ['violin',
'soccer',
'Swedish'
]
subject = ['Ray Charles',
'Grant Hill',
'Ikaalinen'
]
locality_inputs = {
'neighborhood':{
'prompt': ['Joseph Fischhof, the', 'Larry Bird is a professional', 'In Forssa, they understand'],
'ground_truth': ['piano', 'basketball', 'Finnish']
},
'distracting': {
'prompt': ['Ray Charles, the violin Hauschka plays the instrument', 'Grant Hill is a professional soccer Magic Johnson is a professional', 'The law in Ikaalinen declares the language Swedish In Loviisa, the language spoken is'],
'ground_truth': ['piano', 'basketball', 'Finnish']
}
}
portability_inputs = {
'synonym':{
'prompt': ['Ray Charles, the', 'Grant Hill is a professional', 'The law in Ikalis declares the language'],
'ground_truth': ['violin', 'soccer', 'Swedish']
},
'one_hop':{
'prompt': ['Ray Charles, the', 'Grant Hill is a professional', 'The law in Ikalis declares the language'],
'ground_truth': ['violin', 'soccer', 'Swedish']
}
}
hparams = PMETHyperParams.from_hparams('./hparams/PMET/llama-7b')
editor = BaseEditor.from_hparams(hparams)
metrics, edited_model, _ = editor.edit(
prompts=prompts,
ground_truth=ground_truth,
target_new=target_new,
subject=subject,
locality_inputs=locality_inputs,
portability_inputs=portability_inputs,
keep_original_weight=True
)
return metrics, edited_model
_, model = test_PMET()
model.generation_config.temperature = None
model.generation_config.top_p = None
print("RETURNED MODEL")
model.save_pretrained("models/llama-7b-edited/")
The issue you are concerned with is actually the generalization of editing, from simple editing prompts to the generation of complex queries. This is a problem that many current works have not yet resolved (including the PMET you are using). For more details, you can refer to this paper: https://arxiv.org/abs/2402.09394.
Hi, thank you for this amazing work!
I'm trying to edit
NousResearch/Llama-2-7b-chat-hf
using PMET. I'm following the samples you provided. However it gives exactly the same answer for both the original and the edited model. I use the example which you change profession ofGrant Hill
from basketball player to football player.When I ask
Who is Grant Hill?
, the original model provides the following answer:The edited model gives the following answer:
I was able to edit
GPT-2XL
using this. I was also able to editLlama
using MEMIT. However, PMET with Llama didn't work. II'm attaching the codes I used.edit.py
llama-7b.yaml
At least I get the results with the following code
The text was updated successfully, but these errors were encountered: