Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move import to when needed to avoid circular dependency error (#19579) #35

Merged
merged 1 commit into from
May 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
from onnxruntime.capi import _pybind_state as C
from onnxruntime.tools.symbolic_shape_infer import SymbolicShapeInference
from onnxruntime.training.utils import ORTModelInputOutputSchemaType, PTable, onnx_dtype_to_pytorch_dtype
from onnxruntime.training.utils.hooks import configure_ort_compatible_zero_stage3

from . import _are_deterministic_algorithms_enabled, _io, _logger, _onnx_models, _utils
from ._fallback import (
Expand Down Expand Up @@ -144,6 +143,9 @@ def __init__(

self._zero_stage3_param_map = {}
if self._runtime_options.enable_zero_stage3_support:
# Move import to here to avoid circular dependency error
from onnxruntime.training.utils.hooks import configure_ort_compatible_zero_stage3 # type: ignore[import]

# Cannot toggle feature enabling/disabling after the first time enabled.

configure_ort_compatible_zero_stage3(debug=False, stats_output_dir="ort_output", stats_overwrite=True)
Expand Down
Loading