@@ -204,15 +204,19 @@ def __post_init__(self):
204204 if getattr (self .hf_config , "model_type" , None ) == "kimi_vl" :
205205 self .hf_config .text_config .topk_method = "greedy"
206206
207- # Ensure target_modules is a str or list[str]
208- if self .target_modules is None :
209- self .target_modules = "all-linear"
210- if not isinstance (self .target_modules , (str , list )):
211- raise TypeError (f"target_modules must be a string or a list of strings, but got { type (self .target_modules ).__name__ } " )
212- if isinstance (self .target_modules , list ):
213- for x in self .target_modules :
214- if not isinstance (x , str ):
215- raise TypeError (f"All elements in target_modules list must be strings, but found { type (x ).__name__ } " )
207+ # Ensure target_modules is a str or list[str] (only if not None)
208+ if self .target_modules is not None :
209+ if not isinstance (self .target_modules , (str | list )):
210+ raise TypeError (
211+ "target_modules must be a string or a list of strings, "
212+ f"but got { type (self .target_modules ).__name__ } "
213+ )
214+ if isinstance (self .target_modules , list ):
215+ for x in self .target_modules :
216+ if not isinstance (x , str ):
217+ raise TypeError (
218+ f"All elements in target_modules list must be strings, but found { type (x ).__name__ } "
219+ )
216220
217221 def get_processor (self ):
218222 return self .processor if self .processor is not None else self .tokenizer
0 commit comments