Skip to content

Incorrect "Missing output_path argument" when passing quantize_uint8 to tensorflowjs_converter #8589

@gregsadetsky

Description

@gregsadetsky

System information

  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow.js): no
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): macOS 15.6.1 (24G90)
  • Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device: n/a
  • TensorFlow.js installed from (npm or script link): pip
  • TensorFlow.js version (use command below): tensorflowjs 4.22.0
  • Browser version: n/a
  • Tensorflow.js Converter Version:
tensorflowjs 4.22.0 Dependency versions: keras 2.19.0 tensorflow 2.19.0 

Describe the current behavior

When running tensorflowjs_converter with the --quantize_uint8 flag, the CLI command incorrectly says that its missing an output_path. The error disappears if the quantize_uint8 flag is not passed. See below for repro.

Describe the expected behavior

That error should not appear, since in the --help documentation, it states that --quantize_uint8 can be passed with no other parameter:

 --quantize_uint8 [QUANTIZE_UINT8] Comma separated list of node names to apply 1-byte affine quantization. You can also use wildcard symbol (*) to apply quantization to multiple nodes (e.g., conv/*/weights). When the flag is provided without any nodes the default behavior will match all nodes. 

i.e. QUANTIZE_UINT8 is optional.

Standalone code to reproduce the issue

Running:

tensorflowjs_converter --input_format=keras --output_format=tfjs_layers_model --quantize_uint8 /path/to/model.h5 /path/to/output

I get the following error:

Traceback (most recent call last): File ".../venv/bin/tensorflowjs_converter", line 8, in <module> sys.exit(pip_main()) ^^^^^^^^^^ File ".../venv/lib/python3.12/site-packages/tensorflowjs/converters/converter.py", line 959, in pip_main main([' '.join(sys.argv[1:])]) File ".../venv/lib/python3.12/site-packages/tensorflowjs/converters/converter.py", line 963, in main convert(argv[0].split(' ')) File ".../venv/lib/python3.12/site-packages/tensorflowjs/converters/converter.py", line 897, in convert raise ValueError( ValueError: Missing output_path argument. For usage, use the --help flag. 

However, if I remove the --quantize_uint8 flag, this error does not appear and the model is correctly converted.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions