git log 统计自己代码提交量报错 awk No such file or directory

本文讲述了在使用Gitlog统计代码提交时遇到的两个问题:一是执行gitlog时因参数格式错误报错,二是awk命令未识别。给出了在IDEATerminal中正确使用gitlog和awk的修正方法。

解决一下用git log 统计提交代码量可能出现的两个问题
第一个:报错信息如下,找不到可执行的文件

'awk' is not recognized as an internal or external command,
operable program or batch file.

大概率你是通过idea的Terminal工具执行的命令,改从文件夹通过右键 Bash here 进入命令行窗口即可
在这里插入图片描述

第二个报错信息如下:无法识别 awk 命令

bash: git log --after=2023-09-01 --before=2023-09-30 --author=tanzhi_hg --pretty=tformat: --numstat : command not found
bash:  awk { add +=$1; subs +=$2; loc += $1 + $2} END { printf "新增行数: %s, 移除行数: %s, 总行数: %s\n", add, subs, loc}: No such file or directory

这个问题是因为在执行git log命令时,参数之间缺少了空格;而关于报错信息中的awk命令,可能是因为你的系统中没有安装awk。你可以尝试使用以下命令替换原来的awk命令:

 git log --after=2023-09-01 --before=2023-09-30 --author=提交人名称 --pretty=format: --numstat | awk '{add += $1; subs += $2; loc+=$1+$2} END {printf "新增行数 : %s, 移除行数: %s, 总行数: %s", add, subs, loc}'

在这里插入图片描述

(venv) hp@LAPTOP-A2TF1QNG:~/wenet_expri/examples/s1$ ./run.sh Warning: the exp/teacher/conformer_base_warmup_25000 exists!!! Please input Y to continue...Y continue... ./run.sh: init method is file:///home/hp/wenet_expri/examples/s1/exp/teacher/conformer_base_warmup_25000/ddp_init cp: cannot stat 'fbank/train/global_cmvn': No such file or directory /home/hp/wenet_expri/wenet/dataset/wav_distortion.py:7: UserWarning: torchaudio._backend.set_audio_backend has been deprecated. With dispatcher enabled, this function is no-op. You can remove the function call. torchaudio.set_audio_backend("sox") /home/hp/wenet_expri/wenet/dataset/wav_distortion.py:7: UserWarning: torchaudio._backend.set_audio_backend has been deprecated. With dispatcher enabled, this function is no-op. You can remove the function call. torchaudio.set_audio_backend("sox") /home/hp/wenet_expri/wenet/dataset/dataset.py:36: UserWarning: torchaudio._backend.set_audio_backend has been deprecated. With dispatcher enabled, this function is no-op. You can remove the function call. torchaudio.set_audio_backend("sox") /home/hp/wenet_expri/wenet/dataset/dataset.py:36: UserWarning: torchaudio._backend.set_audio_backend has been deprecated. With dispatcher enabled, this function is no-op. You can remove the function call. torchaudio.set_audio_backend("sox") Namespace(config='conf/train_unified_conformer_teacher.yaml', log_path='exp/teacher/conformer_base_warmup_25000/train.log', train_data='fbank/train/format.data', cv_data='fbank/dev/format.data', gpu=0, model_dir='exp/teacher/conformer_base_warmup_25000', checkpoint=None, tensorboard_dir='tensorboard', rank=0, world_size=2, dist_backend='nccl', init_method='file:///home/hp/wenet_expri/examples/s1/exp/teacher/conformer_base_warmup_25000/ddp_init', num_workers=8, pin_memory=False, cmvn='exp/teacher/conformer_base_warmup_25000/global_cmvn', config_teacher=None, teacher_model=None, seed=777)Namespace(config='conf/train_unified_conformer_teacher.yaml', log_path='exp/teacher/conformer_base_warmup_25000/train.log', train_data='fbank/train/format.data', cv_data='fbank/dev/format.data', gpu=1, model_dir='exp/teacher/conformer_base_warmup_25000', checkpoint=None, tensorboard_dir='tensorboard', rank=1, world_size=2, dist_backend='nccl', init_method='file:///home/hp/wenet_expri/examples/s1/exp/teacher/conformer_base_warmup_25000/ddp_init', num_workers=8, pin_memory=False, cmvn='exp/teacher/conformer_base_warmup_25000/global_cmvn', config_teacher=None, teacher_model=None, seed=777) Traceback (most recent call last): Traceback (most recent call last): File "/home/hp/wenet_expri/examples/s1/wenet/bin/train.py", line 103, in <module> File "/home/hp/wenet_expri/examples/s1/wenet/bin/train.py", line 103, in <module> with open(args.config, 'r') as fin:with open(args.config, 'r') as fin: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FileNotFoundErrorFileNotFoundError: : [Errno 2] No such file or directory: 'conf/train_unified_conformer_teacher.yaml'[Errno 2] No such file or directory: 'conf/train_unified_conformer_teacher.yaml' do model average and final checkpoint is exp/teacher/conformer_base_warmup_25000/avg_20.pt Namespace(dst_model='exp/teacher/conformer_base_warmup_25000/avg_20.pt', src_path='exp/teacher/conformer_base_warmup_25000', val_best=True, num=20, min_epoch=0, max_epoch=149) Traceback (most recent call last): File "/home/hp/wenet_expri/examples/s1/wenet/bin/average_model.py", line 47, in <module> sort_idx = np.argsort(val_scores[:, -1]) ~~~~~~~~~~^^^^^^^ IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed usage: recognize.py [-h] --config CONFIG --wav_path WAV_PATH --test_data TEST_DATA [--gpu GPU] --checkpoint CHECKPOINT --dict DICT [--beam_size BEAM_SIZE] [--penalty PENALTY] --result_file RESULT_FILE [--batch_size BATCH_SIZE] [--mode {attention,ctc_greedy_search,ctc_prefix_beam_search,attention_rescoring,attn_ctc,wfst_based_decoding}] [--ctc_weight CTC_WEIGHT] [--utt2dur UTT2DUR] [--decoding_chunk_size DECODING_CHUNK_SIZE] [--num_decoding_left_chunks NUM_DECODING_LEFT_CHUNKS] [--simulate_streaming] recognize.py: error: the following arguments are required: --wav_path cat: exp/teacher/conformer_base_warmup_25000/results/test/split1/00/text: No such file or directory cat: exp/teacher/conformer_base_warmup_25000/results/test/split1/00/decoding_time: No such file or directory awk: cmd. line:1: BEGIN{printf "%.4f\n",/36108.9} awk: cmd. line:1: ^ unterminated regexp average rtf= awk: cmd. line:1: BEGIN{printf "%.4f\n",/60} awk: cmd. line:1: ^ unterminated regexp time costs= exp/teacher/conformer_base_warmup_25000 exp/teacher/conformer_base_warmup_25000/results/test/attention_rescoring_16 attention_rescoring WER=Overall -> 0.00 % N=0 C=0 S=0 D=0 I=0
05-19
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值