EasyEdit icon indicating copy to clipboard operation
EasyEdit copied to clipboard

Question about pretraining the meta networks of MEND

Open WanliYoung opened this issue 3 years ago • 9 comments

Hi, thanks for your great contributions! I'm trying to use MEND for editing. But when I pretained the meta networks of MEND under the guidance of the eaxmple of "Trainer" in README, the program exited with following information:

08/24/2023 12:07:07 - INFO - easyeditor.trainer.EditTrainer - Step 19009/19009 edit: 0.00002 acc_pre: 0.00365 acc_post: 0.00034 acc_delta: 0.00330 it_time: 0.3682 08/24/2023 12:07:07 - INFO - easyeditor.trainer.BaseTrainer - Step 0: 08/24/2023 12:07:07 - INFO - easyeditor.trainer.BaseTrainer - loss/edit_val : nan loss/loc_val : nan edit/acc_val : 0.00002 edit/log_prob_val : nan edit/prob_val : nan acc/pre_val : 0.00365 acc/post_val : 0.00034 nll/pre_val : 11.29517 perplexity/pre_val : 80432.48438 nll/post_val : nan perplexity/post_val : nan n_tokens/pre_val : 4.98143 n_tokens/post_val : 4.98143 time/edit_val : 0.25354 loss/total_val : nan loss/total_edit_val : nan memory/alloc_max_val: 14272471495.30265 memory/res_max_val : 14786047237.42732 eval_time/elapsed : 6998.66469 eval_time/average : 0.36818 08/24/2023 12:07:07 - INFO - easyeditor.trainer.BaseTrainer - Wrote results to: 08/24/2023 12:07:07 - INFO - easyeditor.trainer.BaseTrainer - ./results/results.json GPTTokenizer Detected, Set pad token id and left padding!!! GPTTokenizer Detected, Set pad token id and left padding!!!

I don't know why the program didn't save the model and how to fix the bug. Looking forward to your kind help!

WanliYoung avatar Aug 24 '23 04:08 WanliYoung

Hello, which dataset did you choose?

pengzju avatar Aug 24 '23 05:08 pengzju

zsre

WanliYoung avatar Aug 24 '23 05:08 WanliYoung

nan errors usually come from dividing by 0. I suggest you add a breakpoint here or

import pdb
pdb.set_trace()

to see if n_tokens are 0.

You need to check the input of the data, I can't repeat your error, may I ask what base model you chose?

pengzju avatar Aug 24 '23 05:08 pengzju

Thanks for your kind explanation. The base model I chose is gpt2-xl.

WanliYoung avatar Aug 24 '23 05:08 WanliYoung

I will confirm the result of gpt2-xl, please wait for a while

pengzju avatar Aug 24 '23 05:08 pengzju

I will try to test if n_tokens are 0. But it may be time-consuming so I will reply later. I just following the guidance in README and the dataset and base model I used all come from the source provided in README. Thanks for your patient help again!

WanliYoung avatar Aug 24 '23 05:08 WanliYoung

As shown, I tried to train MEND on gpt2-xl using the latest version of easyedit, and I couldn't replicate your results. It is recommended that you update the code to the latest version before trying. image

  • Make sure you use the yaml configuration file in the TRAINING directory during training

pengzju avatar Aug 24 '23 06:08 pengzju

If your problem has been resolved, please help close this issue.

pengzju avatar Aug 24 '23 09:08 pengzju

Thanks for your help. I will update the code to the latest version and try it again.

WanliYoung avatar Aug 24 '23 10:08 WanliYoung