-
Notifications
You must be signed in to change notification settings - Fork 16
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
9 changed files
with
160 additions
and
62 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,4 +1,4 @@ | ||
hydra-core | ||
hydra-core<1.1 | ||
joblib | ||
nnmnkwii >= 0.0.23 | ||
nnsvs | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
hydra-core<1.1 | ||
joblib | ||
nnmnkwii>=0.0.23 | ||
nnsvs | ||
numpy>=1.20 | ||
omegaconf | ||
scipy | ||
torch==1.7.1 | ||
tqdm | ||
utaupy>=1.10 | ||
pyyaml | ||
scikit-learn<0.24.0 |
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,29 @@ | ||
# @package _group_ | ||
|
||
out_dir: exp | ||
nepochs: 50 | ||
checkpoint_epoch_interval: 50 | ||
|
||
stream_wise_loss: false | ||
use_detect_anomaly: true | ||
|
||
optim: | ||
optimizer: | ||
name: Adam | ||
params: | ||
lr: 0.001 | ||
betas: [0.9, 0.999] | ||
weight_decay: 0.0 | ||
lr_scheduler: | ||
name: StepLR | ||
params: | ||
step_size: 2 | ||
gamma: 0.5 | ||
|
||
resume: | ||
checkpoint: | ||
load_optimizer: false | ||
|
||
cudnn: | ||
benchmark: false | ||
deterministic: true |
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,62 @@ | ||
#! /usr/bin/env python3 | ||
# coding: utf-8 | ||
# Copyright (c) 2020 oatsu | ||
""" | ||
nnsvsの学習時のログファイル train.log を読み取り、CSVに変換する。 | ||
グラフ生成はしたいがとりあえずExcelでつくる。 | ||
""" | ||
from glob import glob | ||
# from datetime import datetime | ||
# from pprint import pprint | ||
from os.path import basename, splitext | ||
|
||
from tqdm import tqdm | ||
|
||
|
||
def read_log(path_log): | ||
""" | ||
ログファイルを読み取って、結果を抽出して返す。 | ||
""" | ||
# ファイル読み取り | ||
with open(path_log, 'r') as fl: | ||
lines = fl.readlines() | ||
# lossの値を格納するリスト | ||
loss_train_no_dev = [] | ||
loss_dev = [] | ||
# lossの値を取得してリストに追加 | ||
for line in lines: | ||
if '[train_no_dev] [Epoch ' in line: | ||
loss_train_no_dev.append(line.split()[7]) | ||
elif '[dev] [Epoch ' in line: | ||
loss_dev.append(line.split()[7]) | ||
# 結果を返す | ||
return loss_train_no_dev, loss_dev | ||
|
||
|
||
def generate_csv(loss_train_no_dev, loss_dev, path_csv_out): | ||
""" | ||
loss_train_no_dev (list) | ||
loss_dev (list) | ||
""" | ||
epoch_number_list = (str(i+1) for i in range(len(loss_train_no_dev))) | ||
l_data = list(zip(epoch_number_list, loss_train_no_dev, loss_dev)) | ||
# 出力用の文字列にする | ||
s_csv = 'epoch, loss(train_no_dev), loss(dev)\n' | ||
s_csv += '\n'.join([','.join(v) for v in l_data]) | ||
with open(path_csv_out, 'w') as fc: | ||
fc.write(s_csv) | ||
|
||
|
||
def main(): | ||
path_log_dir = input('path_log_dir: ').strip('"') | ||
list_path_log = glob(f'{path_log_dir}/**/*.log', recursive=True) | ||
for i, path_log in enumerate(tqdm(list_path_log)): | ||
loss_train_no_dev, loss_dev = read_log(path_log) | ||
# datetime_now = datetime.now().strftime("%Y%m%d_%H%M%S") | ||
path_csv_out = f'{splitext(basename(path_log))[0]}_{i}.csv' | ||
generate_csv(loss_train_no_dev, loss_dev, path_csv_out) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() | ||
input('おわり') |
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