-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
1,408 additions
and
209 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
.DS_Store | ||
__pycache__ | ||
.ipynb_checkpoints | ||
.idea/* | ||
transformers |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
#!/bin/bash | ||
#export PYTHONPATH=/root/whisper:$PYTHONPATH | ||
export CUDA_VISIBLE_DEVICES=0,1,2,3 | ||
export CUDA_LAUNCH_BLOCKING=1 | ||
# export OMP_NUM_THREADS=1 | ||
# export PYTORCH_CUDA_ALLOC_CONF=max_split_size_mb:128 | ||
|
||
# debug setting for multiple gpus | ||
# export NCCL_DEBUG=INFO | ||
# export NCCL_DEBUG_SUBSYS=ALL | ||
# export TORCH_DISTRIBUTED_DEBUG=INFO | ||
|
||
cd /root/SLAM-LLM | ||
|
||
speech_encoder_path=/nfs/zhifu.gzf/ckpt/Whisper/large-v2.pt | ||
# speech_encoder_path=/nfs/maziyang.mzy/models/Whisper/large-v2-qwen.pt | ||
llm_path=/nfs/zhifu.gzf/ckpt/Llama-2-7b-hf | ||
output_dir=/nfs/maziyang.mzy/exps/llama-2-hf-finetune-echat-ds5-proj2048-debug | ||
|
||
# -m debugpy --listen 5678 --wait-for-client | ||
if [[ $CUDA_VISIBLE_DEVICES != *","* ]]; then | ||
python -m debugpy --listen 5678 --wait-for-client src/llama_recipes/pipeline/finetune.py \ | ||
--model_name echat \ | ||
--freeze_encoder \ | ||
--freeze_llm \ | ||
--use_fp16 \ | ||
--llm_name llama-2-7b-hf \ | ||
--llm_path $llm_path \ | ||
--encoder_name whisper \ | ||
--encoder_ds_rate 2 \ | ||
--encoder_path $speech_encoder_path \ | ||
--encoder_projector linear \ | ||
--encoder_projector_ds_rate 5 \ | ||
--dataset custom_dataset \ | ||
--custom_dataset.file src/llama_recipes/datasets/echat_dataset.py:get_audio_dataset \ | ||
--custom_dataset.data_path /nfs/zhifu.gzf/data/IEMOCAP_full_release/datalist.jsonl \ | ||
--batching_strategy custom \ | ||
--custom_dataset.max_words 1024 \ | ||
--num_epochs 100 \ | ||
--batch_size_training 2 \ | ||
--val_batch_size 2 \ | ||
--output_dir $output_dir \ | ||
--run_test_during_validation \ | ||
--run_test_during_validation_file /nfs/zhifu.gzf/data/IEMOCAP_full_release/Session5/sentences/wav/Ses05M_impro04/Ses05M_impro04_M040.wav \ | ||
# --ckpt_path "/nfs/maziyang.mzy/models/llama-2-hf-finetune/echat/1/model.pt" \ | ||
# --peft_ckpt "/nfs/maziyang.mzy/models/llama-2-hf-finetune/echat/1" | ||
# --use_peft --peft_method lora \ | ||
|
||
# train | ||
# {"trans": "Well, do you have your passport?\n", | ||
# "emotion": "xxx", | ||
# "wav": "/nfs/zhifu.gzf/data/IEMOCAP_full_release/Session1/sentences/wav/Ses01M_impro01/Ses01M_impro01_F009.wav"} | ||
# {"trans": "No, I don't have a passport.\n", | ||
# "emotion": "neu", | ||
# "wav": "/nfs/zhifu.gzf/data/IEMOCAP_full_release/Session1/sentences/wav/Ses01M_impro01/Ses01M_impro01_M010.wav"} | ||
|
||
# val | ||
# {"trans": "Yeah, well thanks for your help.\n", | ||
# "emotion": "ang", | ||
# "wav": "/nfs/zhifu.gzf/data/IEMOCAP_full_release/Session5/sentences/wav/Ses05M_impro04/Ses05M_impro04_M040.wav"} | ||
# {"trans": "I'm sorry. Good luck, man.\n", | ||
# "emotion": "xxx", | ||
# "wav": "/nfs/zhifu.gzf/data/IEMOCAP_full_release/Session5/sentences/wav/Ses05M_impro04/Ses05M_impro04_F038.wav"} | ||
|
||
else | ||
torchrun \ | ||
--nnodes 1 \ | ||
--nproc_per_node 4 \ | ||
src/llama_recipes/pipeline/finetune.py \ | ||
--model_name echat \ | ||
--freeze_encoder \ | ||
--use_fp16 \ | ||
--use_peft --peft_method lora \ | ||
--enable_fsdp \ | ||
--llm_name llama-2-7b-hf \ | ||
--llm_path $llm_path \ | ||
--encoder_name whisper \ | ||
--encoder_ds_rate 2 \ | ||
--encoder_path $speech_encoder_path \ | ||
--encoder_projector linear \ | ||
--encoder_projector_ds_rate 5 \ | ||
--dataset custom_dataset \ | ||
--custom_dataset.file src/llama_recipes/datasets/echat_dataset.py:get_audio_dataset \ | ||
--custom_dataset.data_path /nfs/zhifu.gzf/data/IEMOCAP_full_release/datalist.jsonl \ | ||
--batching_strategy custom \ | ||
--num_epochs 100 \ | ||
--batch_size_training 8 \ | ||
--val_batch_size 8 \ | ||
--output_dir $output_dir \ | ||
--run_test_during_validation \ | ||
--run_test_during_validation_file /nfs/zhifu.gzf/data/IEMOCAP_full_release/Session1/sentences/wav/Ses01M_impro01/Ses01M_impro01_F009.wav \ | ||
--run_test_during_validation_prompt """ | ||
Please provide an emotional response based on the emotional speech you hear. | ||
Remember to format your answer as follows: <|EMOTION|><|REPLY|>. | ||
<|EMOTION|> is a standalone adjective. | ||
<|REPLY|> is a reply based on a the speech. | ||
""" \ | ||
--metric acc \ | ||
# --ckpt_path "/nfs/maziyang.mzy/models/llama-2-hf-finetune/echat/1/model.pt" \ | ||
# --peft_ckpt "/nfs/maziyang.mzy/models/llama-2-hf-finetune/echat/1" | ||
# --freeze_llm \ | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
#!/bin/bash | ||
#export PYTHONPATH=/root/whisper:$PYTHONPATH | ||
export CUDA_VISIBLE_DEVICES=0,1,2,3 | ||
export CUDA_LAUNCH_BLOCKING=1 | ||
export OMP_NUM_THREADS=1 | ||
|
||
# debug setting for multiple gpus | ||
# export NCCL_DEBUG=INFO | ||
# export NCCL_DEBUG_SUBSYS=ALL | ||
# export TORCH_DISTRIBUTED_DEBUG=INFO | ||
|
||
cd /root/SLAM-LLM | ||
|
||
speech_encoder_path=/nfs/zhifu.gzf/ckpt/Whisper/large-v2.pt | ||
# speech_encoder_path=/nfs/maziyang.mzy/models/Whisper/large-v2-qwen.pt | ||
llm_path=/nfs/zhifu.gzf/ckpt/Llama-2-7b-hf | ||
output_dir=/nfs/maziyang.mzy/exps/llama-2-hf-finetune-asr-ds5-proj2048 | ||
|
||
# -m debugpy --listen 5678 --wait-for-client | ||
if [[ $CUDA_VISIBLE_DEVICES != *","* ]]; then | ||
python -m debugpy --listen 5678 --wait-for-client src/llama_recipes/pipeline/finetune.py \ | ||
--model_name asr \ | ||
--freeze_encoder \ | ||
--freeze_llm \ | ||
--llm_name llama-2-7b-hf \ | ||
--llm_path $llm_path \ | ||
--encoder_name whisper \ | ||
--encoder_ds_rate 2 \ | ||
--encoder_path $speech_encoder_path \ | ||
--encoder_projector linear \ | ||
--encoder_projector_ds_rate 5 \ | ||
--dataset custom_dataset \ | ||
--custom_dataset.file src/llama_recipes/datasets/speech_dataset.py:get_audio_dataset \ | ||
--custom_dataset.train_data_path /nfs/beinian.lzr/workspace/datasets/speech_llm/train_dataset/data_wav_json/asr/librispeech_train_960h_wav_speech_llm_train_data.json \ | ||
--custom_dataset.val_data_path /nfs/beinian.lzr/workspace/datasets/data/16k/opendata/librispeech/dev_other/librispeech_dev_other.jsonl \ | ||
--batching_strategy custom \ | ||
--num_epochs 100 \ | ||
--batch_size_training 4 \ | ||
--val_batch_size 4 \ | ||
--lr 1e-5 \ | ||
--output_dir $output_dir \ | ||
--run_test_during_validation \ | ||
--run_test_during_validation_file "/cpfs01/shared/Group-speech/beinian.lzr/data/open_data/librispeech_audio/audio/se_librispeech_1001-134707-0000.wav" \ | ||
--run_test_during_validation_prompt "<|ASR|>" \ | ||
--metric acc \ | ||
# --ckpt_path "/nfs/maziyang.mzy/models/llama-2-hf-finetune/echat/7/model.pt" \ | ||
# --peft_ckpt "/nfs/maziyang.mzy/models/llama-2-hf-finetune/echat/7" \ | ||
# --use_peft --peft_method lora \ | ||
|
||
else | ||
torchrun \ | ||
--nnodes 1 \ | ||
--nproc_per_node 4 \ | ||
src/llama_recipes/pipeline/finetune.py \ | ||
--model_name asr \ | ||
--freeze_encoder \ | ||
--freeze_llm \ | ||
--use_fp16 \ | ||
--enable_fsdp \ | ||
--llm_name llama-2-7b-hf \ | ||
--llm_path $llm_path \ | ||
--encoder_name whisper \ | ||
--encoder_ds_rate 2 \ | ||
--encoder_path $speech_encoder_path \ | ||
--encoder_projector linear \ | ||
--encoder_projector_ds_rate 5 \ | ||
--dataset custom_dataset \ | ||
--custom_dataset.file src/llama_recipes/datasets/speech_dataset.py:get_audio_dataset \ | ||
--custom_dataset.train_data_path /nfs/maziyang.mzy/data/librispeech/librispeech_train_960h_wav_speech_llm_train_data.json \ | ||
--custom_dataset.val_data_path /nfs/maziyang.mzy/data/librispeech/librispeech_dev_other.jsonl \ | ||
--batching_strategy custom \ | ||
--num_epochs 100 \ | ||
--batch_size_training 8 \ | ||
--val_batch_size 8 \ | ||
--num_workers_dataloader 4 \ | ||
--lr 1e-5 \ | ||
--output_dir $output_dir \ | ||
--run_test_during_validation \ | ||
--run_test_during_validation_file "/nfs/beinian.lzr/workspace/datasets/data/16k/opendata/librispeech/test_other/wav/1688-142285-0000.wav" \ | ||
--run_test_during_validation_prompt "<|ASR|>" \ | ||
--metric acc \ | ||
# --ckpt_path "/nfs/maziyang.mzy/models/llama-2-hf-finetune/echat/7/model.pt" \ | ||
# --peft_ckpt "/nfs/maziyang.mzy/models/llama-2-hf-finetune/echat/7" \ | ||
# --use_peft --peft_method lora \ | ||
fi | ||
|
||
# {"key": "1001-134707-0000_ASR", "prompt": "<ASR>", "source": "/cpfs01/shared/Group-speech/beinian.lzr/data/open_data/librispeech_audio/audio/se_librispeech_1001-134707-0000.wav", "target": "1 little recks the laborer. How near his work is holding him to God, The loving laborer through space and time, after all, not to create, only or found only.", "target_len": 157, "source_len": 1581, "text-type": "Transcribe", "audio_language": "en", "text_language": "en", "task-type": "<ASR>"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/bash | ||
#export PYTHONPATH=/root/whisper:$PYTHONPATH | ||
export CUDA_VISIBLE_DEVICES=0 | ||
export CUDA_LAUNCH_BLOCKING=1 | ||
|
||
cd /root/SLAM-LLM | ||
|
||
speech_encoder_path=/nfs/zhifu.gzf/ckpt/Whisper/large-v2.pt | ||
# speech_encoder_path=/nfs/maziyang.mzy/models/Whisper/large-v2-qwen.pt | ||
llm_path=/nfs/zhifu.gzf/ckpt/Llama-2-7b-hf | ||
output_dir=/nfs/maziyang.mzy/exps/llama-2-hf-finetune-asr-ds5-proj2048 | ||
|
||
# -m debugpy --listen 5678 --wait-for-client | ||
python src/llama_recipes/pipeline/inference.py \ | ||
--model_name asr \ | ||
--freeze_llm \ | ||
--freeze_encoder \ | ||
--llm_name llama-2-7b-hf \ | ||
--llm_path $llm_path \ | ||
--encoder_name whisper \ | ||
--encoder_ds_rate 2 \ | ||
--encoder_path $speech_encoder_path \ | ||
--encoder_projector linear \ | ||
--encoder_projector_ds_rate 5 \ | ||
--output_dir $output_dir \ | ||
--ckpt_path "/nfs/maziyang.mzy/exps/llama-2-hf-finetune-asr-ds5-proj2048/asr/13/model.pt" \ | ||
--wav_path "/cpfs01/shared/Group-speech/beinian.lzr/data/open_data/librispeech_audio/audio/se_librispeech_1001-134707-0032.wav" \ | ||
--prompt "<|ASR|>" \ | ||
# --peft_ckpt "/nfs/maziyang.mzy/models/llama-2-hf-finetune/echat/1" \ | ||
# --use_peft --peft_method lora \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/bin/bash | ||
#export PYTHONPATH=/root/whisper:$PYTHONPATH | ||
export CUDA_VISIBLE_DEVICES=1 | ||
export CUDA_LAUNCH_BLOCKING=1 | ||
|
||
cd /root/SLAM-LLM | ||
|
||
speech_encoder_path=/nfs/zhifu.gzf/ckpt/Whisper/large-v2.pt | ||
# speech_encoder_path=/nfs/maziyang.mzy/models/Whisper/large-v2-qwen.pt | ||
llm_path=/nfs/zhifu.gzf/ckpt/Llama-2-7b-hf | ||
output_dir=/nfs/maziyang.mzy/exps/llama-2-hf-finetune-asr-ds5-proj2048 | ||
ckpt_path=/nfs/maziyang.mzy/exps/llama-2-hf-finetune-asr-ds5-proj2048/asr/10/model.pt | ||
decode_log=/root/decode_log | ||
|
||
# -m debugpy --listen 5678 --wait-for-client | ||
python src/llama_recipes/pipeline/inference_batch.py \ | ||
--model_name asr \ | ||
--freeze_llm \ | ||
--freeze_encoder \ | ||
--llm_name llama-2-7b-hf \ | ||
--llm_path $llm_path \ | ||
--encoder_name whisper \ | ||
--encoder_ds_rate 2 \ | ||
--encoder_path $speech_encoder_path \ | ||
--encoder_projector linear \ | ||
--encoder_projector_ds_rate 5 \ | ||
--dataset custom_dataset \ | ||
--custom_dataset.file src/llama_recipes/datasets/speech_dataset_inference.py:get_audio_dataset \ | ||
--custom_dataset.val_data_path /nfs/maziyang.mzy/data/librispeech/librispeech_test_other.jsonl \ | ||
--batching_strategy custom \ | ||
--num_epochs 1 \ | ||
--val_batch_size 8 \ | ||
--num_workers_dataloader 4 \ | ||
--output_dir $output_dir \ | ||
--ckpt_path $ckpt_path \ | ||
--decode_log $decode_log \ | ||
# --peft_ckpt "/nfs/maziyang.mzy/models/llama-2-hf-finetune/echat/1" \ | ||
# --use_peft --peft_method lora \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/bin/bash | ||
#export PYTHONPATH=/root/whisper:$PYTHONPATH | ||
export CUDA_VISIBLE_DEVICES=1 | ||
export CUDA_LAUNCH_BLOCKING=1 | ||
|
||
cd /root/SLAM-LLM | ||
|
||
# speech_encoder_path=/nfs/zhifu.gzf/ckpt/Whisper/base.pt | ||
speech_encoder_path=/nfs/maziyang.mzy/models/Whisper/large-v2-qwen.pt | ||
llm_path=/nfs/zhifu.gzf/ckpt/Llama-2-7b-hf | ||
output_dir=/nfs/maziyang.mzy/models/llama-2-hf-finetune | ||
|
||
# -m debugpy --listen 5678 --wait-for-client | ||
#python -m debugpy --listen 5678 --wait-for-client src/llama_recipes/pipeline/finetune.py \ | ||
python src/llama_recipes/pipeline/inference.py \ | ||
--model_name echat \ | ||
--freeze_llm \ | ||
--use_fp16 \ | ||
--quantization \ | ||
--llm_name llama-2-7b-hf \ | ||
--llm_path $llm_path \ | ||
--encoder_name whisper \ | ||
--encoder_path $speech_encoder_path \ | ||
--encoder_projector linear \ | ||
--dataset custom_dataset \ | ||
--custom_dataset.file src/llama_recipes/datasets/speech_text_dataset.py:get_audio_dataset \ | ||
--custom_dataset.data_path /nfs/zhifu.gzf/data/IEMOCAP_full_release/datalist.jsonl \ | ||
--batching_strategy custom \ | ||
--custom_dataset.max_words 1024 \ | ||
--num_epochs 1 \ | ||
--batch_size_training 2 \ | ||
--output_dir $output_dir \ | ||
--ckpt_path "/nfs/maziyang.mzy/models/llama-2-hf-finetune/echat/1/model.pt" \ | ||
--wav_path "/nfs/zhifu.gzf/data/IEMOCAP_full_release/Session5/sentences/wav/Ses05M_impro04/Ses05M_impro04_F035.wav" \ | ||
--prompt """ | ||
Please provide an emotional response based on the emotional speech you hear. | ||
Remember to format your answer as follows: <|EMOTION|><|REPLY|>. | ||
<|EMOTION|> is a standalone adjective. | ||
<|REPLY|> is a reply based on a the speech. | ||
""" \ | ||
# --peft_ckpt "/nfs/maziyang.mzy/models/llama-2-hf-finetune/echat/1" | ||
# --use_peft --peft_method lora \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.