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

Fix duplicate compilation #622

Merged
merged 1 commit into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
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: 5 additions & 3 deletions src/onediff/infer_compiler/utils/args_tree_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,17 @@ def output_fn(value):

def wrapper(self: "DeployableModule", *args, **kwargs):
mapped_args, mapped_kwargs, input_count = process_input(*args, **kwargs)
if self._deployable_module_use_graph:
count = self._deployable_module_input_count
if (
self._deployable_module_use_graph
and self._deployable_module_dpl_graph is not None
):
count = len(self._deployable_module_dpl_graph._input_op_names)
if count != input_count:
logger.warning(
f"Module {type(self._deployable_module_model.oneflow_module)} input tensor count changed from {count} to {input_count}, will compile again."
)
self._deployable_module_dpl_graph = None
self._load_graph_first_run = True
self._deployable_module_input_count = input_count
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里 self._deployable_module_input_count 不需要更新了吗

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是的, 不需要 self._deployable_module_input_count 参数了用 len(self._deployable_module_dpl_graph._input_op_names) 代替了


output = func(self, *mapped_args, **mapped_kwargs)
return process_output(output)
Expand Down
1 change: 0 additions & 1 deletion src/onediff/infer_compiler/with_oneflow_compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ def __init__(
self._deployable_module_dpl_graph = None
self._is_raw_deployable_module = True
self._load_graph_first_run = True
self._deployable_module_input_count = None

@classmethod
def from_existing(cls, existing_module, use_graph=None, dynamic=None, options=None):
Expand Down
Loading