Skip to content

Remove random data from model - #20

Open
christophe0606 wants to merge 1 commit into
Arm-Examples:mainfrom
christophe0606:example_model
Open

christophe0606 wants to merge 1 commit into
Arm-Examples:mainfrom
christophe0606:example_model

Conversation

@christophe0606

Copy link
Copy Markdown

With fixed weights and fixed quantization data it makes it possible to compare with data in the README to quickly check the flow is ok.

The model was using random initialization weights and the quantization data was random.

Model weights are now fixed with a fixed seed for the random initialization.

quantization samples now have fixed values and a list of samples can be used.

With fixed weights and fixed quantization data it makes it possible
to compare with data in the README to quickly check the flow is ok.
MatthiasHertelArm pushed a commit that referenced this pull request Sep 10, 2026
Ported from PR #20 by Christophe Favergeon. The calibration data was a
random tensor, so the output logits differed from one export to the next
and could not be compared with the README. get_calibration_inputs()
returns fixed samples; the exported program and the logits in the README
are now reproducible (8832 bytes, verified on the FVP).
@MatthiasHertelArm

Copy link
Copy Markdown
Contributor

Thanks. main has been restructured (three-step flow, model/export_model.py replaced by create_ai_layer.py, solution renamed to cmsis-executorch), so this PR cannot merge as is. The fixed seed was already there; I ported the calibration part: commit 3bf09cd ("Calibrate the quantizer with fixed samples") on main adds get_calibration_inputs() to model/model.py with your two fixed samples, calibrates over all samples under torch.no_grad() in create_ai_layer.py, and the README now shows the reproducible 8832-byte model and the same logits as in this PR. The RTE/ files are committed on main now. If the port covers what you needed, please close this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants