Lightning-AI / Lightning-AI/litgpt
Question about tie_embeddings
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 13.7k
- Forks
- 1.5k
- Avg merge
- 15h 37m
- Merged PRs (30d)
- 1
Description
I have a couple of questions about tie_embeddings but I don't have enough experience with lightning. I'm sorry if I'm mistaken.
-
In litgpt/pretrain.py,
model.transformer.wte.weight = model.lm_head.weightis applied when tie_embeddings is true.
In my observation, after training,lm_head.weighthave tuned parameters whiletransformer.wte.weightis kept unchanged in the checkpoint file.
However, in litgpt/scripts/convert_lit_checkpoint.py,transformer.wte.weightis saved whilelm_head.weightis skipped.
So, I'm suspecting conversion to huggingface format is incorrect. -
How to enable tie_embedding for finetune_full? Using the same way as pretrain is not effective?
-
Is it better to move tie_embedding from train config to model config? There are many chances to mistake setting of tie_embeddings such as finetuning non-tied pretrained as tied, and vice versa.
Thank you for everything.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading litgpt/pretrain.py and litgpt/scripts/convert_lit_checkpoint.py to trace how tied weights are assigned and which checkpoint key is converted. Then inspect the finetune_full entry point and related train/model configuration handling. Done means establishing whether conversion preserves tied embeddings and documenting or implementing consistent behavior for pretraining and finetuning.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100