fix(colgrep): persist FP32 override so settings --fp32 forces full precision (#130)#140
Merged
Merged
Conversation
…precision (#130) `colgrep settings --fp32` called `clear_fp32()`, which drops the persisted field. On non-CUDA builds a missing value resolves to INT8, so `--fp32` was a no-op there: it printed success but the index/search path still selected `model_int8.onnx`. - `--fp32` now persists `Some(true)` via `set_fp32(true)` so `use_fp32()` resolves to true on every build. - Add `--default-precision` to explicitly reset to the build default (FP32 on CUDA, INT8 otherwise) — this is what `clear_fp32()` now backs, matching the existing reset-to-default pattern (e.g. pool-factor 0). - Status output shows the effective precision and whether it is an explicit override or the build default (no longer hard-codes "(default)"). - Add regression + serialization round-trip tests; update README and help. Closes #130
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #130.
colgrep settings --fp32was a no-op on non-CUDA builds: it printed success but the index/search path kept selectingmodel_int8.onnx.Root cause: the
--fp32branch calledconfig.clear_fp32()(sets the field toNone).Config::use_fp32()resolves a missing value per build:So on CoreML/CPU builds, clearing →
None→use_fp32() == false→ INT8. Clearing is not equivalent to forcing FP32.Changes
--fp32now persistsSome(true)(set_fp32(true)) souse_fp32()returnstrueon every build → forcesmodel.onnx.--default-precisionflag explicitly resets to the build default (FP32 on CUDA, INT8 otherwise). This is whatclear_fp32()now backs, mirroring the existing reset-to-default pattern (e.g.--pool-factor 0,--clear-ignore).fp32 (default), which was itself misleading).Tests
test_set_fp32_forces_fp32_regression_130— assertsset_fp32(true)⇒use_fp32() == true,set_fp32(false)⇒false,clear_fp32()⇒None(the regression).test_fp32_override_survives_serialization— JSON round-trip keepsSome(true)anduse_fp32().settings --fp32→precision: fp32, persists"fp32": truesettings --default-precision→precision: int8 (build default)on a non-CUDA buildsettings --fp32 --int8→ conflict errormake ci-quick(fmt + clippy-D warnings+ tests) passes via the pre-commit hook.Closes #130