forked from santi-pdp/segan_pytorch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:santi-pdp/segan_pytorch
- Loading branch information
Showing
10 changed files
with
195 additions
and
40 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
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,92 @@ | ||
{ | ||
"save_path": "ckpt_segan+", | ||
"d_pretrained_ckpt": null, | ||
"g_pretrained_ckpt": null, | ||
"cache_dir": "data_tmp", | ||
"clean_trainset": "data_veu4/expanded_segan1_additive/clean_trainset", | ||
"noisy_trainset": "data_veu4/expanded_segan1_additive/noisy_trainset", | ||
"clean_valset": null, | ||
"noisy_valset": null, | ||
"h5_data_root": null, | ||
"h5": false, | ||
"data_stride": 0.5, | ||
"seed": 111, | ||
"epoch": 100, | ||
"patience": 100, | ||
"batch_size": 300, | ||
"save_freq": 50, | ||
"slice_size": 16384, | ||
"opt": "rmsprop", | ||
"l1_dec_epoch": 100, | ||
"l1_weight": 100, | ||
"l1_dec_step": 1e-05, | ||
"g_lr": 5e-05, | ||
"d_lr": 5e-05, | ||
"preemph": 0.95, | ||
"max_samples": null, | ||
"eval_workers": 2, | ||
"slice_workers": 1, | ||
"num_workers": 3, | ||
"no_cuda": false, | ||
"random_scale": [ | ||
1 | ||
], | ||
"no_train_gen": true, | ||
"preemph_norm": false, | ||
"wsegan": false, | ||
"aewsegan": false, | ||
"vanilla_gan": false, | ||
"no_bias": false, | ||
"n_fft": 2048, | ||
"l1_loss": false, | ||
"skip_merge": "concat", | ||
"skip_type": "alpha", | ||
"skip_init": "one", | ||
"skip_kwidth": 11, | ||
"gkwidth": 31, | ||
"genc_fmaps": [ | ||
64, | ||
128, | ||
256, | ||
512, | ||
1024 | ||
], | ||
"genc_poolings": [ | ||
4, | ||
4, | ||
4, | ||
4, | ||
4 | ||
], | ||
"z_dim": 1024, | ||
"gdec_fmaps": null, | ||
"gdec_poolings": null, | ||
"gdec_kwidth": null, | ||
"gnorm_type": null, | ||
"no_z": false, | ||
"no_skip": false, | ||
"pow_weight": 0.001, | ||
"misalign_pair": false, | ||
"interf_pair": false, | ||
"denc_fmaps": [ | ||
64, | ||
128, | ||
256, | ||
512, | ||
1024 | ||
], | ||
"dpool_type": "none", | ||
"dpool_slen": 16, | ||
"dkwidth": null, | ||
"denc_poolings": [ | ||
4, | ||
4, | ||
4, | ||
4, | ||
4 | ||
], | ||
"dnorm_type": "bnorm", | ||
"phase_shift": 5, | ||
"sinc_conv": false, | ||
"bias": 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
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,36 @@ | ||
import argparse | ||
import json | ||
import glob | ||
import os | ||
|
||
|
||
def clean(opts): | ||
logs = glob.glob(os.path.join(opts.ckpt_dir, '*checkpoint*')) | ||
print(logs) | ||
for log in logs: | ||
with open(log, 'r') as log_f: | ||
log_ = json.load(log_f) | ||
# first assertive check that all files exist, no mismatch | ||
# b/w log and filenames existence | ||
for fname in log_['latest']: | ||
fpath = os.path.join(opts.ckpt_dir, 'weights_' + fname) | ||
assert os.path.exists(fpath), fpath | ||
to_rm = [l for l in log_['latest'][:-1] if l != log_['current']] | ||
to_kp = log_['latest'][-1] | ||
for fname in to_rm: | ||
fpath = os.path.join(opts.ckpt_dir, 'weights_' + fname) | ||
os.unlink(fpath) | ||
print('Removed file ', fpath) | ||
print('Kept file ', os.path.join(opts.ckpt_dir, 'weights_' + \ | ||
to_kp)) | ||
# re-write log | ||
with open(log, 'w') as log_f: | ||
log_['latest'] = [log_['latest'][-1]] | ||
log_f.write(json.dumps(log_, indent=2)) | ||
|
||
if __name__ == '__main__': | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument('ckpt_dir', type=str, default=None) | ||
opts = parser.parse_args() | ||
|
||
clean(opts) |
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.