Skip to content
This repository was archived by the owner on Apr 24, 2025. It is now read-only.

Commit cd29e82

Browse files
committed
add param in profile_mlp.py to enable graph mode or not
1 parent 86e4e1e commit cd29e82

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

script/profile_mlp.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ def main(
2020
intermediate_size=512,
2121
dtype="float16",
2222
_profile=False,
23+
enable_graph_mode=False,
2324
):
2425

2526
conf = Phi3Config.from_pretrained("microsoft/Phi-3-mini-4k-instruct")
@@ -44,7 +45,7 @@ def main(
4445
raise RuntimeError(f"Invalid dtype: {dtype}")
4546

4647
# Compile model
47-
compiler_conf = CompilerConfig(use_to=True, dtype=dtype)
48+
compiler_conf = CompilerConfig(use_to=enable_graph_mode, dtype=dtype)
4849
model = intel_npu_acceleration_library.compile(mlp, compiler_conf)
4950
if _profile:
5051
model.profile = True
@@ -106,6 +107,12 @@ def define_and_parse_args():
106107
default=False,
107108
help="Enable the profiling (default: False)",
108109
)
110+
parser.add_argument(
111+
"--enable_graph_mode",
112+
action="store_true",
113+
default=False,
114+
help="Enable graph mode for MLP, otherwise use eager mode (default: False)",
115+
)
109116

110117
return parser.parse_args()
111118

@@ -123,4 +130,5 @@ def define_and_parse_args():
123130
intermediate_size=args.intermediate_size,
124131
dtype=args.dtype,
125132
_profile=args.profile,
133+
enable_graph_mode=args.enable_graph_mode,
126134
)

0 commit comments

Comments
 (0)