From 6bd67a72fecf9e3b6826218a430a8abf2e6f911e Mon Sep 17 00:00:00 2001 From: LiuRicky <44423567+LiuRicky@users.noreply.github.com> Date: Tue, 18 Feb 2025 10:54:26 +0800 Subject: [PATCH 1/3] Support qwen2.5-VL in sft.py --- src/r1-v/src/open_r1/sft.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/r1-v/src/open_r1/sft.py b/src/r1-v/src/open_r1/sft.py index 41011e4e..5150e9cb 100644 --- a/src/r1-v/src/open_r1/sft.py +++ b/src/r1-v/src/open_r1/sft.py @@ -243,10 +243,17 @@ def main(script_args, training_args, model_args): quantization_config=quantization_config, ) # training_args.model_init_kwargs = model_kwargs - from transformers import Qwen2VLForConditionalGeneration - model = Qwen2VLForConditionalGeneration.from_pretrained( - model_args.model_name_or_path, **model_kwargs - ) + from transformers import Qwen2VLForConditionalGeneration, Qwen2_5_VLForConditionalGeneration + if "Qwen2-VL" in model_args.model_name_or_path: + model = Qwen2VLForConditionalGeneration.from_pretrained( + model_args.model_name_or_path, **model_kwargs + ) + elif "Qwen2.5-VL" in model_args.model_name_or_path: + model = Qwen2_5_VLForConditionalGeneration.from_pretrained( + model_args.model_name_or_path, **model_kwargs + ) + else: + assert False, f"Model {model_args.model_name_or_path} not supported" ############################ # Initialize the SFT Trainer ############################ From 166cbeb04c92f05db811059180de4ba2c5958f73 Mon Sep 17 00:00:00 2001 From: LiuRicky <44423567+LiuRicky@users.noreply.github.com> Date: Thu, 20 Feb 2025 14:11:08 +0800 Subject: [PATCH 2/3] update transformers for solving deepspeed qwen2.5vl prob --- setup.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/setup.sh b/setup.sh index adcde953..366ccf70 100644 --- a/setup.sh +++ b/setup.sh @@ -10,6 +10,3 @@ pip install flash-attn --no-build-isolation # vLLM support pip install vllm==0.7.2 - -# fix transformers version -pip install git+https://github.com/huggingface/transformers.git@336dc69d63d56f232a183a3e7f52790429b871ef \ No newline at end of file From 953eb76c9424a84ab66b1678e6f4291375fb16f6 Mon Sep 17 00:00:00 2001 From: LiuRicky <44423567+LiuRicky@users.noreply.github.com> Date: Thu, 20 Feb 2025 14:36:50 +0800 Subject: [PATCH 3/3] solve ds problem shown in Problem shown in https://github.com/huggingface/transformers/commit/8ee50537fe7613b87881cd043a85971c85e99519 --- src/r1-v/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/r1-v/setup.py b/src/r1-v/setup.py index a847d9eb..6207002f 100644 --- a/src/r1-v/setup.py +++ b/src/r1-v/setup.py @@ -61,7 +61,7 @@ "safetensors>=0.3.3", "sentencepiece>=0.1.99", "torch>=2.5.1", - "transformers @ git+https://github.com/huggingface/transformers.git@336dc69d63d56f232a183a3e7f52790429b871ef", + "transformers @ git+https://github.com/huggingface/transformers.git@main", "trl==0.14.0", "vllm==0.6.6.post1", "wandb>=0.19.1",