-
Notifications
You must be signed in to change notification settings - Fork 960
[Fix Bug] Enhance ProgressCallbackNew to initialize training bar with current step
#6415
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Summary of ChangesHello @YushunXiang, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request resolves a bug related to the training progress bar's initialization. It ensures that when training is resumed from a checkpoint, the progress bar accurately reflects the current training step from the outset, providing a more precise visual representation of the training's advancement. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request correctly addresses an issue with the training progress bar not reflecting the correct step when resuming from a checkpoint. The changes in swift/trainers/callback.py properly initialize the tqdm progress bar with the current global_step. The logic is sound. I have one minor suggestion to make the code more concise and Pythonic.
ProgressCallbackNew to initialize training bar with current step
|
Hello, thanks for your PR, Could you please provide a script that can reproduce the issue you mentioned |
|
Yeah, here are my scipt: I use swift sft. [
"--train_type",
"lora",
"--seed",
"42",
"--model",
"model/Qwen/Qwen2.5-VL-7B-Instruct",
"--torch_dtype",
"bfloat16",
"--model_kwargs",
"{\"min_pixels\": 3136, \"max_pixels\": 20704}",
"--dataset",
"dataset/OCL_data",
"--dataset_num_proc",
"40",
"--custom_register_path",
"src/ocl_vlm/template/qwen_ocl_template.py",
"src/ocl_vlm/dataset/preprocessor/ocl/chat/ocl_cot_preprocessor.py",
"--template",
"qwen2_5_vl_ocl",
"--output_dir",
"output/Qwen2.5-VL-7B-SFT-LoRA-CoT-1029",
"--per_device_train_batch_size",
"8",
"--learning_rate",
"3e-5",
"--max_grad_norm",
"0.5",
"--num_train_epochs",
"20",
"--gradient_accumulation_steps",
"1",
"--save_steps",
"3000",
"--save_total_limit",
"10",
"--logging_steps",
"1",
"--warmup_ratio",
"0.1",
"--dataloader_num_workers",
"16",
"--average_tokens_across_devices",
"True",
"--freeze_vit",
"False",
"--freeze_llm",
"False",
"--freeze_aligner",
"False",
"--target_modules",
"all-linear",
"--lora_rank",
"8",
"--lora_alpha",
"32",
"--attn_impl",
"flash_attn",
"--report_to",
"wandb",
"--resume_from_checkpoint",
"output/Qwen2.5-VL-7B-SFT-LoRA-CoT-1029/checkpoint-18000",
"--no_add_version"
] |
PR type
Bug information
I found that if I pass the
resume_from_checkpointparameter, tqdm function in theswift/trainers/callback.pycalculate the progress incorrectly.PR information
This pull request makes a minor improvement to the training progress bar initialization in the
ProgressCallbackNewclass. The main change ensures that the progress bar accurately reflects the current training step when resuming from a checkpoint or a non-zero step.ProgressCallbackNew.on_train_beginnow starts at the correct step (state.global_stepor 0) instead of always starting at zero. This ensures accurate progress reporting when training is resumed from a checkpoint. (swift/trainers/callback.py)