Train GOT-OCR2.0
mainThis codebase supports post-training (stage-2/stage-3) using DeepSpeed.
Important Requirements:
- The
<image>token in theconversations->human->valuefield is mandatory in your training samples. - You must update data information in
GOT/utils/constant.pyand thedata_nameinGOT/data/conversation_dataset_qwen.py(line 37) to match your dataset.
Note: For stage-1 training, use the Vary-tiny-600k repository instead.
deepspeed /GOT-OCR-2.0-master/GOT/train/train_GOT.py \
--deepspeed /GOT-OCR-2.0-master/zero_config/zero2.json --model_name_or_path /GOT_weights/ \
--use_im_start_end True \
--bf16 True \
--gradient_accumulation_steps 2 \
--evaluation_strategy "no" \
--save_strategy "steps" \
--save_steps 200 \
--save_total_limit 1 \
--weight_decay 0. \
--warmup_ratio 0.001 \
--lr_scheduler_type "cosine" \
--logging_steps 1 \
--tf32 True \
--model_max_length 8192 \
--gradient_checkpointing True \
--dataloader_num_workers 8 \
--report_to none \
--per_device_train_batch_size 2 \
--num_train_epochs 1 \
--learning_rate 2e-5 \
--datasets pdf-ocr+scence \
--output_dir /your/output/path