Wangpeng An
commited on
Upload finetune_all_stage3_next.sh with huggingface_hub
Browse files- finetune_all_stage3_next.sh +94 -0
finetune_all_stage3_next.sh
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
# Pretrain a multimodal model.
|
| 4 |
+
export OMP_NUM_THREADS=8
|
| 5 |
+
export NCCL_IB_DISABLE=0
|
| 6 |
+
export NCCL_IB_GID_INDEX=3
|
| 7 |
+
export NCCL_SOCKET_IFNAME=eth0
|
| 8 |
+
export NCCL_DEBUG=INFO
|
| 9 |
+
export NCCL_IB_SL=1
|
| 10 |
+
export CUDA_DEVICE_MAX_CONNECTIONS=1
|
| 11 |
+
export NCCL_BLOCKING_WAIT=1
|
| 12 |
+
export NCCL_ASYNC_ERROR_HANDLING=1
|
| 13 |
+
export NCCL_TIMEOUT=500
|
| 14 |
+
export TORCH_DISTRIBUTED_DEBUG=DETAIL
|
| 15 |
+
export NCCL_SOCKET_FAMILY=AF_INET6
|
| 16 |
+
export NCCL_NET_PLUGIN=libnccl-net-gcp-fastrak.so
|
| 17 |
+
|
| 18 |
+
DATETIME=`date +'%y-%m-%d-%H-%M-%S'`
|
| 19 |
+
|
| 20 |
+
# Setting for multi nodes training.
|
| 21 |
+
ports=(`echo $METIS_WORKER_0_PORT | tr ',' ' '`)
|
| 22 |
+
port=${ports[0]}
|
| 23 |
+
|
| 24 |
+
echo "total workers: ${ARNOLD_WORKER_NUM}"
|
| 25 |
+
echo "cur worker id: ${ARNOLD_ID}"
|
| 26 |
+
echo "gpus per worker: ${ARNOLD_WORKER_GPU}"
|
| 27 |
+
echo "master ip: ${METIS_WORKER_0_HOST}"
|
| 28 |
+
echo "master port: ${port}"
|
| 29 |
+
|
| 30 |
+
source /mnt/bn/tns-algo-video-public-my2/wangpeng.an/environment/anaconda3/bin/activate vicuna16k
|
| 31 |
+
|
| 32 |
+
cd /mnt/bn/tns-algo-video-public-my2/wangpeng.an/model/OmniFusion-vicuna16k
|
| 33 |
+
|
| 34 |
+
# Install necessary packages
|
| 35 |
+
pip3 install requests
|
| 36 |
+
pip3 install attrs
|
| 37 |
+
pip3 install aiofiles
|
| 38 |
+
pip3 install pynvml
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
# Print Python executable path, torchrun, deepspeed and PYTHONPATH
|
| 42 |
+
echo "Python executable: $(which python)"
|
| 43 |
+
echo "torchrun executable: $(which torchrun)"
|
| 44 |
+
echo "deepspeed executable: $(which deepspeed)"
|
| 45 |
+
echo "PYTHONPATH before torchrun: $PYTHONPATH"
|
| 46 |
+
|
| 47 |
+
sudo chmod 777 /var/lib/fastrak -R
|
| 48 |
+
|
| 49 |
+
# Launch training with DeepSpeed and torchrun
|
| 50 |
+
ACCELERATE_CPU_AFFINITY=1 torchrun --nproc_per_node=$ARNOLD_WORKER_GPU --nnodes=$ARNOLD_WORKER_NUM --node_rank=$ARNOLD_ID --master_addr=$METIS_WORKER_0_HOST --master_port=$port \
|
| 51 |
+
llava/train/train_mem.py \
|
| 52 |
+
--deepspeed ./scripts/zero2.json \
|
| 53 |
+
--model_name_or_path /mnt/bn/tns-algo-video-public-my2/wangpeng.an/model/vicuna-7b-v1.5-16k \
|
| 54 |
+
--version plain \
|
| 55 |
+
--data_path /mnt/bn/tns-algo-video-public-my2/wangpeng.an/data/stage3/video_image_asr_caption_stage3_1225_next.json \
|
| 56 |
+
--audio_asr_folder /mnt/bn/tns-algo-video-public-my2/wangpeng.an/data \
|
| 57 |
+
--audio_caption_folder /mnt/bn/tns-algo-video-public-my2/wangpeng.an/data/audio_caption \
|
| 58 |
+
--video_folder /mnt/bn/tns-algo-video-public-my2/wangpeng.an/data/video \
|
| 59 |
+
--image_folder /mnt/bn/tns-algo-video-public-my2/wangpeng.an/data/video/Video-LLaVA \
|
| 60 |
+
--X "Audio_asr" "Audio_caption" "Video" "Image" \
|
| 61 |
+
--audio_tower /mnt/bn/tns-algo-video-public-my2/wangpeng.an/model/LanguageBind_Audio_Asr \
|
| 62 |
+
--audio_caption_tower /mnt/bn/tns-algo-video-public-my2/wangpeng.an/model/pretrained_model/LanguageBind_Audio \
|
| 63 |
+
--video_tower /mnt/bn/tns-algo-video-public-my2/wangpeng.an/model/pretrained_model/LanguageBind_Video_merge \
|
| 64 |
+
--image_tower /mnt/bn/tns-algo-video-public-my2/wangpeng.an/model/pretrained_model/LanguageBind_Image \
|
| 65 |
+
--pretrain_mm_mlp_adapter /mnt/bn/tns-algo-video-public-my2/wangpeng.an/model/OmniFusion-vicuna16k/checkpoints/Video-LLaVA-Pretrain-7B-0106/mm_projector.bin \
|
| 66 |
+
--mm_projector_type mlp2x_gelu \
|
| 67 |
+
--mm_vision_select_layer -2 \
|
| 68 |
+
--mm_use_x_start_end False \
|
| 69 |
+
--mm_use_x_patch_token False \
|
| 70 |
+
--image_aspect_ratio pad \
|
| 71 |
+
--group_by_modality_length True \
|
| 72 |
+
--bf16 True \
|
| 73 |
+
--output_dir ./checkpoints/OmniFusion-vicuna-stage3-0106-next \
|
| 74 |
+
--num_train_epochs 1 \
|
| 75 |
+
--per_device_train_batch_size 4 \
|
| 76 |
+
--per_device_eval_batch_size 4 \
|
| 77 |
+
--gradient_accumulation_steps 1 \
|
| 78 |
+
--evaluation_strategy "no" \
|
| 79 |
+
--save_strategy "steps" \
|
| 80 |
+
--save_steps 3000 \
|
| 81 |
+
--save_total_limit 4 \
|
| 82 |
+
--learning_rate 2e-5 \
|
| 83 |
+
--weight_decay 0. \
|
| 84 |
+
--warmup_ratio 0.03 \
|
| 85 |
+
--lr_scheduler_type "cosine" \
|
| 86 |
+
--logging_steps 1 \
|
| 87 |
+
--tf32 True \
|
| 88 |
+
--model_max_length 2048 \
|
| 89 |
+
--tokenizer_model_max_length 3072 \
|
| 90 |
+
--gradient_checkpointing True \
|
| 91 |
+
--dataloader_num_workers 8 \
|
| 92 |
+
--lazy_preprocess True \
|
| 93 |
+
--report_to none \
|
| 94 |
+
--cache_dir "./cache_dir"
|