diff --git a/examples/hey_snips/s0/kws b/examples/hey_snips/s0/kws deleted file mode 120000 index 7a3e8e1..0000000 --- a/examples/hey_snips/s0/kws +++ /dev/null @@ -1 +0,0 @@ -../../../kws \ No newline at end of file diff --git a/examples/hey_snips/s0/run.sh b/examples/hey_snips/s0/run.sh index 8aeb782..7ff7f61 100755 --- a/examples/hey_snips/s0/run.sh +++ b/examples/hey_snips/s0/run.sh @@ -68,7 +68,7 @@ if [ ${stage} -le 2 ] && [ ${stop_stage} -ge 2 ]; then $norm_var && cmvn_opts="$cmvn_opts --norm_var" num_gpus=$(echo $gpus | awk -F ',' '{print NF}') torchrun --standalone --nnodes=1 --nproc_per_node=$num_gpus \ - kws/bin/train.py --gpus $gpus \ + wekws/bin/train.py --gpus $gpus \ --config $config \ --train_data data/train/data.list \ --cv_data data/dev/data.list \ @@ -83,14 +83,14 @@ fi if [ ${stage} -le 3 ] && [ ${stop_stage} -ge 3 ]; then echo "Do model average, Compute FRR/FAR ..." - python kws/bin/average_model.py \ + python wekws/bin/average_model.py \ --dst_model $score_checkpoint \ --src_path $dir \ --num ${num_average} \ --val_best result_dir=$dir/test_$(basename $score_checkpoint) mkdir -p $result_dir - python kws/bin/score.py \ + python wekws/bin/score.py \ --config $dir/config.yaml \ --test_data data/test/data.list \ --batch_size 256 \ @@ -100,13 +100,13 @@ if [ ${stage} -le 3 ] && [ ${stop_stage} -ge 3 ]; then first_keyword=0 last_keyword=$(($num_keywords+$first_keyword-1)) for keyword in $(seq $first_keyword $last_keyword); do - python kws/bin/compute_det.py \ + python wekws/bin/compute_det.py \ --keyword $keyword \ --test_data data/test/data.list \ --score_file $result_dir/score.txt \ --stats_file $result_dir/stats.${keyword}.txt done - python kws/bin/plot_det_curve.py \ + python wekws/bin/plot_det_curve.py \ --keywords_dict dict/words.txt \ --stats_dir $result_dir \ --figure_file $result_dir/det.png \ @@ -118,7 +118,7 @@ fi if [ ${stage} -le 5 ] && [ ${stop_stage} -ge 5 ]; then - python kws/bin/export_jit.py --config $dir/config.yaml \ + python wekws/bin/export_jit.py --config $dir/config.yaml \ --checkpoint $score_checkpoint \ --output_file $dir/final.zip \ --output_quant_file $dir/final.quant.zip diff --git a/examples/hey_snips/s0/wekws b/examples/hey_snips/s0/wekws new file mode 120000 index 0000000..64f8a41 --- /dev/null +++ b/examples/hey_snips/s0/wekws @@ -0,0 +1 @@ +../../../wekws \ No newline at end of file diff --git a/examples/hi_xiaowen/s0/kws b/examples/hi_xiaowen/s0/kws deleted file mode 120000 index 7a3e8e1..0000000 --- a/examples/hi_xiaowen/s0/kws +++ /dev/null @@ -1 +0,0 @@ -../../../kws \ No newline at end of file diff --git a/examples/hi_xiaowen/s0/run.sh b/examples/hi_xiaowen/s0/run.sh index 14f1bed..a92c62b 100755 --- a/examples/hi_xiaowen/s0/run.sh +++ b/examples/hi_xiaowen/s0/run.sh @@ -73,7 +73,7 @@ if [ ${stage} -le 2 ] && [ ${stop_stage} -ge 2 ]; then $norm_var && cmvn_opts="$cmvn_opts --norm_var" num_gpus=$(echo $gpus | awk -F ',' '{print NF}') torchrun --standalone --nnodes=1 --nproc_per_node=$num_gpus \ - kws/bin/train.py --gpus $gpus \ + wekws/bin/train.py --gpus $gpus \ --config $config \ --train_data data/train/data.list \ --cv_data data/dev/data.list \ @@ -88,14 +88,14 @@ fi if [ ${stage} -le 3 ] && [ ${stop_stage} -ge 3 ]; then echo "Do model average, Compute FRR/FAR ..." - python kws/bin/average_model.py \ + python wekws/bin/average_model.py \ --dst_model $score_checkpoint \ --src_path $dir \ --num ${num_average} \ --val_best result_dir=$dir/test_$(basename $score_checkpoint) mkdir -p $result_dir - python kws/bin/score.py \ + python wekws/bin/score.py \ --config $dir/config.yaml \ --test_data data/test/data.list \ --batch_size 256 \ @@ -104,7 +104,7 @@ if [ ${stage} -le 3 ] && [ ${stop_stage} -ge 3 ]; then --num_workers 8 for keyword in 0 1; do - python kws/bin/compute_det.py \ + python wekws/bin/compute_det.py \ --keyword $keyword \ --test_data data/test/data.list \ --window_shift $window_shift \ @@ -120,7 +120,7 @@ if [ ${stage} -le 4 ] && [ ${stop_stage} -ge 4 ]; then quantize_score_checkpoint=$(basename $score_checkpoint | sed -e 's:.pt$:.quant.zip:g') cat data/train/data.list | python tools/shuffle_list.py --seed 777 | \ head -n 10000 > $dir/calibration.list - python kws/bin/static_quantize.py \ + python wekws/bin/static_quantize.py \ --config $dir/config.yaml \ --test_data $dir/calibration.list \ --checkpoint $score_checkpoint \ @@ -129,7 +129,7 @@ if [ ${stage} -le 4 ] && [ ${stop_stage} -ge 4 ]; then result_dir=$dir/test_$(basename $quantize_score_checkpoint) mkdir -p $result_dir - python kws/bin/score.py \ + python wekws/bin/score.py \ --config $dir/config.yaml \ --test_data data/test/data.list \ --batch_size 256 \ @@ -138,7 +138,7 @@ if [ ${stage} -le 4 ] && [ ${stop_stage} -ge 4 ]; then --score_file $result_dir/score.txt \ --num_workers 8 for keyword in 0 1; do - python kws/bin/compute_det.py \ + python wekws/bin/compute_det.py \ --keyword $keyword \ --test_data data/test/data.list \ --score_file $result_dir/score.txt \ @@ -150,12 +150,12 @@ fi if [ ${stage} -le 5 ] && [ ${stop_stage} -ge 5 ]; then jit_model=$(basename $score_checkpoint | sed -e 's:.pt$:.zip:g') onnx_model=$(basename $score_checkpoint | sed -e 's:.pt$:.onnx:g') - python kws/bin/export_jit.py \ + python wekws/bin/export_jit.py \ --config $dir/config.yaml \ --checkpoint $score_checkpoint \ --jit_model $dir/$jit_model - python kws/bin/export_onnx.py \ + python wekws/bin/export_onnx.py \ --config $dir/config.yaml \ --checkpoint $score_checkpoint \ --onnx_model $dir/$onnx_model -fi \ No newline at end of file +fi diff --git a/examples/hi_xiaowen/s0/wekws b/examples/hi_xiaowen/s0/wekws new file mode 120000 index 0000000..64f8a41 --- /dev/null +++ b/examples/hi_xiaowen/s0/wekws @@ -0,0 +1 @@ +../../../wekws \ No newline at end of file diff --git a/examples/speechcommand_v1/s0/kws b/examples/speechcommand_v1/s0/kws deleted file mode 120000 index 7a3e8e1..0000000 --- a/examples/speechcommand_v1/s0/kws +++ /dev/null @@ -1 +0,0 @@ -../../../kws \ No newline at end of file diff --git a/examples/speechcommand_v1/s0/run.sh b/examples/speechcommand_v1/s0/run.sh index 235396c..cd0f037 100755 --- a/examples/speechcommand_v1/s0/run.sh +++ b/examples/speechcommand_v1/s0/run.sh @@ -68,7 +68,7 @@ if [ ${stage} -le 2 ] && [ ${stop_stage} -ge 2 ]; then $norm_var && cmvn_opts="$cmvn_opts --norm_var" num_gpus=$(echo $gpus | awk -F ',' '{print NF}') torchrun --standalone --nnodes=1 --nproc_per_node=$num_gpus \ - kws/bin/train.py --gpus $gpus \ + wekws/bin/train.py --gpus $gpus \ --config $config \ --train_data data/train/data.list \ --cv_data data/valid/data.list \ @@ -82,7 +82,7 @@ fi if [ ${stage} -le 3 ] && [ ${stop_stage} -ge 3 ]; then # Do model average - python kws/bin/average_model.py \ + python wekws/bin/average_model.py \ --dst_model $score_checkpoint \ --src_path $dir \ --num ${num_average} \ @@ -91,7 +91,7 @@ if [ ${stage} -le 3 ] && [ ${stop_stage} -ge 3 ]; then # Testing result_dir=$dir/test_$(basename $score_checkpoint) mkdir -p $result_dir - python kws/bin/compute_accuracy.py --gpu 3 \ + python wekws/bin/compute_accuracy.py --gpu 3 \ --config $dir/config.yaml \ --test_data data/test/data.list \ --batch_size 256 \ @@ -101,7 +101,7 @@ fi if [ ${stage} -le 4 ] && [ ${stop_stage} -ge 4 ]; then - python kws/bin/export_jit.py --config $dir/config.yaml \ + python wekws/bin/export_jit.py --config $dir/config.yaml \ --checkpoint $score_checkpoint \ --output_file $dir/final.zip \ --output_quant_file $dir/final.quant.zip diff --git a/examples/speechcommand_v1/s0/wekws b/examples/speechcommand_v1/s0/wekws new file mode 120000 index 0000000..64f8a41 --- /dev/null +++ b/examples/speechcommand_v1/s0/wekws @@ -0,0 +1 @@ +../../../wekws \ No newline at end of file diff --git a/kws/bin/average_model.py b/wekws/bin/average_model.py similarity index 100% rename from kws/bin/average_model.py rename to wekws/bin/average_model.py diff --git a/kws/bin/compute_accuracy.py b/wekws/bin/compute_accuracy.py similarity index 95% rename from kws/bin/compute_accuracy.py rename to wekws/bin/compute_accuracy.py index a6cde27..cf37623 100644 --- a/kws/bin/compute_accuracy.py +++ b/wekws/bin/compute_accuracy.py @@ -23,10 +23,10 @@ import torch import yaml from torch.utils.data import DataLoader -from kws.dataset.dataset import Dataset -from kws.model.kws_model import init_model -from kws.utils.checkpoint import load_checkpoint -from kws.utils.executor import Executor +from wekws.dataset.dataset import Dataset +from wekws.model.kws_model import init_model +from wekws.utils.checkpoint import load_checkpoint +from wekws.utils.executor import Executor def get_args(): diff --git a/kws/bin/compute_det.py b/wekws/bin/compute_det.py similarity index 100% rename from kws/bin/compute_det.py rename to wekws/bin/compute_det.py diff --git a/kws/bin/export_jit.py b/wekws/bin/export_jit.py similarity index 94% rename from kws/bin/export_jit.py rename to wekws/bin/export_jit.py index f127377..85d3a3d 100644 --- a/kws/bin/export_jit.py +++ b/wekws/bin/export_jit.py @@ -20,8 +20,8 @@ import os import torch import yaml -from kws.model.kws_model import init_model -from kws.utils.checkpoint import load_checkpoint +from wekws.model.kws_model import init_model +from wekws.utils.checkpoint import load_checkpoint def get_args(): diff --git a/kws/bin/export_onnx.py b/wekws/bin/export_onnx.py similarity index 96% rename from kws/bin/export_onnx.py rename to wekws/bin/export_onnx.py index bb9a29d..e752909 100644 --- a/kws/bin/export_onnx.py +++ b/wekws/bin/export_onnx.py @@ -18,8 +18,8 @@ import torch import yaml import onnxruntime as ort -from kws.model.kws_model import init_model -from kws.utils.checkpoint import load_checkpoint +from wekws.model.kws_model import init_model +from wekws.utils.checkpoint import load_checkpoint def get_args(): diff --git a/kws/bin/plot_det_curve.py b/wekws/bin/plot_det_curve.py similarity index 100% rename from kws/bin/plot_det_curve.py rename to wekws/bin/plot_det_curve.py diff --git a/kws/bin/score.py b/wekws/bin/score.py similarity index 97% rename from kws/bin/score.py rename to wekws/bin/score.py index a894704..f5d554f 100644 --- a/kws/bin/score.py +++ b/wekws/bin/score.py @@ -25,9 +25,9 @@ import torch import yaml from torch.utils.data import DataLoader -from kws.dataset.dataset import Dataset -from kws.model.kws_model import init_model -from kws.utils.checkpoint import load_checkpoint +from wekws.dataset.dataset import Dataset +from wekws.model.kws_model import init_model +from wekws.utils.checkpoint import load_checkpoint def get_args(): diff --git a/kws/bin/static_quantize.py b/wekws/bin/static_quantize.py similarity index 97% rename from kws/bin/static_quantize.py rename to wekws/bin/static_quantize.py index f92e66f..5ec638b 100644 --- a/kws/bin/static_quantize.py +++ b/wekws/bin/static_quantize.py @@ -24,9 +24,9 @@ import torch import yaml from torch.utils.data import DataLoader -from kws.dataset.dataset import Dataset -from kws.model.kws_model import init_model -from kws.utils.checkpoint import load_checkpoint +from wekws.dataset.dataset import Dataset +from wekws.model.kws_model import init_model +from wekws.utils.checkpoint import load_checkpoint def get_args(): diff --git a/kws/bin/train.py b/wekws/bin/train.py similarity index 97% rename from kws/bin/train.py rename to wekws/bin/train.py index 4d178c9..d3f57fc 100644 --- a/kws/bin/train.py +++ b/wekws/bin/train.py @@ -26,11 +26,11 @@ import yaml from tensorboardX import SummaryWriter from torch.utils.data import DataLoader -from kws.dataset.dataset import Dataset -from kws.utils.checkpoint import load_checkpoint, save_checkpoint -from kws.model.kws_model import init_model -from kws.utils.executor import Executor -from kws.utils.train_utils import count_parameters, set_mannul_seed +from wekws.dataset.dataset import Dataset +from wekws.utils.checkpoint import load_checkpoint, save_checkpoint +from wekws.model.kws_model import init_model +from wekws.utils.executor import Executor +from wekws.utils.train_utils import count_parameters, set_mannul_seed def get_args(): diff --git a/kws/dataset/dataset.py b/wekws/dataset/dataset.py similarity index 98% rename from kws/dataset/dataset.py rename to wekws/dataset/dataset.py index f301b75..f7d12c6 100644 --- a/kws/dataset/dataset.py +++ b/wekws/dataset/dataset.py @@ -18,8 +18,8 @@ import torch import torch.distributed as dist from torch.utils.data import IterableDataset -import kws.dataset.processor as processor -from kws.utils.file_utils import read_lists +import wekws.dataset.processor as processor +from wekws.utils.file_utils import read_lists class Processor(IterableDataset): diff --git a/kws/dataset/processor.py b/wekws/dataset/processor.py similarity index 100% rename from kws/dataset/processor.py rename to wekws/dataset/processor.py diff --git a/kws/model/classifier.py b/wekws/model/classifier.py similarity index 100% rename from kws/model/classifier.py rename to wekws/model/classifier.py diff --git a/kws/model/cmvn.py b/wekws/model/cmvn.py similarity index 100% rename from kws/model/cmvn.py rename to wekws/model/cmvn.py diff --git a/kws/model/kws_model.py b/wekws/model/kws_model.py similarity index 93% rename from kws/model/kws_model.py rename to wekws/model/kws_model.py index 0744524..3ca5b39 100644 --- a/kws/model/kws_model.py +++ b/wekws/model/kws_model.py @@ -18,12 +18,14 @@ from typing import Optional import torch import torch.nn as nn -from kws.model.cmvn import GlobalCMVN -from kws.model.classifier import GlobalClassifier, LastClassifier, LinearClassifier -from kws.model.subsampling import LinearSubsampling1, Conv1dSubsampling1, NoSubsampling -from kws.model.tcn import TCN, CnnBlock, DsCnnBlock -from kws.model.mdtc import MDTC -from kws.utils.cmvn import load_cmvn +from wekws.model.cmvn import GlobalCMVN +from wekws.model.classifier import (GlobalClassifier, LastClassifier, + LinearClassifier) +from wekws.model.subsampling import (LinearSubsampling1, Conv1dSubsampling1, + NoSubsampling) +from wekws.model.tcn import TCN, CnnBlock, DsCnnBlock +from wekws.model.mdtc import MDTC +from wekws.utils.cmvn import load_cmvn class KWSModel(nn.Module): diff --git a/kws/model/loss.py b/wekws/model/loss.py similarity index 99% rename from kws/model/loss.py rename to wekws/model/loss.py index eac9597..f8315ef 100644 --- a/kws/model/loss.py +++ b/wekws/model/loss.py @@ -15,7 +15,7 @@ import torch import torch.nn.functional as F -from kws.utils.mask import padding_mask +from wekws.utils.mask import padding_mask def max_pooling_loss(logits: torch.Tensor, diff --git a/kws/model/mdtc.py b/wekws/model/mdtc.py similarity index 100% rename from kws/model/mdtc.py rename to wekws/model/mdtc.py diff --git a/kws/model/subsampling.py b/wekws/model/subsampling.py similarity index 100% rename from kws/model/subsampling.py rename to wekws/model/subsampling.py diff --git a/kws/model/tcn.py b/wekws/model/tcn.py similarity index 100% rename from kws/model/tcn.py rename to wekws/model/tcn.py diff --git a/kws/utils/checkpoint.py b/wekws/utils/checkpoint.py similarity index 100% rename from kws/utils/checkpoint.py rename to wekws/utils/checkpoint.py diff --git a/kws/utils/cmvn.py b/wekws/utils/cmvn.py similarity index 100% rename from kws/utils/cmvn.py rename to wekws/utils/cmvn.py diff --git a/kws/utils/executor.py b/wekws/utils/executor.py similarity index 98% rename from kws/utils/executor.py rename to wekws/utils/executor.py index 822ed14..6740269 100644 --- a/kws/utils/executor.py +++ b/wekws/utils/executor.py @@ -17,7 +17,7 @@ import logging import torch from torch.nn.utils import clip_grad_norm_ -from kws.model.loss import criterion +from wekws.model.loss import criterion class Executor: diff --git a/kws/utils/file_utils.py b/wekws/utils/file_utils.py similarity index 100% rename from kws/utils/file_utils.py rename to wekws/utils/file_utils.py diff --git a/kws/utils/mask.py b/wekws/utils/mask.py similarity index 100% rename from kws/utils/mask.py rename to wekws/utils/mask.py diff --git a/kws/utils/train_utils.py b/wekws/utils/train_utils.py similarity index 100% rename from kws/utils/train_utils.py rename to wekws/utils/train_utils.py