Describe the bug
The Python API docs show optimize as importable directly from the top-level olive package:
from olive import optimize
However, this currently fails because optimize is not re-exported in olive/__init__.py.
The function itself exists and works when imported from the internal CLI API module:
from olive.cli.api import optimize
Looking at olive/__init__.py, many Python API functions are imported from olive.cli.api and included in __all__, but optimize appears to be missing from both places. This looks like a small accidental omission.
To Reproduce
from olive import optimize
This raises:
Traceback (most recent call last):
File "<input>", line 1, in <module>
ImportError: cannot import name 'optimize' from 'olive'
The following workaround works:
from olive.cli.api import optimize
Expected behavior
optimize should be available from the documented top-level Python API:
from olive import optimize
Olive config
Not applicable. This is an import/export issue and happens before running an Olive workflow.
Olive logs
Not applicable.
Other information
- OS: Ubuntu 24.04 LTS
- Olive version: olive-ai 0.13.0
- ONNXRuntime package and version: onnxruntime 1.27.0
- Transformers package version: transformers 5.12.1
Additional context
I ran into this while integrating Olive-based ONNX export into tlmtc: https://github.com/saschagobel/tlmtc
I would be happy to open a small PR adding optimize to the import block and __all__ in olive/__init__.py if this is considered a bug.
Describe the bug
The Python API docs show
optimizeas importable directly from the top-levelolivepackage:However, this currently fails because
optimizeis not re-exported inolive/__init__.py.The function itself exists and works when imported from the internal CLI API module:
Looking at
olive/__init__.py, many Python API functions are imported fromolive.cli.apiand included in__all__, butoptimizeappears to be missing from both places. This looks like a small accidental omission.To Reproduce
This raises:
The following workaround works:
Expected behavior
optimizeshould be available from the documented top-level Python API:Olive config
Not applicable. This is an import/export issue and happens before running an Olive workflow.
Olive logs
Not applicable.
Other information
Additional context
I ran into this while integrating Olive-based ONNX export into
tlmtc: https://github.com/saschagobel/tlmtcI would be happy to open a small PR adding
optimizeto the import block and__all__inolive/__init__.pyif this is considered a bug.