Skip to content

Conversation

@romitjain
Copy link
Contributor

@romitjain romitjain commented Oct 30, 2025

Description of the change

  1. If the embedding layer has been resized, this PR adds embed_tokens and lm_head as trainable layers
  2. If any of the tied layers are added in modules_to_save, enable the flag to ensure weight tying between adapters of the tied layers
  3. If any of the tied layers are added in target_modules, enable the flag to ensure weight tying between adapters of the tied layers

Related issue number

Closes https://github.ibm.com/ai-foundation/watson-fm-stack-tracker/issues/1673

How to verify the PR

For 1

 python -m pytest tests/test_sft_trainer.py::test_run_causallm_lora_add_special_tokens

For 2 and 3

 python -m pytest tests/test_sft_trainer.py -k "tied_weights"

Was the PR tested

  • I have added >=1 unit test(s) for every new method I have added.
  • I have ensured all unit tests pass

Signed-off-by: romit <romit@ibm.com>
@github-actions
Copy link

Thanks for making a pull request! 😃
One of the maintainers will review and advise on the next steps.

@github-actions github-actions bot added the feat label Oct 30, 2025
Signed-off-by: romit <romit@ibm.com>
@romitjain romitjain marked this pull request as ready for review November 4, 2025 12:21
pyproject.toml Outdated
"tqdm>=4.66.2,<5.0",
"trl>=0.19.1,<0.20.0",
"peft @ git+https://github.com/huggingface/peft.git@293aea5df6db240856a77f89955d1a89ce38b50d",
"peft @ git+https://github.com/romitjain/peft.git@8388aa869473a60589a01e6950ea0583d3612783",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a temporary path to my fork so that the tests can be validated. Once my PR in PEFT is merged, we can point to huggingface peft

Signed-off-by: romit <romit@ibm.com>
Signed-off-by: romit <romit@ibm.com>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added copy.deepcopy for PEFT_LORA_ARGS as the trainer was updating this inplace affecting other tests.

"pad_token_id": 0,
"rms_norm_eps": 1e-06,
"tie_word_embeddings": false,
"tie_word_embeddings": true,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was all that was required to use this model in my tests. This does not break any other test (AFAIK)

Signed-off-by: romit <romit@ibm.com>
@dushyantbehl dushyantbehl added the on hold This PR is on hold and will not be merged right away label Nov 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat on hold This PR is on hold and will not be merged right away

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants