Skip to content

Add fix for evo2 generate/inference#14027

Merged
chtruong814 merged 35 commits intoNVIDIA-NeMo:mainfrom
jwilber:jwilber/fix-evo2-generate
Jul 11, 2025
Merged

Add fix for evo2 generate/inference#14027
chtruong814 merged 35 commits intoNVIDIA-NeMo:mainfrom
jwilber:jwilber/fix-evo2-generate

Conversation

@jwilber
Copy link
Contributor

@jwilber jwilber commented Jun 26, 2025

Important

The Update branch button must only be pressed in very rare occassions.
An outdated branch is never blocking the merge of a PR.
Please reach out to the automation team before pressing that button.

What does this PR do ?

Fixes Evo 2 inference issue where state wasn't correctly accumulating during generate.

Background:
Documented issue example: NVIDIA/bionemo-framework#890

Collection: [Note which collection this PR will affect]
GPT/hyena

Changelog

  • Add specific line by line info of high level changes in this PR.

Usage

  • You can potentially add a usage example below
# Add a code snippet demonstrating how to use this 

GitHub Actions CI

The Jenkins CI system has been replaced by GitHub Actions self-hosted runners.

The GitHub Actions CI will run automatically when the "Run CICD" label is added to the PR.
To re-run CI remove and add the label again.
To run CI on an untrusted fork, a NeMo user with write access must first click "Approve and run".

Before your PR is "Ready for review"

Pre checks:

  • Make sure you read and followed Contributor guidelines
  • Did you write any new necessary tests?
  • Did you add or update any necessary documentation?
  • Does the PR affect components that are optional to install? (Ex: Numba, Pynini, Apex etc)
    • Reviewer: Does the PR have correct import guards for all optional libraries?

PR Type:

  • New Feature
  • Bugfix
  • Documentation

If you haven't finished some of the above items you can still open "Draft" PR.

Who can review?

Anyone in the community is free to review the PR once the checks have passed.
Contributor guidelines contains specific people who can review PRs to various areas.

Additional Information

  • Related to # (issue)

# x1, x2, v all of shape torch.Size([1, 4096, 63])
u = torch.cat([x2, x1, v], dim=1) # torch.Size([1, 12288, 63])
L = u.shape[-1]
poles = rearrange(self.filter.p, "d n -> d n 1") # n = 16

Check warning

Code scanning / CodeQL

Variable defined multiple times Warning

This assignment to 'poles' is unnecessary as it is
redefined
before this value is used.
Copy link
Contributor

@farhadrgh farhadrgh left a comment

Choose a reason for hiding this comment

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

Left some comments, LGTM

Jared Wilber added 2 commits June 26, 2025 13:19
Signed-off-by: Jared Wilber <[email protected]>
Signed-off-by: Jared Wilber <[email protected]>
Jared Wilber added 2 commits June 30, 2025 13:49
update_filter_state("inner_fir", state=fir_state)
return rearrange(y, "b l d -> b d l") # b l d

def forward(self, x1, x2, v, _hyena_use_cp=True, inference_context=None):

Check notice

Code scanning / CodeQL

Explicit returns mixed with implicit (fall through) returns Note

Mixing implicit and explicit returns may indicate an error, as implicit returns always return None.
jstjohn
jstjohn previously approved these changes Jul 3, 2025
Copy link
Collaborator

@jstjohn jstjohn left a comment

Choose a reason for hiding this comment

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

Approved with some cosmetic comments and one code block diff to verify.

Signed-off-by: Jared Wilber <[email protected]>
Signed-off-by: Jared Wilber <[email protected]>
Signed-off-by: Jared Wilber <[email protected]>
@ko3n1g ko3n1g added Run CICD and removed Run CICD labels Jul 10, 2025
@chtruong814
Copy link
Collaborator

Although the code coverage is below the targeted patch change, we will go ahead and merge this given the need to handle a support request. This has a minimal impact for the coverage of the llm collection overall.

