Skip to content

optimum-cli print the help of subcommands#940

Merged
michaelbenayoun merged 2 commits into
huggingface:mainfrom
michaelbenayoun:cli_print_help
Apr 3, 2023
Merged

optimum-cli print the help of subcommands#940
michaelbenayoun merged 2 commits into
huggingface:mainfrom
michaelbenayoun:cli_print_help

Conversation

@michaelbenayoun
Copy link
Copy Markdown
Member

@michaelbenayoun michaelbenayoun commented Mar 31, 2023

What does this PR do?

The Optimum CLI was not printing the proper help message for subcommands.

Example command:

optimum-cli export

Before #928

Before adding the register mechanism to the CLI, the above command would give:

usage: optimum-cli <command> [<args>]

positional arguments:
  {export,env,onnxruntime}
                        optimum-cli command helpers
    export              Export PyTorch and TensorFlow models to several format (currently supported: onnx).
    env                 Get information about the environment used.
    onnxruntime         ONNX Runtime optimize and quantize utilities.

options:
  -h, --help            show this help message and exit

After #928

Now, after adding the register mechanism, it gives:

Traceback (most recent call last):
  File "/home/michael/micromamba/envs/optimum/bin/optimum-cli", line 8, in <module>
    sys.exit(main())
  File "/home/michael/projects/optimum/optimum/commands/optimum_cli.py", line 167, in main
    service.run()
  File "/home/michael/projects/optimum/optimum/commands/base.py", line 131, in run
    raise NotImplementedError()
NotImplementedError

With this PR

With this PR, it gives:

usage: optimum-cli export [-h] {onnx,tflite} ...

positional arguments:
  {onnx,tflite}
    onnx         Export PyTorch and TensorFlow to ONNX.
    tflite       Export TensorFlow to TensorFlow Lite.

options:
  -h, --help     show this help message and exit

@michaelbenayoun michaelbenayoun requested a review from fxmarty March 31, 2023 10:12
@HuggingFaceDocBuilderDev
Copy link
Copy Markdown

HuggingFaceDocBuilderDev commented Mar 31, 2023

The documentation is not available anymore as the PR was closed or merged.

Copy link
Copy Markdown
Contributor

@fxmarty fxmarty left a comment

Choose a reason for hiding this comment

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

Awesome!

@michaelbenayoun michaelbenayoun merged commit 1554921 into huggingface:main Apr 3, 2023
@michaelbenayoun michaelbenayoun deleted the cli_print_help branch April 3, 2023 09:18
@regisss regisss mentioned this pull request May 17, 2023
3 tasks
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.

3 participants