Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix po2 for float quant #1033

Merged
merged 24 commits into from
Oct 8, 2024
Merged

Fix po2 for float quant #1033

merged 24 commits into from
Oct 8, 2024

Conversation

Giuseppe5
Copy link
Collaborator

@Giuseppe5 Giuseppe5 commented Sep 25, 2024

Breaking change. Loading old quantized model requires setting a flag for numerical compatibility.
Depends on #1039

The new flow assume that restrict_init_impl (e.g., log2) is done before converting to parameters. After this PR, the op is done after.
This means that loading the model from an old checkpoint would cause log2 to be applied twice.
To avoid this, the a new config flag is created (maybe to extend to a ENV variable as well).
When the flag is set, the reverse op to restrict_init is used (e.g., po2) during checkpoint loading time

@Giuseppe5
Copy link
Collaborator Author

@nickfraser
I tried investigating the LLM test failure but:

  • locally, running the test on dev I get a different perplexity
  • Running the branch, I get the same perplexity I get locally on dev (but different than the expected one)

@Giuseppe5 Giuseppe5 added the next release PRs which should be merged for the next release label Oct 2, 2024
@Giuseppe5 Giuseppe5 force-pushed the float_po2 branch 2 times, most recently from 0eb2ec2 to 8fa0025 Compare October 7, 2024 08:50
@Giuseppe5 Giuseppe5 requested review from nickfraser and removed request for nickfraser October 7, 2024 08:54
Copy link
Collaborator

@nickfraser nickfraser left a comment

Choose a reason for hiding this comment

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

Let's chat about some bits. Otherwise, looks good.

src/brevitas/core/scaling/standalone.py Outdated Show resolved Hide resolved
@nickfraser
Copy link
Collaborator

Running the branch, I get the same perplexity I get locally on dev (but different than the expected one)

I'll confirm this on my end too.

The perplexity measurement is a loose guard to force us to do a sanity check like this - assuming I see the same behaviour as you, I'm happy for you to update the scores to make the test pass.

@nickfraser
Copy link
Collaborator

Local tests pass. Happy for you to merge when the minor fixes above are corrected.

@Giuseppe5 Giuseppe5 requested review from nickfraser and removed request for nickfraser October 8, 2024 14:27
@Giuseppe5 Giuseppe5 requested review from nickfraser and removed request for nickfraser October 8, 2024 19:54
@Giuseppe5 Giuseppe5 requested review from nickfraser and removed request for nickfraser October 8, 2024 19:57
@Giuseppe5 Giuseppe5 merged commit 33de963 into Xilinx:dev Oct 8, 2024
372 of 374 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
next release PRs which should be merged for the next release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants