Path: blob/master/tensorflow_tts/models/base_model.py
1558 views
# -*- coding: utf-8 -*-1# Copyright 2020 TensorFlowTTS Team.2#3# Licensed under the Apache License, Version 2.0 (the "License");4# you may not use this file except in compliance with the License.5# You may obtain a copy of the License at6#7# http://www.apache.org/licenses/LICENSE-2.08#9# Unless required by applicable law or agreed to in writing, software10# distributed under the License is distributed on an "AS IS" BASIS,11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.12# See the License for the specific language governing permissions and13# limitations under the License.14"""Base Model for all model."""1516import tensorflow as tf17import yaml18import os19import numpy as np2021from tensorflow_tts.utils.utils import MODEL_FILE_NAME, CONFIG_FILE_NAME222324class BaseModel(tf.keras.Model):25def set_config(self, config):26self.config = config2728def save_pretrained(self, saved_path):29"""Save config and weights to file"""30os.makedirs(saved_path, exist_ok=True)31self.config.save_pretrained(saved_path)32self.save_weights(os.path.join(saved_path, MODEL_FILE_NAME))333435