-
Notifications
You must be signed in to change notification settings - Fork 3k
Description
System Info
File "/root/code/verl/verl/workers/engine/base.py", line 122, in train_batch
outputs = self.forward_backward_batch(data, loss_function, forward_only=False)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/code/verl/verl/workers/engine/fsdp/transformer_impl.py", line 509, in forward_backward_batch
loss, meta_info = self.forward_step(micro_batch, loss_function=loss_function, forward_only=forward_only)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/code/verl/verl/workers/engine/fsdp/transformer_impl.py", line 945, in forward_step
model_inputs, output_args = self.prepare_model_inputs(micro_batch=micro_batch)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/code/verl/verl/workers/engine/fsdp/transformer_impl.py", line 729, in prepare_model_inputs
multi_modal_inputs = extract_multi_modal_inputs_tensordict(micro_batch)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/code/verl/verl/utils/model.py", line 748, in extract_multi_modal_inputs_tensordict
multi_modal_inputs[key] = torch.cat(tensors, dim=0)
^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: torch.cat(): expected a non-empty list of Tensors
Information
- The official example scripts
- My own modified scripts
Tasks
- An officially supported task in the
examplesfolder (such as GLUE/SQuAD, ...) - My own task or dataset (give details below)
Reproduction
File "/root/code/verl/verl/workers/engine/base.py", line 122, in train_batch
outputs = self.forward_backward_batch(data, loss_function, forward_only=False)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/code/verl/verl/workers/engine/fsdp/transformer_impl.py", line 509, in forward_backward_batch
loss, meta_info = self.forward_step(micro_batch, loss_function=loss_function, forward_only=forward_only)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/code/verl/verl/workers/engine/fsdp/transformer_impl.py", line 945, in forward_step
model_inputs, output_args = self.prepare_model_inputs(micro_batch=micro_batch)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/code/verl/verl/workers/engine/fsdp/transformer_impl.py", line 729, in prepare_model_inputs
multi_modal_inputs = extract_multi_modal_inputs_tensordict(micro_batch)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/code/verl/verl/utils/model.py", line 748, in extract_multi_modal_inputs_tensordict
multi_modal_inputs[key] = torch.cat(tensors, dim=0)
^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: torch.cat(): expected a non-empty list of Tensors
Expected behavior
During the SFT training of multi-modal processes, when a micro_batch contains only text data and no multi-modal inputs, a torch.cat error may occur. To address this, you can modify the extract_multi_modal_inputs_tensordict function in verl/utils/model.py so that it skips the operation if the tensors are empty.