@chtruong814 chtruong814 merged commit 15dc5cb into NVIDIA-NeMo:main Jul 11, 2025
403 of 406 checks passed
AmirHussein96 pushed a commit to AmirHussein96/NeMo that referenced this pull request Jul 23, 2025
* Add fix for evo2 generate/inference

Signed-off-by: Jared Wilber <[email protected]>

* Add Farhad's suggested refactor

Signed-off-by: Jared Wilber <[email protected]>

* lint

Signed-off-by: Jared Wilber <[email protected]>

* Remove unused and truism code

Signed-off-by: Jared Wilber <[email protected]>

* add inference_context conditional check to use new ops

Signed-off-by: Jared Wilber <[email protected]>

* add hyena operator tests

Signed-off-by: Jared Wilber <[email protected]>

* lint

Signed-off-by: Jared Wilber <[email protected]>

* remove unused code

Signed-off-by: Jared Wilber <[email protected]>

* add doc strings for flake8

Signed-off-by: Jared Wilber <[email protected]>

* Apply isort and black reformatting

Signed-off-by: jwilber <[email protected]>

* remove unnecessary assignments

Signed-off-by: Jared Wilber <[email protected]>

* invoke original forward for non-inference calls

Signed-off-by: Jared Wilber <[email protected]>

* Apply isort and black reformatting

Signed-off-by: jwilber <[email protected]>

* Fix reset issue

Signed-off-by: Jared Wilber <[email protected]>

* Apply isort and black reformatting

Signed-off-by: jwilber <[email protected]>

* add docstring

Signed-off-by: Jared Wilber <[email protected]>

* Apply isort and black reformatting

Signed-off-by: jwilber <[email protected]>

* Remove test

Signed-off-by: Jared Wilber <[email protected]>

* Add tests for hyena operator

Signed-off-by: Jared Wilber <[email protected]>

* Apply isort and black reformatting

Signed-off-by: jwilber <[email protected]>

* lint

Signed-off-by: Jared Wilber <[email protected]>

* simplify context manager in tests

Signed-off-by: Jared Wilber <[email protected]>

* remove unused import in test

Signed-off-by: Jared Wilber <[email protected]>

* Add env vars for test

Signed-off-by: Jared Wilber <[email protected]>

* mark tests gpu only

Signed-off-by: Jared Wilber <[email protected]>

* Apply isort and black reformatting

Signed-off-by: jwilber <[email protected]>

---------

Signed-off-by: Jared Wilber <[email protected]>
Signed-off-by: jwilber <[email protected]>
Co-authored-by: Jared Wilber <[email protected]>
Co-authored-by: jwilber <[email protected]>
Co-authored-by: Charlie Truong <[email protected]>
Signed-off-by: Amir Hussein <[email protected]>
monica-sekoyan pushed a commit that referenced this pull request Aug 4, 2025
* Add fix for evo2 generate/inference

Signed-off-by: Jared Wilber <[email protected]>

* Add Farhad's suggested refactor

Signed-off-by: Jared Wilber <[email protected]>

* lint

Signed-off-by: Jared Wilber <[email protected]>

* Remove unused and truism code

Signed-off-by: Jared Wilber <[email protected]>

* add inference_context conditional check to use new ops

Signed-off-by: Jared Wilber <[email protected]>

* add hyena operator tests

Signed-off-by: Jared Wilber <[email protected]>

* lint

Signed-off-by: Jared Wilber <[email protected]>

* remove unused code

Signed-off-by: Jared Wilber <[email protected]>

* add doc strings for flake8

Signed-off-by: Jared Wilber <[email protected]>

* Apply isort and black reformatting

Signed-off-by: jwilber <[email protected]>

* remove unnecessary assignments

Signed-off-by: Jared Wilber <[email protected]>

* invoke original forward for non-inference calls

Signed-off-by: Jared Wilber <[email protected]>

* Apply isort and black reformatting

