This repository was archived by the owner on Apr 24, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ def main(
20
20
intermediate_size = 512 ,
21
21
dtype = "float16" ,
22
22
_profile = False ,
23
+ enable_graph_mode = False ,
23
24
):
24
25
25
26
conf = Phi3Config .from_pretrained ("microsoft/Phi-3-mini-4k-instruct" )
@@ -44,7 +45,7 @@ def main(
44
45
raise RuntimeError (f"Invalid dtype: { dtype } " )
45
46
46
47
# Compile model
47
- compiler_conf = CompilerConfig (use_to = True , dtype = dtype )
48
+ compiler_conf = CompilerConfig (use_to = enable_graph_mode , dtype = dtype )
48
49
model = intel_npu_acceleration_library .compile (mlp , compiler_conf )
49
50
if _profile :
50
51
model .profile = True
@@ -106,6 +107,12 @@ def define_and_parse_args():
106
107
default = False ,
107
108
help = "Enable the profiling (default: False)" ,
108
109
)
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
+ )
109
116
110
117
return parser .parse_args ()
111
118
@@ -123,4 +130,5 @@ def define_and_parse_args():
123
130
intermediate_size = args .intermediate_size ,
124
131
dtype = args .dtype ,
125
132
_profile = args .profile ,
133
+ enable_graph_mode = args .enable_graph_mode ,
126
134
)
You can’t perform that action at this time.
0 commit comments