Skip to content
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
8 changes: 8 additions & 0 deletions serving/core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
import json


# key: model_name
# value: parsed configs/model/<model_name>.json dict
_config_cache = {}


# Formatting string for a trace file's per-layer row. Kept in this
# module because trace writers live across the codebase and import it
# as the canonical row template.
Expand Down Expand Up @@ -56,6 +61,8 @@ def formatter(layername, comp_time, input_loc, input_size, weight_loc, weight_si


def get_config(model_name):
if model_name in _config_cache:
return _config_cache[model_name]
base_dir = os.path.dirname(os.path.abspath(__file__))
serving_dir = os.path.dirname(base_dir)
repo_root = os.path.dirname(serving_dir)
Expand All @@ -79,6 +86,7 @@ def get_config(model_name):
f"{', '.join(candidate_paths)}. Please add the corresponding config file."
)

_config_cache[model_name] = config
return config


Expand Down
Loading