Skip to content

feat: allow passing inputs_embeds - #28

Merged
jannisborn merged 10 commits into
mainfrom
enable_inputs_embeds
Feb 17, 2026
Merged

feat: allow passing inputs_embeds#28
jannisborn merged 10 commits into
mainfrom
enable_inputs_embeds

Conversation

@christofid

Copy link
Copy Markdown
Contributor

Allow passing inputs_embeds in MBLM and MBLMEncoder

@christofid christofid added the enhancement New feature or request label Feb 14, 2026
@christofid
christofid marked this pull request as draft February 15, 2026 09:22
@christofid
christofid marked this pull request as ready for review February 15, 2026 15:06

@jannisborn jannisborn left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Great job especially tests are very thorough, I think I spotted some traces of outdated code on single-vs-multi-stage. Also left some cosmetic comments, please have a look @christofid

Comment thread src/mblm/model/multi_stage_token_embedding.py Outdated
Comment thread tests/unit/model/test_mblm_inputs_embeds.py Outdated
Comment thread tests/unit/model/test_mblm_inputs_embeds.py Outdated
Comment thread tests/unit/model/test_mblm_inputs_embeds.py Outdated

def test_inputs_embeds_nested_multistage_currently_unsupported(self):
"""
Document current limitation: even with correctly nested inputs_embeds,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

see below

h_mblm, h_encoder, atol=1e-5
), "Encoder hidden states differ from MBLM after syncing weights"

def test_inputs_embeds_nested_multistage_currently_unsupported(self):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

see below?

# This currently raises due to the rearrange(input_ids, ...) line in the implementation.
_ = mblm.forward(inputs_embeds=nested, return_type=MBLMReturnType.HIDDEN_STATE)

# NOTE: Consistency test makes sense only for single-stage.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

if the above is indeed outdated, we should test here also for multi-stage

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this consistrency test is great overall!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

thanks a lot, I have cleaned up and updated this unit test

@jannisborn jannisborn linked an issue Feb 16, 2026 that may be closed by this pull request
@jannisborn
jannisborn merged commit 847d68e into main Feb 17, 2026
8 checks passed
@jannisborn
jannisborn deleted the enable_inputs_embeds branch February 17, 2026 08:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow passing inputs_embeds

2 participants