示例#1
0
    def take_action(self, parsed_args):
        encoder_architecture = RNNArchitecture(
            num_layers=parsed_args.num_layers,
            num_units=parsed_args.num_units,
            bidirectional=parsed_args.bidirectional_encoder,
            cell_type=parsed_args.cell)
        decoder_architecture = RNNArchitecture(
            num_layers=parsed_args.num_layers,
            num_units=parsed_args.num_units,
            bidirectional=parsed_args.bidirectional_decoder,
            cell_type=parsed_args.cell)

        wrapper = FrequencyAutoencoderWrapper()

        if not parsed_args.continue_training:
            wrapper.initialize_model(
                feature_shape=self.feature_shape,
                model_filename=self.model_filename,
                encoder_architecture=encoder_architecture,
                decoder_architecture=decoder_architecture,
                frequency_window_width=parsed_args.freq_window_width,
                frequency_window_overlap=parsed_args.freq_window_overlap)

        wrapper.train_model(
            model_filename=self.model_filename,
            record_files=self.record_files,
            feature_shape=self.feature_shape,
            num_instances=self.num_instances,
            num_epochs=parsed_args.num_epochs,
            batch_size=parsed_args.batch_size,
            checkpoints_to_keep=parsed_args.checkpoints_to_keep,
            learning_rate=parsed_args.learning_rate,
            keep_prob=parsed_args.keep_prob,
            encoder_noise=parsed_args.encoder_noise,
            decoder_feed_previous_prob=parsed_args.feed_previous_prob)
示例#2
0
    def take_action(self, parsed_args):
        encoder_architecture = RNNArchitecture(
            num_layers=parsed_args.num_layers,
            num_units=parsed_args.num_units,
            bidirectional=parsed_args.bidirectional_encoder,
            cell_type=parsed_args.cell)
        decoder_architecture = RNNArchitecture(
            num_layers=parsed_args.num_layers,
            num_units=parsed_args.num_units,
            bidirectional=parsed_args.bidirectional_decoder,
            cell_type=parsed_args.cell)

        wrapper = TimeAutoencoderWrapper()

        if not parsed_args.continue_training:
            wrapper.initialize_model(feature_shape=self.feature_shape,
                                     model_filename=self.model_filename,
                                     encoder_architecture=encoder_architecture,
                                     decoder_architecture=decoder_architecture,
                                     mask_silence=parsed_args.mask_silence)

        wrapper.train_model(
            model_filename=self.model_filename,
            record_files=self.record_files,
            feature_shape=self.feature_shape,
            num_instances=self.num_instances,
            num_epochs=parsed_args.num_epochs,
            batch_size=parsed_args.batch_size,
            learning_rate=parsed_args.learning_rate,
            keep_prob=parsed_args.keep_prob,
            encoder_noise=parsed_args.encoder_noise,
            decoder_feed_previous_prob=parsed_args.feed_previous_prob)