Skip to content

Commit

Permalink
improve logging
Browse files Browse the repository at this point in the history
  • Loading branch information
JingyaHuang committed Aug 10, 2023
1 parent 43c34dc commit 802ae7e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 1 addition & 2 deletions optimum/exporters/neuron/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,7 @@ def main_export(
)

logger.info(
f"The {NEURON_COMPILER} export succeeded and the exported model was saved at: "
f"{output.parent.as_posix()}"
f"The {NEURON_COMPILER} export succeeded and the exported model was saved at: " f"{output.as_posix()}"
)
except ShapeError as e:
raise e
Expand Down
5 changes: 5 additions & 0 deletions optimum/exporters/neuron/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"""Neuron compiled model check and export functions."""

import copy
import time
from collections import OrderedDict
from pathlib import Path
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union
Expand Down Expand Up @@ -289,6 +290,7 @@ def export_models(

failed_models = []
for i, model_name in enumerate(models_and_neuron_configs.keys()):
logger.info(f"***** Compiling {model_name} *****")
submodel, sub_neuron_config = models_and_neuron_configs[model_name]
output_file_name = (
output_file_names[model_name] if output_file_names is not None else Path(model_name + ".neuron")
Expand All @@ -298,12 +300,15 @@ def export_models(
output_path.parent.mkdir(parents=True, exist_ok=True)

try:
start_time = time.time()
neuron_inputs, neuron_outputs = export(
model=submodel,
config=sub_neuron_config,
output=output_path,
**compiler_kwargs,
)
compilation_time = time.time() - start_time
logger.info(f"[Compilation Time] {np.round(compilation_time, 2)} seconds.")
outputs.append((neuron_inputs, neuron_outputs))
# Add neuron specific configs to model components' original config
if hasattr(submodel, "config"):
Expand Down

0 comments on commit 802ae7e

Please sign in to comment.