File size: 1,049 Bytes
a35137b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
"""Script to preprocess and prepare data segments.

Example usage:
    python prepare_segments.py --config config/braintreebank_config.yaml --experiment sentence_onset
"""

import argparse
from omegaconf import OmegaConf

from barista.data.braintreebank_wrapper import BrainTreebankWrapper

if __name__ == "__main__":
    parser = argparse.ArgumentParser()

    parser.add_argument("--config", required=True, type=str, help="path to config for segmentation")
    parser.add_argument("--experiment", required=True, type=str, help="experiment to segment data for")
    
    args = parser.parse_args()

    print(f"Loading config: {args.config}")
    config = OmegaConf.load(args.config)

    ## Instantiating BrainTreebankWrapper will be default handle all preprocessing.
    ## If preprocessing is complete, then the dataset will be ready to use for training.
    config.experiment = args.experiment
    print(f"Segmenting data for experiment {args.experiment}")
    braintreebank_wrapper = BrainTreebankWrapper(config, only_segment_generation=True)