From c40fe924ffa12e9ddf24a3e5fcdeb4fd58ab07eb Mon Sep 17 00:00:00 2001 From: dscripka Date: Thu, 22 Feb 2024 21:14:20 -0500 Subject: [PATCH] fixed bug in train.py when using longer training examples than normal [skip ci] --- openwakeword/train.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openwakeword/train.py b/openwakeword/train.py index 7e468bf..f564254 100755 --- a/openwakeword/train.py +++ b/openwakeword/train.py @@ -813,13 +813,13 @@ if __name__ == '__main__': # Create openwakeword model if args.train_model is True: F = openwakeword.utils.AudioFeatures(device='cpu') - input_shape = F.get_embedding_shape(config["total_length"]//16000) # training data is always 16 khz + input_shape = np.load(os.path.join(feature_save_dir, "positive_features_test.npy")).shape[1:] oww = Model(n_classes=1, input_shape=input_shape, model_type=config["model_type"], layer_dim=config["layer_size"], seconds_per_example=1280*input_shape[0]/16000) # Create data transform function for batch generation to handle differ clip lengths (todo: write tests for this) - def f(x, n=16): + def f(x, n=input_shape[0]): """Simple transformation function to ensure negative data is the appropriate shape for the model size""" if n > x.shape[1] or n < x.shape[1]: x = np.vstack(x)