finetune_textmonkey_dcu.sh 1.51 KB
Newer Older
wanglch's avatar
wanglch committed
1
2
3
4
5
#!/bin/bash
export CUDA_DEVICE_MAX_CONNECTIONS=1

DIR=`pwd`

wanglch's avatar
wanglch committed
6
HIP_VISIBLE_DEVICES=2,3
wanglch's avatar
wanglch committed
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23


GPUS_PER_NODE=2
NNODES=1
NODE_RANK=0
MASTER_ADDR=localhost
MASTER_PORT=29519

# ATTENTION: specify the path to your training data, which should be a json file consisting of a list of conversations.
# See the section for finetuning in README for more information.

DISTRIBUTED_ARGS="--nproc_per_node $GPUS_PER_NODE \
    --nnodes $NNODES \
    --node_rank $NODE_RANK \
    --master_addr $MASTER_ADDR \
    --master_port $MASTER_PORT"

wanglch's avatar
wanglch committed
24
25
26
torchrun $DISTRIBUTED_ARGS ./finetune_multitask_dialouge_doc.py \
    --model_name_or_path ./TextMonkey_base \
    --data_path ./data/data.json \
wanglch's avatar
wanglch committed
27
28
29
    --fp16 True \
    --fix_vit True \
    --fix_llm True \
wanglch's avatar
wanglch committed
30
    --output_dir ../TextMonkey/Train_multi_dcu \
wanglch's avatar
wanglch committed
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
    --num_train_epochs 2 \
    --per_device_train_batch_size 1 \
    --per_device_eval_batch_size 1 \
    --gradient_accumulation_steps 8 \
    --evaluation_strategy "no" \
    --save_strategy "steps" \
    --save_steps 1000 \
    --save_total_limit 10 \
    --learning_rate 1e-5 \
    --weight_decay 0.1 \
    --adam_beta2 0.95 \
    --warmup_ratio 0.02 \
    --lr_scheduler_type "cosine" \
    --logging_steps 1 \
    --report_to "none" \
    --model_max_length 2048 \
    --gradient_checkpointing \
    --lazy_preprocess True \
wanglch's avatar
wanglch committed
49
    --deepspeed finetune/ds_config_zero2.json \
wanglch's avatar
wanglch committed
50
51
52
53
54
55
56
57
58
59
60
61
    --image_size 896 \
    --image_width 896 \
    --image_height 896 \
    --add_window true \
    --use_global true \
    --resampler true  \
    --use_lora True \
    --remain 512