@@ -18,7 +18,9 @@ def set_vllm_pipeline_stage(is_first_stage: bool, is_last_stage: bool):
1818 global _is_first_stage , _is_last_stage
1919 _is_first_stage = is_first_stage
2020 _is_last_stage = is_last_stage
21- logger .debug (f"Set vLLM pipeline stage: is_first_stage={ _is_first_stage } , is_last_stage={ _is_last_stage } " )
21+ logger .debug (
22+ f"Set vLLM pipeline stage: is_first_stage={ _is_first_stage } , is_last_stage={ _is_last_stage } "
23+ )
2224
2325
2426def apply_vllm_weight_loader_patch ():
@@ -55,22 +57,30 @@ def patched_load_weights(self, model: Any, model_config: Any):
5557 if "model.embed_tokens.weight" in error_msg and uninitialized_weights :
5658 if not _is_first_stage :
5759 # Expected behavior for non-first pipeline stages
58- logger .info ("Skipping embed_tokens.weight initialization check on non-first pipeline stage" )
60+ logger .info (
61+ "Skipping embed_tokens.weight initialization check on non-first pipeline stage"
62+ )
5963 else :
6064 # This is the first stage, embed_tokens should be initialized
61- logger .error ("embed_tokens.weight not initialized on first pipeline stage, this is an error" )
65+ logger .error (
66+ "embed_tokens.weight not initialized on first pipeline stage, this is an error"
67+ )
6268 raise
6369
6470 # Case 2: lm_head.weight not found
6571 elif "lm_head.weight" in error_msg and uninitialized_weights :
6672 if not _is_last_stage :
6773 # Expected behavior for non-last pipeline stages
68- logger .info ("Skipping lm_head.weight initialization check on non-last pipeline stage" )
74+ logger .info (
75+ "Skipping lm_head.weight initialization check on non-last pipeline stage"
76+ )
6977 else :
7078 # This is the last stage, lm_head should be initialized
71- logger .error ("lm_head.weight not initialized on last pipeline stage, this is an error" )
79+ logger .error (
80+ "lm_head.weight not initialized on last pipeline stage, this is an error"
81+ )
7282 raise
73-
83+
7484 # Case 3: Other errors
7585 else :
7686 # Different error, re-raise
0 commit comments