| 
					
				 | 
			
			
				@@ -1,4 +1,6 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import os 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import sys 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import numpy as np 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 __dir__ = os.path.dirname(os.path.abspath(__file__)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 sys.path.append(__dir__) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 from utils.oss_client import HangZhouOSSClient 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -27,7 +29,7 @@ def main(): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     init_model_path = "/app/output_model_dssm" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     client = HangZhouOSSClient("art-recommend") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    oss_object_name = self.config.get("runner.oss_object_name", "dyp/model.tar.gz") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    oss_object_name = "dyp/dssm.tar.gz" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     client.get_object_to_file(oss_object_name, "model.tar.gz") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     compress.uncompress_tar("model.tar.gz", init_model_path) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     assert os.path.exists(init_model_path) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -46,7 +48,7 @@ def main(): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     input_handle = predictor.get_input_handle(input_names[0]) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     # 设置输入 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    fake_input = np.random.randn(1, 157).astype("float32") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    fake_input = np.abs(np.random.randn(1, 157).astype("float32")) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     input_handle.reshape([1, 157]) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     input_handle.copy_from_cpu(fake_input) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -57,8 +59,8 @@ def main(): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     output_names = predictor.get_output_names() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     output_handle = predictor.get_output_handle(output_names[0]) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     output_data = output_handle.copy_to_cpu() # numpy.ndarray类型 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    print("Output data size is {}".format(output_data.size)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    print("Output data shape is {}".format(output_data.shape)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    print("Output data size is {}".format(output_data)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    print("Output data shape is {}".format(fake_input)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 if __name__ == "__main__": 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    main() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    main() 
			 |