@@ -93,7 +93,7 @@ def decode_with_vllm(config: Config) -> None:
9393 "additional_config" : {
9494 "maxtext_config" : {
9595 "model_name" : config .model_name ,
96- "weight_dtype" : config .weight_dtype ,
96+ "weight_dtype" : config .weight_dtype . name ,
9797 "allow_split_physical_axes" : True ,
9898 "debug_sharding" : config .debug_sharding ,
9999 "prefuse_moe_weights" : config .prefuse_moe_weights ,
@@ -201,9 +201,7 @@ def decode_with_tunix(
201201 overrides = config .vllm_hf_overrides
202202 if isinstance (overrides , str ) and "MaxTextForCausalLM" in overrides :
203203 use_no_op_mappings = True
204- elif isinstance (overrides , dict ) and "MaxTextForCausalLM" in overrides .get (
205- "architectures" , []
206- ):
204+ elif isinstance (overrides , dict ) and "MaxTextForCausalLM" in overrides .get ("architectures" , []):
207205 use_no_op_mappings = True
208206
209207 tunix_model = TunixMaxTextAdapter (
@@ -238,19 +236,13 @@ def decode_with_tunix(
238236 )
239237
240238 # MaxText uses -1 to mean "disabled"; vLLM requires top_p in (0, 1].
241- top_p = (
242- config .decode_sampling_nucleus_p
243- if config .decode_sampling_nucleus_p > 0
244- else 1.0
245- )
246- top_k = (
247- config .decode_sampling_top_k if config .decode_sampling_top_k > 0 else - 1
248- )
239+ top_p = config .decode_sampling_nucleus_p if config .decode_sampling_nucleus_p > 0 else 1.0
240+ top_k = config .decode_sampling_top_k if config .decode_sampling_top_k > 0 else - 1
249241
250242 rollout_vllm_additional_config = {
251243 "maxtext_config" : {
252244 "model_name" : config .model_name ,
253- "weight_dtype" : config .weight_dtype ,
245+ "weight_dtype" : config .weight_dtype . name ,
254246 "allow_split_physical_axes" : True ,
255247 "debug_sharding" : config .debug_sharding ,
256248 "prefuse_moe_weights" : config .prefuse_moe_weights ,
@@ -280,17 +272,9 @@ def decode_with_tunix(
280272 rollout_vllm_hbm_utilization = config .hbm_utilization_vllm ,
281273 rollout_vllm_init_with_random_weights = True ,
282274 rollout_vllm_tpu_backend_type = "jax" ,
283- tensor_parallel_size = (
284- config .ici_tensor_parallelism
285- if config .ici_tensor_parallelism > 0
286- else 1
287- ),
275+ tensor_parallel_size = (config .ici_tensor_parallelism if config .ici_tensor_parallelism > 0 else 1 ),
288276 data_parallel_size = jax .device_count ()
289- // (
290- config .ici_tensor_parallelism
291- if config .ici_tensor_parallelism > 0
292- else 1
293- ),
277+ // (config .ici_tensor_parallelism if config .ici_tensor_parallelism > 0 else 1 ),
294278 rollout_vllm_additional_config = rollout_vllm_additional_config ,
295279 rollout_vllm_kwargs = {"hf_overrides" : config .vllm_hf_overrides },
296280 )
@@ -330,9 +314,7 @@ def main(argv: Sequence[str]) -> None:
330314 if FLAGS .use_tunix :
331315 maxtext_model , mesh = model_creation_utils .from_pretrained (config )
332316 if config .lora .enable_lora :
333- maxtext_model = lora_utils .apply_lora_to_model (
334- maxtext_model , mesh , config
335- )
317+ maxtext_model = lora_utils .apply_lora_to_model (maxtext_model , mesh , config )
336318 if config .lora .lora_restore_path :
337319 lora_utils .restore_lora_from_path (maxtext_model , config )
338320 decode_with_tunix (config , model = maxtext_model , mesh = mesh )
0 commit comments