Skip to content

Commit e8abcde

Browse files
committed
Cleanup
1 parent 7f85d2b commit e8abcde

5 files changed

Lines changed: 14 additions & 474 deletions

File tree

.env.megatron

Lines changed: 0 additions & 32 deletions
This file was deleted.

examples/train/sft/run_sft_megatron_vlm.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ uv run --isolated --extra megatron \
5757
project_name=skyrl_sft \
5858
run_name=skyrl_sft_megatron_vlm \
5959
ckpt_path="$CKPT_DIR" \
60-
ckpt_interval=20 \
61-
hf_save_interval=40 \
62-
resume_from="$CKPT_DIR/global_step_20" \
60+
ckpt_interval=10 \
61+
hf_save_interval=20 \
62+
resume_from="" \
6363
"$@"

skyrl/backends/skyrl_train/workers/megatron/megatron_worker.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1329,7 +1329,8 @@ def init_model(self, model_path, num_training_steps: int = 1e9):
13291329
print_model_size(self.actor_module[0])
13301330

13311331
# create worker model
1332-
self.model = MegatronModelWrapper(config=self.cfg, actor_module=self.actor_module, is_vlm=self.is_vlm)
1332+
# Ref worker does not handle VLM inputs during SFT, so is_vlm stays False (the wrapper default).
1333+
self.model = MegatronModelWrapper(config=self.cfg, actor_module=self.actor_module)
13331334

13341335
def _set_pad_token_id(self, pad_token_id):
13351336
# this already gets set in the init_model method

skyrl/train/sft_trainer.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -711,8 +711,15 @@ def collate_sft_batch(examples: list, tokenizer) -> TrainingInputBatch:
711711

712712
# VLM image tensors travel as a TensorList (one variable-shape tensor per
713713
# sample). Mixed text+image batches are not supported; every sample in a VLM
714-
# batch is expected to carry images.
715-
batch_has_images = any("pixel_values" in ex for ex in examples)
714+
# batch must carry images. Check homogeneity up front so a mixed batch fails
715+
# here with a clear message rather than a KeyError deep in the pad loop.
716+
num_with_images = sum("pixel_values" in ex for ex in examples)
717+
if num_with_images not in (0, len(examples)):
718+
raise ValueError(
719+
f"Mixed text+image batches are not supported: {num_with_images}/{len(examples)} "
720+
"samples carry 'pixel_values'. Every sample in a VLM batch must carry images."
721+
)
722+
batch_has_images = num_with_images > 0
716723
pixel_values = []
717724
image_grid_thw = []
718725

0 commit comments

Comments
 (0)