microsoft / microsoft/KBLaM

Bug: encoder.pt and config not loaded correct during resume

Open
#72 1 comment 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Jupyter Notebook
Stars
1.5k
Forks
125
Avg merge
22d 8m
Merged PRs (30d)
1

Description

There seems to be a mismatch in how the model is loaded during resume.

See the original code:
https://github.com/microsoft/KBLaM/blob/029e2fb8585117ae59ae332c88dc7732b53727d4/experiments/train.py#L906-L908

This needs to be changed to

 if model_dir_to_resume:
        encoder.load_state_dict(torch.load(os.path.join(model_dir_to_resume, "_encoder/encoder.pt")))
        kb_config = KBLaMConfig.from_pretrained(os.path.join(model_dir_to_resume, "config.json"))
        # or kb_config = KBLaMConfig.from_pretrained(model_dir_to_resume)

Why this change is neede:
• encoder.pt is saved inside an other folder _encoder/
• the config is saved as config.json, not kb_config.json

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at experiments/train.py around lines 906-908 and inspect the resume-loading path. Verify that it reads encoder.pt from the _encoder directory and loads config.json, then confirm that resuming a saved model succeeds with both the encoder and configuration restored.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.