@@ -90,34 +90,13 @@ def preprocess(image: PIL.Image.Image, ht=512, wt=512):
9090def try_enable_npu_turbo (device , core ):
9191 try :
9292 import platform
93- if "windows" in platform .system ().lower ():
94- if "NPU" in device and "3720" not in core .get_property ('NPU' , 'DEVICE_ARCHITECTURE' ):
95- try :
96- core .set_property (properties = {'NPU_TURBO' : 'YES' },device_name = 'NPU' )
97- except :
98- print (f"Failed loading NPU_TURBO for device { device } . Skipping... " )
99- else :
100- print_npu_turbo_art ()
101- elif "linux" in platform .system ().lower ():
102- #TODO: Double check this logic. Do we need core.set_property() somewhere in here?
103- if os .path .isfile ('/sys/module/intel_vpu/parameters/test_mode' ):
104- with open ('/sys/module/intel_vpu/version' , 'r' ) as f :
105- version = f .readline ().split ()[0 ]
106- if tuple (map (int , version .split ('.' ))) < tuple (map (int , '1.9.0' .split ('.' ))):
107- print (f"The driver intel_vpu-1.9.0 (or later) needs to be loaded for NPU Turbo (currently { version } ). Skipping..." )
108- else :
109- with open ('/sys/module/intel_vpu/parameters/test_mode' , 'r' ) as tm_file :
110- test_mode = int (tm_file .readline ().split ()[0 ])
111- if test_mode == 512 :
112- print_npu_turbo_art ()
113- else :
114- print ("The driver >=intel_vpu-1.9.0 was must be loaded with "
115- "\" modprobe intel_vpu test_mode=512\" to enable NPU_TURBO "
116- f"(currently test_mode={ test_mode } ). Skipping..." )
93+ if "NPU" in device and "3720" not in core .get_property ('NPU' , 'DEVICE_ARCHITECTURE' ):
94+ try :
95+ core .set_property (properties = {'NPU_TURBO' : 'YES' },device_name = 'NPU' )
96+ except :
97+ print (f"Failed loading NPU_TURBO for device { device } . Skipping... " )
11798 else :
118- print (f"The driver >=intel_vpu-1.9.0 must be loaded with \" modprobe intel_vpu test_mode=512\" to enable NPU_TURBO. Skipping..." )
119- else :
120- print (f"This platform ({ platform .system ()} ) does not support NPU Turbo" )
99+ print_npu_turbo_art ()
121100 except Exception as e :
122101 print (f"try_enable_npu_turbo: Caught exception:\n { e } " )
123102
0 commit comments