@@ -788,7 +788,6 @@ def _init_from_defaults(self):
788788 """Initialize all config options from class defaults."""
789789 for key , value in self ._DEFAULTS .items ():
790790 setattr (self , key , value )
791- self .spec_method = None # Will be set during validation
792791
793792 def _apply_user_args (self , args : Dict [str , Any ]):
794793 """Apply user-provided arguments."""
@@ -822,14 +821,14 @@ def _convert_and_validate(self):
822821 """
823822 Convert string configs to enums and validate all parameters.
824823 """
825- # Parse spec_method from string to enum using the new from_string method
824+ # Convert method from string to SpecMethod enum
826825 if self .method is not None :
827826 from fastdeploy .spec_decode import SpecMethod
828827
829- self .spec_method = SpecMethod .from_string (self .method )
828+ self .method = SpecMethod .from_string (self .method )
830829
831830 # Set method-specific computed values
832- if self .spec_method == SpecMethod .MTP :
831+ if self .method == SpecMethod .MTP :
833832 self .num_extra_cache_layer = 1
834833
835834 # Run validation (includes dependency validation)
@@ -886,15 +885,15 @@ def check_legality_parameters(
886885 m .value for m in SpecMethod
887886 ], f"speculative method only support { [m .value for m in SpecMethod ]} now, but get { self .method } ."
888887
889- if self .spec_method != SpecMethod .NAIVE :
888+ if self .method != SpecMethod .NAIVE :
890889 assert (
891890 self .num_speculative_tokens >= 1 and self .num_speculative_tokens <= 5
892891 ), f"num_speculative_tokens only support in range[1, 5], but get { self .num_speculative_tokens } ."
893892 assert (
894893 self .num_model_steps >= 1 and self .num_model_steps <= 5
895894 ), f"num_model_steps only support in range[1, 5], but get { self .num_model_steps } ."
896895
897- if self .spec_method == SpecMethod .MTP :
896+ if self .method == SpecMethod .MTP :
898897 if self .num_speculative_tokens < self .num_model_steps :
899898 logger .warning (
900899 f"Get num_model_steps > num_speculative_tokens. Reset num_speculative_tokens to { self .num_model_steps } "
@@ -968,8 +967,8 @@ def _validate_dependencies(self) -> None:
968967 ],
969968 }
970969
971- if self .spec_method in constraints :
972- method_constraints = constraints [self .spec_method ]
970+ if self .method in constraints :
971+ method_constraints = constraints [self .method ]
973972 for constraint in method_constraints :
974973 if not constraint ["check" ]():
975974 if constraint ["auto_fix" ] is not None :
@@ -1820,7 +1819,7 @@ def __init__(
18201819
18211820 # Initialize cuda graph capture list
18221821 max_capture_shape = self .scheduler_config .max_num_seqs
1823- if self .speculative_config is not None and self .speculative_config .spec_method in [
1822+ if self .speculative_config is not None and self .speculative_config .method in [
18241823 SpecMethod .MTP ,
18251824 SpecMethod .SUFFIX ,
18261825 ]:
@@ -2054,7 +2053,7 @@ def postprocess(self):
20542053 )
20552054
20562055 # adjust speculative config
2057- if self .speculative_config is not None and self .speculative_config .spec_method == SpecMethod .MTP :
2056+ if self .speculative_config is not None and self .speculative_config .method == SpecMethod .MTP :
20582057 if self .scheduler_config .splitwise_role == "prefill" :
20592058 self .speculative_config .num_speculative_tokens = 1
20602059 self .speculative_config .num_model_steps = 1
0 commit comments