mattricesound commited on
Commit
f0e35fe
1 Parent(s): 6c005f0
Files changed (2) hide show
  1. README.md +3 -3
  2. eval.sh +30 -33
README.md CHANGED
@@ -58,14 +58,14 @@ You can also create a custom experiment by creating a new experiment file in `cf
58
  At the end of training, the train script will automatically evaluate the test set using the best checkpoint (by validation loss). If epoch 0 is not finished, it will throw an error. To evaluate a specific checkpoint, run
59
 
60
  ```
61
- python scripts/test.py +exp={experiment_name} +ckpt_path={path/to/checkpoint} render_files=False
62
  ```
63
 
64
  The checkpoints will be saved in `./logs/ckpts/{timestamp}`
65
  Metrics and hyperparams will be logged in `./lightning_logs/{timestamp}`
66
 
67
  By default, the dataset needed for the experiment is generated before training.
68
- If you have generated the dataset separately (see Generate datasets used in the paper), be sure to set `render_files=False` in the config or command-line, and set `render_root={path_to_dataset}` if it is in a custom location.
69
 
70
  Also note that the training assumes you have a GPU. To train on CPU, set `accelerator=null` in the config or command-line.
71
 
@@ -119,7 +119,7 @@ python scripts/generate_dataset.py +exp=chorus_aug
119
  See the Misc. section below for a description of the parameters.
120
  By default, files are rendered to `{render_root} / processed / {string_of_effects} / {train|val|test}`.
121
 
122
- If training, this process will be done automatically at the start of training. To disable this, set `render_files=False` in the config or command-line, and set `render_root={path_to_dataset}` if it is in a custom location.
123
 
124
  # Misc.
125
  ## Experimental parameters
 
58
  At the end of training, the train script will automatically evaluate the test set using the best checkpoint (by validation loss). If epoch 0 is not finished, it will throw an error. To evaluate a specific checkpoint, run
59
 
60
  ```
61
+ python scripts/test.py +exp={experiment_name} +ckpt_path="{path/to/checkpoint}" render_files=False
62
  ```
63
 
64
  The checkpoints will be saved in `./logs/ckpts/{timestamp}`
65
  Metrics and hyperparams will be logged in `./lightning_logs/{timestamp}`
66
 
67
  By default, the dataset needed for the experiment is generated before training.
68
+ If you have generated the dataset separately (see Generate datasets used in the paper), be sure to set `render_files=False` in the config or command-line, and set `render_root={path/to/dataset}` if it is in a custom location.
69
 
70
  Also note that the training assumes you have a GPU. To train on CPU, set `accelerator=null` in the config or command-line.
71
 
 
119
  See the Misc. section below for a description of the parameters.
120
  By default, files are rendered to `{render_root} / processed / {string_of_effects} / {train|val|test}`.
121
 
122
+ If training, this process will be done automatically at the start of training. To disable this, set `render_files=False` in the config or command-line, and set `render_root={path/to/dataset}` if it is in a custom location.
123
 
124
  # Misc.
125
  ## Experimental parameters
eval.sh CHANGED
@@ -5,47 +5,44 @@
5
  # ./eval.sh distortion_aug 0-0 -ckpt logs/ckpts/2023-01-21-12-21-44
6
  # First 2 arguments are required, third argument is optional
7
 
8
- # Check if first argument is empty
9
- if [ -z "$1" ]
10
- then
11
- echo "No experiment name supplied"
12
- exit 1
 
 
 
 
 
 
 
13
  fi
14
 
15
- # Check if second argument is empty
16
- if [ -z "$2" ]
17
- then
18
- echo "No dataset name supplied"
19
- exit 1
20
- fi
21
  dataset_name=$2
22
 
23
- # Check if ckpt flag is set using getopts
24
- ckpt_flag=0
25
- while getopts ":ckpt:" opt; do
26
- case $opt in
27
- ckpt)
28
- ckpt_flag=1
29
- ckpt_path=$OPTARG
30
- ;;
31
- \?)
32
- echo "Invalid option: -$OPTARG" >&3
33
- ;;
34
- esac
35
- done
36
-
37
- # If checkpoint flag is empty, run chain inference
38
- if [ $ckpt_flag -eq 0 ]
39
- then
40
- # Running chain inference
41
- echo "Running chain inference"
42
- python scripts/chain_inference.py +exp=$1 datamodule.train_dataset=None datamodule.val_dataset=None datamodule.test_dataset.render_root=./RemFX_eval_datasets/ render_files=False num_removed_effects=[${dataset_name:0:1},${dataset_name:2:1}]
43
- exit 1
44
  fi
45
 
 
46
  # Otherwise run inference on the specified checkpoint
47
  echo "Running monolithic inference on checkpoint $3"
48
- python scripts/test.py +exp=$1 datamodule.train_dataset=None datamodule.val_dataset=None datamodule.test_dataset.render_root=./RemFX_eval_datasets/ datamodule.test_dataset.num_kept_effects="[0,0]" num_removed_effects=[${dataset_name:0:1},${dataset_name:2:1}] effects_to_keep=[] effects_to_remove="[compressor,reverb,chorus,delay,distortion]" render_files=False +ckpt_path=$2
49
 
50
 
51
 
 
5
  # ./eval.sh distortion_aug 0-0 -ckpt logs/ckpts/2023-01-21-12-21-44
6
  # First 2 arguments are required, third argument is optional
7
 
8
+ # Default value for the optional parameter
9
+ ckpt_path=""
10
+
11
+ # Function to display script usage
12
+ function display_usage {
13
+ echo "Usage: $0 <experiment> <dataset> [-ckpt {ckpt_path}]"
14
+ }
15
+
16
+ # Check if the number of arguments is less than 2 (minimum required)
17
+ if [ "$#" -lt 2 ]; then
18
+ display_usage
19
+ exit 1
20
  fi
21
 
 
 
 
 
 
 
22
  dataset_name=$2
23
 
24
+ # Parse optional parameter if provided
25
+ if [ "$3" == "-ckpt" ]; then
26
+ # Check if the ckpt_path is provided
27
+ if [ -z "$4" ]; then
28
+ echo "Error: -ckpt flag requires a path argument."
29
+ display_usage
30
+ exit 1
31
+ fi
32
+ ckpt_path="$4"
33
+ fi
34
+
35
+ # If ckpt_path is empty, run chain inference
36
+ if [ -z "$ckpt_path" ]; then
37
+ echo "Running chain inference"
38
+ python scripts/chain_inference.py +exp=$1 datamodule.train_dataset=None datamodule.val_dataset=None datamodule.test_dataset.render_root=./RemFX_eval_datasets/ render_files=False num_removed_effects=[${dataset_name:0:1},${dataset_name:2:1}]
39
+ exit 1
 
 
 
 
 
40
  fi
41
 
42
+
43
  # Otherwise run inference on the specified checkpoint
44
  echo "Running monolithic inference on checkpoint $3"
45
+ python scripts/test.py +exp=$1 datamodule.train_dataset=None datamodule.val_dataset=None datamodule.test_dataset.render_root=./RemFX_eval_datasets/ datamodule.test_dataset.num_kept_effects="[0,0]" num_removed_effects=[${dataset_name:0:1},${dataset_name:2:1}] effects_to_keep=[] effects_to_remove="[distortion, compressor,reverb,chorus,delay]" render_files=False +ckpt_path=$ckpt_path
46
 
47
 
48