Skip to content

Conversation

@enlupi
Copy link
Contributor

@enlupi enlupi commented Nov 19, 2025

Description

This PR introduces the possibility of directly parsing PQuantML layers into hls4ml, both using the PyTorch and Keras V3 frontend. It uses HGQ2 conventions and relies on the bit_exact optimization pass to ensure correct precision is enforced and bit exactness.

Type of change

  • New feature (non-breaking change which adds functionality)

Tests

Tests are present both for PyTorch and Keras V3 frontend: test_pquant_pytoch.py and test_pquant_keras.py.

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.

@enlupi enlupi marked this pull request as ready for review December 8, 2025 13:23
@JanFSchulte JanFSchulte added the please test Trigger testing by creating local PR branch label Dec 8, 2025
@JanFSchulte
Copy link
Contributor

What's the plan for installing PQuant together with hls4ml? In principle, we should have pquant-ml defined as an optional dependency in the pyproject.toml. I see that the tool is available via pypi (https://libraries.io/pypi/pquant-ml), but just doing pip install pquant-ml in an empty conda environment with python 3.11 doesn't work for me because of version conflicts that prevent tensorflow from being installed. So I'm not sure the version available via pypi is up to date.

I expect the pytests to fail currently because of this. We are preparing a dedicated testing container with keras 3 that should be able to be used for this going forward, but that would then need the proper installation instructions for pquant to work.

Also, would be nice to have the documentation update included in this PR ;)

@enlupi
Copy link
Contributor Author

enlupi commented Dec 9, 2025

What's the plan for installing PQuant together with hls4ml? In principle, we should have pquant-ml defined as an optional dependency in the pyproject.toml.

I have now included it.

doing pip install pquant-ml in an empty conda environment with python 3.11 doesn't work for me because of version conflicts that prevent tensorflow from being installed.

This is a known issue for the PQuantML team and they are trying to solve it. As far as I have understood, the problem is due to pip trying to install the wrong version of tensorflow, and the only solution at the moment is "manually" installing it with conda.

Also, would be nice to have the documentation update included in this PR ;)

Added :)

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.

2 participants