@@ -701,20 +701,32 @@ def get_moe_configs(
701
701
block_shape = [block_n , block_k ] if block_n and block_k else None
702
702
json_file_name = get_config_file_name (E , N , dtype , block_shape )
703
703
704
- config_file_path = os .path .join (
704
+ config_file_paths = []
705
+
706
+ # note that we prioritize user defined config
707
+ user_defined_config_folder = envs .VLLM_TUNED_CONFIG_FOLDER
708
+ if user_defined_config_folder is not None :
709
+ user_defined_config_file_path = os .path .join (
710
+ user_defined_config_folder , json_file_name )
711
+ config_file_paths .append (user_defined_config_file_path )
712
+
713
+ default_config_file_path = os .path .join (
705
714
os .path .dirname (os .path .realpath (__file__ )), "configs" , json_file_name )
706
- if os .path .exists (config_file_path ):
707
- with open (config_file_path ) as f :
708
- logger .info ("Using configuration from %s for MoE layer." ,
709
- config_file_path )
710
- # If a configuration has been found, return it
711
- return {int (key ): val for key , val in json .load (f ).items ()}
715
+ config_file_paths .append (default_config_file_path )
716
+
717
+ for config_file_path in config_file_paths :
718
+ if os .path .exists (config_file_path ):
719
+ with open (config_file_path ) as f :
720
+ logger .info ("Using configuration from %s for MoE layer." ,
721
+ config_file_path )
722
+ # If a configuration has been found, return it
723
+ return {int (key ): val for key , val in json .load (f ).items ()}
712
724
713
725
# If no optimized configuration is available, we will use the default
714
726
# configuration
715
727
logger .warning (
716
728
("Using default MoE config. Performance might be sub-optimal! "
717
- "Config file not found at %s" ), config_file_path )
729
+ "Config file not found at %s" ), config_file_paths )
718
730
return None
719
731
720
732
0 commit comments