def test_build_model(self, gin_file): """Tests if Model builds properly and produces audio of correct shape. Args: gin_file: Name of gin_file to use. """ with gin.unlock_config(): gin.clear_config() gin.parse_config_file(gin_file) model = models.Autoencoder() controls = model.get_controls(self.inputs) self.assertIsInstance(controls, dict) # Confirm that model generates correctly sized audio. audio_gen_shape = controls['processor_group']['signal'].shape.as_list() self.assertEqual(audio_gen_shape, list(self.inputs['audio'].shape))
(add, ['noise/signal', 'harmonic/signal'])] processor_group = ddsp.processors.ProcessorGroup(dag=dag, name='processor_group') # Loss_functions spectral_loss = ddsp.losses.SpectralLoss(loss_type='L1', mag_weight=1.0, logmag_weight=1.0) with strategy.scope(): # Put it together in a model. model = models.Autoencoder(preprocessor=preprocessor, encoder=None, decoder=decoder, processor_group=processor_group, losses=[spectral_loss]) trainer = trainers.Trainer(model, strategy, learning_rate=1e-3) """## or [`gin`](https://github.com/google/gin-config)""" gin_string = """ import ddsp import ddsp.training # Preprocessor models.Autoencoder.preprocessor = @preprocessing.F0LoudnessPreprocessor() preprocessing.F0LoudnessPreprocessor.time_steps = 1000