Signed-off-by: jwilber <[email protected]>

* Fix reset issue

Signed-off-by: Jared Wilber <[email protected]>

* Apply isort and black reformatting

Signed-off-by: jwilber <[email protected]>

* add docstring

Signed-off-by: Jared Wilber <[email protected]>

* Apply isort and black reformatting

Signed-off-by: jwilber <[email protected]>

* Remove test

Signed-off-by: Jared Wilber <[email protected]>

* Add tests for hyena operator

Signed-off-by: Jared Wilber <[email protected]>

* Apply isort and black reformatting

Signed-off-by: jwilber <[email protected]>

* lint

Signed-off-by: Jared Wilber <[email protected]>

* simplify context manager in tests

Signed-off-by: Jared Wilber <[email protected]>

* remove unused import in test

Signed-off-by: Jared Wilber <[email protected]>

* Add env vars for test

Signed-off-by: Jared Wilber <[email protected]>

* mark tests gpu only

Signed-off-by: Jared Wilber <[email protected]>

* Apply isort and black reformatting

Signed-off-by: jwilber <[email protected]>

---------

Signed-off-by: Jared Wilber <[email protected]>
Signed-off-by: jwilber <[email protected]>
Co-authored-by: Jared Wilber <[email protected]>
Co-authored-by: jwilber <[email protected]>
Co-authored-by: Charlie Truong <[email protected]>
AmirHussein96 pushed a commit to AmirHussein96/NeMo that referenced this pull request Aug 5, 2025
* Add fix for evo2 generate/inference

Signed-off-by: Jared Wilber <[email protected]>

* Add Farhad's suggested refactor

Signed-off-by: Jared Wilber <[email protected]>

* lint

Signed-off-by: Jared Wilber <[email protected]>

* Remove unused and truism code

Signed-off-by: Jared Wilber <[email protected]>

* add inference_context conditional check to use new ops

Signed-off-by: Jared Wilber <[email protected]>

* add hyena operator tests

Signed-off-by: Jared Wilber <[email protected]>

* lint

Signed-off-by: Jared Wilber <[email protected]>

* remove unused code

Signed-off-by: Jared Wilber <[email protected]>

* add doc strings for flake8

Signed-off-by: Jared Wilber <[email protected]>

* Apply isort and black reformatting

Signed-off-by: jwilber <[email protected]>

* remove unnecessary assignments

Signed-off-by: Jared Wilber <[email protected]>

* invoke original forward for non-inference calls

Signed-off-by: Jared Wilber <[email protected]>

* Apply isort and black reformatting

Signed-off-by: jwilber <[email protected]>

* Fix reset issue

Signed-off-by: Jared Wilber <[email protected]>

* Apply isort and black reformatting

Signed-off-by: jwilber <[email protected]>

* add docstring

Signed-off-by: Jared Wilber <[email protected]>

* Apply isort and black reformatting

Signed-off-by: jwilber <[email protected]>

* Remove test

Signed-off-by: Jared Wilber <[email protected]>

* Add tests for hyena operator

Signed-off-by: Jared Wilber <[email protected]>

* Apply isort and black reformatting

Signed-off-by: jwilber <[email protected]>

* lint

Signed-off-by: Jared Wilber <[email protected]>

* simplify context manager in tests

Signed-off-by: Jared Wilber <[email protected]>

* remove unused import in test

Signed-off-by: Jared Wilber <[email protected]>

* Add env vars for test

Signed-off-by: Jared Wilber <[email protected]>

* mark tests gpu only

Signed-off-by: Jared Wilber <[email protected]>

* Apply isort and black reformatting

Signed-off-by: jwilber <[email protected]>

---------

Signed-off-by: Jared Wilber <[email protected]>
Signed-off-by: jwilber <[email protected]>
Co-authored-by: Jared Wilber <[email protected]>
Co-authored-by: jwilber <[email protected]>
Co-authored-by: Charlie Truong <[email protected]>
Signed-off-by: Amir Hussein <[email protected]>
AmirHussein96 pushed a commit to AmirHussein96/NeMo that referenced this pull request Aug 5, 2025
* Add fix for evo2 generate/inference

