You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add --precision fp16 to optimize, build, and export commands
Add FP16 precision conversion support across all model pipeline commands:
- Create optim/fp16.py with convert_to_fp16() utility (wraps ORT float16)
- optimize: --precision fp16 with --fp16-keep-io-types and --fp16-op-block-list
- build: --precision fp16 stage between optimize and quantize
- export: --precision fp16 as post-export conversion
- Add shared precision_option() CLI decorator in utils/cli.py
Design: FP16 is a precision transformation (not a graph optimization), so it
lives as a command-layer utility rather than an optimizer pipe. All three
commands share the same convert_to_fp16() function.
Fixes#867
@cli_utils.precision_option(optional_message="Applies FP16 conversion after graph optimization.")
184
+
@click.option(
185
+
"--fp16-keep-io-types/--no-fp16-keep-io-types",
186
+
"fp16_keep_io_types",
187
+
default=True,
188
+
show_default=True,
189
+
help="Keep model I/O as FP32 when --precision fp16 (insert Cast at boundary)",
190
+
)
191
+
@click.option(
192
+
"--fp16-op-block-list",
193
+
"fp16_op_block_list",
194
+
type=str,
195
+
default=None,
196
+
help="Comma-separated list of op types to keep in FP32 (e.g., LayerNorm,Softmax)",
197
+
)
183
198
@cli_utils.verbosity_options()
184
199
@capability_options
185
200
@click.pass_context# type: ignore[arg-type] # capability_options widens the signature; click stubs want positional-only ctx but we keep it keyword-callable for back-compat
0 commit comments