Skip to content

Commit

Permalink
lintrunner -a
Browse files Browse the repository at this point in the history
  • Loading branch information
tianleiwu committed Dec 10, 2024
1 parent 660e1e2 commit 0c5bf2a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
run: |
set -e -x
python -m pip install --user -r requirements-dev.txt
python -m pip install --user -r lintrunner
python -m pip install --user lintrunner
lintrunner init
- name: Run lintrunner on all files
run: |
Expand Down
11 changes: 7 additions & 4 deletions orttraining/orttraining/python/training/artifacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,13 @@ def build(self, *inputs_to_loss):
logging.info("Custom op library provided: %s", custom_op_library)
custom_op_library_path = pathlib.Path(custom_op_library)

with onnxblock.base(loaded_model, model_path), (
onnxblock.custom_op_library(custom_op_library_path)
if custom_op_library is not None
else contextlib.nullcontext()
with (
onnxblock.base(loaded_model, model_path),
(
onnxblock.custom_op_library(custom_op_library_path)
if custom_op_library is not None
else contextlib.nullcontext()
),
):
_ = training_block(*[output.name for output in loaded_model.graph.output])
training_model, eval_model = training_block.to_model_proto()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -867,8 +867,9 @@ def _get_exported_model(
assert model_info_for_export.export_mode is not None, "Please use a concrete instance of ExecutionManager"

try:
with torch.no_grad(), stage3_export_context(
enable_zero_stage3_support, stage3_param_handle, flattened_module
with (
torch.no_grad(),
stage3_export_context(enable_zero_stage3_support, stage3_param_handle, flattened_module),
):
required_export_kwargs = {
"input_names": model_info_for_export.onnx_graph_input_names, # did not contains parameters as its input yet
Expand Down

0 comments on commit 0c5bf2a

Please sign in to comment.