From 497edf4c9d6c1565a4bcf1a3edfcd47ffec8c10d Mon Sep 17 00:00:00 2001
From: 游雁 <zhifu.gzf@alibaba-inc.com>
Date: 星期三, 21 二月 2024 11:30:59 +0800
Subject: [PATCH] bugfix

---
 examples/aishell/conformer/run.sh |   23 ++++++++++-------------
 1 files changed, 10 insertions(+), 13 deletions(-)

diff --git a/examples/aishell/conformer/run.sh b/examples/aishell/conformer/run.sh
index 947cc02..3029cbd 100755
--- a/examples/aishell/conformer/run.sh
+++ b/examples/aishell/conformer/run.sh
@@ -5,7 +5,7 @@
 
 # general configuration
 feats_dir="../DATA" #feature output dictionary
-exp_dir="."
+exp_dir=`pwd`
 lang=zh
 token_type=char
 stage=0
@@ -105,18 +105,15 @@
   echo "stage 4: ASR Training"
 
   mkdir -p ${exp_dir}/exp/${model_dir}
-  log_file="${exp_dir}/exp/${model_dir}/train.log.txt"
+  current_time=$(date "+%Y-%m-%d_%H-%M")
+  log_file="${exp_dir}/exp/${model_dir}/train.log.txt.${current_time}"
   echo "log_file: ${log_file}"
 
-  gpu_num=$(echo CUDA_VISIBLE_DEVICES | awk -F "," '{print NF}')
-#  torchrun \
-#  --nnodes 1 \
-#  --nproc_per_node ${gpu_num}
-  cmd="python"
-  if [ ${gpu_num} -gt 1  ];then
-    cmd="torchrun --nnodes 1 --nproc_per_node ${gpu_num}"
-  fi
-  ${cmd} \
+  export CUDA_VISIBLE_DEVICES=$CUDA_VISIBLE_DEVICES
+  gpu_num=$(echo $CUDA_VISIBLE_DEVICES | awk -F "," '{print NF}')
+  torchrun \
+  --nnodes 1 \
+  --nproc_per_node ${gpu_num} \
   ../../../funasr/bin/train.py \
   --config-path "${workspace}/conf" \
   --config-name "${config}" \
@@ -133,7 +130,7 @@
 if [ ${stage} -le 5 ] && [ ${stop_stage} -ge 5 ]; then
   echo "stage 5: Inference"
 
-  if ${inference_device} == "cuda"; then
+  if [ ${inference_device} == "cuda" ]; then
       nj=$(echo $CUDA_VISIBLE_DEVICES | awk -F "," '{print NF}')
   else
       inference_batch_size=1
@@ -174,7 +171,7 @@
           ++input="${_logdir}/keys.${JOB}.scp" \
           ++output_dir="${inference_dir}/${JOB}" \
           ++device="${inference_device}" \
-          ++batch_size="${inference_batch_size}"
+          ++batch_size="${inference_batch_size}" &> ${_logdir}/log.${JOB}.txt
         }&
 
     done

--
Gitblit v1.9.1