1818 Qwen3VLForConditionalGeneration ,
1919)
2020
21- from flagscale .logger import logger
2221from flagscale .models .vla .registry import register_vlm
2322from flagscale .platforms .platform_manager import get_platform
2423
@@ -91,14 +90,9 @@ def prepare_input(
9190 if isinstance (instructions , str ):
9291 instructions = [instructions ]
9392
94- logger .info (f"[prepare_input] image_feature_keys={ image_feature_keys } " )
9593 batch_images : list [list [Image .Image ]] | None = None
9694 for key in image_feature_keys :
9795 imgs = batch [key ]
98- if isinstance (imgs , torch .Tensor ):
99- logger .info (
100- f"[prepare_input] key={ key } tensor shape={ imgs .shape } dtype={ imgs .dtype } "
101- )
10296 if isinstance (imgs , torch .Tensor ) and imgs .ndim == 3 :
10397 imgs = [imgs ]
10498 key_images = [_to_pil (img ) for img in imgs ]
@@ -111,9 +105,6 @@ def prepare_input(
111105 for idx , sample_images in enumerate (batch_images ):
112106 batch_images [idx ] = [img for img in sample_images if img is not None ]
113107
114- logger .info (
115- f"[prepare_input] batch_size={ len (batch_images )} images_per_sample={ [len (s ) for s in batch_images ]} pil_size={ batch_images [0 ][0 ].size if batch_images else None } "
116- )
117108 return batch_images , instructions
118109
119110 def build_qwenvl_inputs (
@@ -139,20 +130,13 @@ def _build_messages(
139130 return messages
140131
141132 def forward (self , batch : dict [str , torch .Tensor ], ** kwargs ) -> dict [str , torch .Tensor ]:
142- logger .info (
143- f"[VLM.forward] input keys={ list (batch .keys ())} "
144- + " " .join (f"{ k } ={ v .shape } " for k , v in batch .items () if isinstance (v , torch .Tensor ))
145- )
146133 with torch .autocast (get_platform ().amp_device_type (), dtype = torch .bfloat16 ):
147134 outputs = self .model (
148135 ** batch ,
149136 output_hidden_states = True ,
150137 return_dict = True ,
151138 ** kwargs ,
152139 )
153- logger .info (
154- f"[VLM.forward] hidden_states: { len (outputs .hidden_states )} layers, last={ outputs .hidden_states [- 1 ].shape } "
155- )
156140 # TODO: (yupu) We should output the original outputs, not just the hidden states.
157141 return {"hidden_states" : outputs .hidden_states }
158142
@@ -197,13 +181,6 @@ def build_qwenvl_inputs(
197181 text = texts , images = image_inputs , videos = video_inputs , padding = True , return_tensors = "pt"
198182 )
199183
200- logger .info (
201- "[Qwen25.build_qwenvl_inputs] "
202- + " " .join (
203- f"{ k } ={ v .shape } " for k , v in batch_input .items () if isinstance (v , torch .Tensor )
204- )
205- )
206-
207184 # Use current CUDA device instead of self.model.device, which returns
208185 # a DTensor device under FSDP2 and causes mixed Tensor/DTensor errors.
209186 return batch_input .to (get_platform ().device ())
@@ -245,13 +222,6 @@ def build_qwenvl_inputs(
245222 return_tensors = "pt" ,
246223 )
247224
248- logger .info (
249- "[Qwen3.build_qwenvl_inputs] "
250- + " " .join (
251- f"{ k } ={ v .shape } " for k , v in batch_inputs .items () if isinstance (v , torch .Tensor )
252- )
253- )
254-
255225 # Use current CUDA device instead of self.model.device, which returns
256226 # a DTensor device under FSDP2 and causes mixed Tensor/DTensor errors.
257227 return batch_inputs .to (get_platform ().device ())
0 commit comments