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

add param in profile_mlp.py to enable graph mode or not #106

Merged
merged 2 commits into from
Jul 25, 2024
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
10 changes: 9 additions & 1 deletion script/profile_mlp.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def main(
intermediate_size=512,
dtype="float16",
_profile=False,
enable_graph_mode=False,
):

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

# Compile model
compiler_conf = CompilerConfig(use_to=True, dtype=dtype)
compiler_conf = CompilerConfig(use_to=enable_graph_mode, dtype=dtype)
model = intel_npu_acceleration_library.compile(mlp, compiler_conf)
if _profile:
model.profile = True
Expand Down Expand Up @@ -106,6 +107,12 @@ def define_and_parse_args():
default=False,
help="Enable the profiling (default: False)",
)
parser.add_argument(
"--enable_graph_mode",
action="store_true",
default=False,
help="Enable graph mode for MLP, otherwise use eager mode (default: False)",
)

return parser.parse_args()

Expand All @@ -123,4 +130,5 @@ def define_and_parse_args():
intermediate_size=args.intermediate_size,
dtype=args.dtype,
_profile=args.profile,
enable_graph_mode=args.enable_graph_mode,
)
Loading