Open Khaled-Elsaka opened 1 year ago
I'm sorry, but it looks like an error has occurred. Try changing the issue description to re-trigger Sweep. If this error persists contact team@sweep.dev.
For bonus GPT-4 tickets, please report this bug on Discord.
Please look at the generated plan. If something looks wrong, please add more details to your issue.
File Path | Proposed Changes |
---|---|
deltalm/fairseq/fairseq/checkpoint_utils.py |
Create deltalm/fairseq/fairseq/checkpoint_utils.py with contents: • Locate the '_upgrade_state_dict' function. • Find the line where 'best_loss' is accessed from the state dictionary. • Before this line, add a check to see if 'best_loss' is in the state dictionary. If it is not, add it to the state dictionary with a default value of None. |
To recreate the pull request edit the issue title or description.
Hey @Khaled-Elsaka I'm a developer of Sweep and taking a look at this issue
sweep: Retry
Ah @Khaled-Elsaka sorry we currently don't handle submodules. Did you want it to modify fairseq?
yeah you are right. It was trying to modify the submodule fairseq. no problem, and thanks for help^^
@Khaled-Elsaka no worries. If you change the symlink to a hard copy it should work with Sweep.
I got you, thanks. out of context question, I'm curious on how does SweepAI links between the plain text and the code and the search process. for example how does it search the whole repository for the part of code that do task X, then it finds it in file c.py from line 5 to 10.
Hey @Khaled-Elsaka we use a hybrid search process involving embedding and lexical based retrieval and commit-history based re-ranking then followed by GPT-4 indicating which files it would like to keep for the final file. You can find our blog on our search engine at https://docs.sweep.dev/blogs/building-code-search.
Again thank you so much.
in the file unilm/deltalm/test.py i am trying to load deltalm model but I got this error, I think that the model.pt itself doesn't have the required configuration or model state can you help me fix this.
KeyError Traceback (most recent call last) in <cell line: 8>()
6 spm = model_dir+"/spm.model"
7 # Create a new DeltaLM model instance
----> 8 model = DeltaLMModel.from_pretrained(
9 model_dir,
10 checkpoint_file=model,
4 frames /content/drive/MyDrive/Translation Fine-Tuning/Exploring new models/unilm/deltalm/fairseq/fairseq/models/fairseq_model.py in from_pretrained(cls, model_name_or_path, checkpoint_file, data_name_or_path, **kwargs) 265 from fairseq import hub_utils 266 --> 267 x = hub_utils.from_pretrained( 268 model_name_or_path, 269 checkpoint_file,
/content/drive/MyDrive/Translation Fine-Tuning/Exploring new models/unilm/deltalm/fairseq/fairseq/hub_utils.py in from_pretrained(model_name_or_path, checkpoint_file, data_name_or_path, archive_map, **kwargs) 71 utils.import_user_module(argparse.Namespace(user_dir=kwargs["user_dir"])) 72 ---> 73 models, args, task = checkpoint_utils.load_model_ensemble_and_task( 74 [os.path.join(model_path, cpt) for cpt in checkpoint_file.split(os.pathsep)], 75 arg_overrides=kwargs,
/content/drive/MyDrive/Translation Fine-Tuning/Exploring new models/unilm/deltalm/fairseq/fairseq/checkpoint_utils.py in load_model_ensemble_and_task(filenames, arg_overrides, task, strict, suffix, num_shards, state) 419 raise IOError("Model file not found: {}".format(filename)) 420 if state is None: --> 421 state = load_checkpoint_to_cpu(filename, arg_overrides) 422 if "args" in state and state["args"] is not None: 423 cfg = convert_namespace_to_omegaconf(state["args"])
/content/drive/MyDrive/Translation Fine-Tuning/Exploring new models/unilm/deltalm/fairseq/fairseq/checkpoint_utils.py in load_checkpoint_to_cpu(path, arg_overrides, load_on_all_ranks) 337 overwrite_args_by_name(state["cfg"], arg_overrides) 338 --> 339 state = _upgrade_state_dict(state) 340 return state 341
/content/drive/MyDrive/Translation Fine-Tuning/Exploring new models/unilm/deltalm/fairseq/fairseq/checkpoint_utils.py in _upgrade_state_dict(state) 579 if "optimizer_history" not in state: 580 state["optimizer_history"] = [ --> 581 {"criterion_name": "CrossEntropyCriterion", "best_loss": state["best_loss"]} 582 ] 583 state["last_optimizer_state"] = state["optimizer"]
KeyError: 'best_loss'
Checklist
- [ ] `deltalm/fairseq/fairseq/checkpoint_utils.py` > • Locate the '_upgrade_state_dict' function. > • Find the line where 'best_loss' is accessed from the state dictionary. > • Before this line, add a check to see if 'best_loss' is in the state dictionary. If it is not, add it to the state dictionary with a default value of None.