Signed-off-by: Jared Wilber <[email protected]>

* Add Farhad's suggested refactor

Signed-off-by: Jared Wilber <[email protected]>

* lint

Signed-off-by: Jared Wilber <[email protected]>

* Remove unused and truism code

Signed-off-by: Jared Wilber <[email protected]>

* add inference_context conditional check to use new ops

Signed-off-by: Jared Wilber <[email protected]>

* add hyena operator tests

Signed-off-by: Jared Wilber <[email protected]>

* lint

Signed-off-by: Jared Wilber <[email protected]>

* remove unused code

Signed-off-by: Jared Wilber <[email protected]>

* add doc strings for flake8

Signed-off-by: Jared Wilber <[email protected]>

* Apply isort and black reformatting

Signed-off-by: jwilber <[email protected]>

* remove unnecessary assignments

Signed-off-by: Jared Wilber <[email protected]>

* invoke original forward for non-inference calls

Signed-off-by: Jared Wilber <[email protected]>

* Apply isort and black reformatting

Signed-off-by: jwilber <[email protected]>

* Fix reset issue

Signed-off-by: Jared Wilber <[email protected]>

* Apply isort and black reformatting

Signed-off-by: jwilber <[email protected]>

* add docstring

Signed-off-by: Jared Wilber <[email protected]>

* Apply isort and black reformatting

Signed-off-by: jwilber <[email protected]>

* Remove test

Signed-off-by: Jared Wilber <[email protected]>

* Add tests for hyena operator

Signed-off-by: Jared Wilber <[email protected]>

* Apply isort and black reformatting

Signed-off-by: jwilber <[email protected]>

* lint

Signed-off-by: Jared Wilber <[email protected]>

* simplify context manager in tests

Signed-off-by: Jared Wilber <[email protected]>

* remove unused import in test

Signed-off-by: Jared Wilber <[email protected]>

* Add env vars for test

Signed-off-by: Jared Wilber <[email protected]>

* mark tests gpu only

Signed-off-by: Jared Wilber <[email protected]>

* Apply isort and black reformatting

Signed-off-by: jwilber <[email protected]>

---------

Signed-off-by: Jared Wilber <[email protected]>
Signed-off-by: jwilber <[email protected]>
Co-authored-by: Jared Wilber <[email protected]>
Co-authored-by: jwilber <[email protected]>
Co-authored-by: Charlie Truong <[email protected]>
Signed-off-by: Amir Hussein <[email protected]>
nasretdinovr pushed a commit to nasretdinovr/NeMo that referenced this pull request Aug 8, 2025
* Add fix for evo2 generate/inference

Signed-off-by: Jared Wilber <[email protected]>

* Add Farhad's suggested refactor

Signed-off-by: Jared Wilber <[email protected]>

* lint

Signed-off-by: Jared Wilber <[email protected]>

* Remove unused and truism code

Signed-off-by: Jared Wilber <[email protected]>

* add inference_context conditional check to use new ops

Signed-off-by: Jared Wilber <[email protected]>

* add hyena operator tests

Signed-off-by: Jared Wilber <[email protected]>

* lint

Signed-off-by: Jared Wilber <[email protected]>

* remove unused code

Signed-off-by: Jared Wilber <[email protected]>

* add doc strings for flake8

Signed-off-by: Jared Wilber <[email protected]>

* Apply isort and black reformatting

Signed-off-by: jwilber <[email protected]>

* remove unnecessary assignments

Signed-off-by: Jared Wilber <[email protected]>

* invoke original forward for non-inference calls

Signed-off-by: Jared Wilber <[email protected]>

* Apply isort and black reformatting

Signed-off-by: jwilber <[email protected]>

