Skip to content

Fix pytorch related pytest failures#1377

Merged
calad0i merged 3 commits intofastmachinelearning:mainfrom
JanFSchulte:RNNFixes
Sep 6, 2025
Merged

Fix pytorch related pytest failures#1377
calad0i merged 3 commits intofastmachinelearning:mainfrom
JanFSchulte:RNNFixes

Conversation

@JanFSchulte
Copy link
Contributor

There currently are a couple of pytorch-related failures in the pytests.

The main one is a bug with recurrent layers where the weights and hidden weights need to be transposed to mach the keras convention that is used in our implementation. Since this is not strictly a channels-last conversion I have added this directly to the parser so that the channels-last conversion feature can still be used as before. This issue was masked before because of a bug in the converter that ignored the "off" setting. After I fixed this recently, this issue was revealed, but missed at the time.

I also increased the bit width in one of the einsum tests to avoid occasional failures because of limited precision. There is nothing wrong otherwise, so this seems like the best option.

Type of change

  • Bug fix (non-breaking change that fixes an issue)

Tests

Failing pytests pass now

Checklist

  • I have read the guidelines for contributing.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.
  • I have installed and run pre-commit on the files I edited or added.
  • I have added tests that prove my fix is effective or that my feature works.

@JanFSchulte
Copy link
Contributor Author

pre-commit.ci autofix

@JanFSchulte JanFSchulte added the please test Trigger testing by creating local PR branch label Sep 4, 2025
@JanFSchulte
Copy link
Contributor Author

@calad0i The remaining test failures come from the HGQ + DA tests and I am having some trouble replicating them locally. Can you have a look?

@calad0i calad0i added please test Trigger testing by creating local PR branch and removed please test Trigger testing by creating local PR branch labels Sep 5, 2025
@calad0i
Copy link
Contributor

calad0i commented Sep 5, 2025

Can you push an empty commit and rerun the tests?

@jmitrevs
Copy link
Contributor

jmitrevs commented Sep 5, 2025

I retried the HGQ + DA tests. Try to replicate locally with the same random seed. Otherwise, could there be version differences between the test environment and some libraries that would make the difference?

@JanFSchulte
Copy link
Contributor Author

It's certainly reproduced in the test environment here, see for example the oneAPI accelerator PR tests: https://gitlab.cern.ch/fastmachinelearning/hls4ml/-/jobs/60904849 So I guess it's just a matter of luck reproducing it online. I just didn't want to run all 386 tests offline to reproduce on failure and haven't found a seed yet that gives me a failure for a single test.

@bo3z bo3z added this to the v1.2.0 milestone Sep 5, 2025
@JanFSchulte
Copy link
Contributor Author

Guess it passed now. A little weird.

@calad0i calad0i merged commit 8a91e91 into fastmachinelearning:main Sep 6, 2025
10 checks passed
@JanFSchulte JanFSchulte mentioned this pull request Sep 8, 2025
2 tasks
morunner pushed a commit to morunner/hls4ml that referenced this pull request Nov 6, 2025
* fix pytorch related pytest failures

* remove printouts

* [pre-commit.ci] auto fixes from pre-commit hooks

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

please test Trigger testing by creating local PR branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants