def factory()

in src/speech_reps/featurize.py [0:0]


    def factory(cls, args):

        params_file = None
        if args.params:
            params_file = Path(args.params)

        if args.model == 'decoar':
            featurizer = DeCoARFeaturizer(params_file, args.gpu)
        elif args.model == 'decoar2':
            featurizer = DeCoAR2Featurizer(params_file, args.gpu)
        elif args.model.startswith('bertphone'):
            featurizer = BertPhoneFeaturizer(params_file, args.gpu)


        if args.in_wav and args.out_npy:
            in_wav = Path(args.in_wav)
            out_npy = Path(args.out_npy)
            featurizer.wav_to_npy(in_wav, out_npy)
        else:
            raise ValueError("--in-wav, --out-npy must both be in use")