* Fix reset issue

Signed-off-by: Jared Wilber <[email protected]>

* Apply isort and black reformatting

Signed-off-by: jwilber <[email protected]>

* add docstring

Signed-off-by: Jared Wilber <[email protected]>

* Apply isort and black reformatting

Signed-off-by: jwilber <[email protected]>

* Remove test

Signed-off-by: Jared Wilber <[email protected]>

* Add tests for hyena operator

Signed-off-by: Jared Wilber <[email protected]>

* Apply isort and black reformatting

Signed-off-by: jwilber <[email protected]>

* lint

Signed-off-by: Jared Wilber <[email protected]>

* simplify context manager in tests

Signed-off-by: Jared Wilber <[email protected]>

* remove unused import in test

Signed-off-by: Jared Wilber <[email protected]>

* Add env vars for test

Signed-off-by: Jared Wilber <[email protected]>

* mark tests gpu only

Signed-off-by: Jared Wilber <[email protected]>

* Apply isort and black reformatting

Signed-off-by: jwilber <[email protected]>

---------

Signed-off-by: Jared Wilber <[email protected]>
Signed-off-by: jwilber <[email protected]>
Co-authored-by: Jared Wilber <[email protected]>
Co-authored-by: jwilber <[email protected]>
Co-authored-by: Charlie Truong <[email protected]>
guyueh1 pushed a commit to guyueh1/NeMo that referenced this pull request Aug 25, 2025
* Add fix for evo2 generate/inference

Signed-off-by: Jared Wilber <[email protected]>

* Add Farhad's suggested refactor

Signed-off-by: Jared Wilber <[email protected]>

* lint

Signed-off-by: Jared Wilber <[email protected]>

* Remove unused and truism code

Signed-off-by: Jared Wilber <[email protected]>

* add inference_context conditional check to use new ops

Signed-off-by: Jared Wilber <[email protected]>

* add hyena operator tests

Signed-off-by: Jared Wilber <[email protected]>

* lint

Signed-off-by: Jared Wilber <[email protected]>

* remove unused code

Signed-off-by: Jared Wilber <[email protected]>

* add doc strings for flake8

Signed-off-by: Jared Wilber <[email protected]>

* Apply isort and black reformatting

Signed-off-by: jwilber <[email protected]>

* remove unnecessary assignments

Signed-off-by: Jared Wilber <[email protected]>

* invoke original forward for non-inference calls

Signed-off-by: Jared Wilber <[email protected]>

* Apply isort and black reformatting

Signed-off-by: jwilber <[email protected]>

* Fix reset issue

Signed-off-by: Jared Wilber <[email protected]>

* Apply isort and black reformatting

Signed-off-by: jwilber <[email protected]>

* add docstring

Signed-off-by: Jared Wilber <[email protected]>

* Apply isort and black reformatting

Signed-off-by: jwilber <[email protected]>

* Remove test

Signed-off-by: Jared Wilber <[email protected]>

* Add tests for hyena operator

Signed-off-by: Jared Wilber <[email protected]>

* Apply isort and black reformatting

Signed-off-by: jwilber <[email protected]>

* lint

Signed-off-by: Jared Wilber <[email protected]>

* simplify context manager in tests

Signed-off-by: Jared Wilber <[email protected]>

* remove unused import in test

Signed-off-by: Jared Wilber <[email protected]>

* Add env vars for test

Signed-off-by: Jared Wilber <[email protected]>

* mark tests gpu only

Signed-off-by: Jared Wilber <[email protected]>

* Apply isort and black reformatting

Signed-off-by: jwilber <[email protected]>

---------

Signed-off-by: Jared Wilber <[email protected]>
Signed-off-by: jwilber <[email protected]>
Co-authored-by: Jared Wilber <[email protected]>
Co-authored-by: jwilber <[email protected]>
Co-authored-by: Charlie Truong <[email protected]>
Signed-off-by: Guyue Huang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants