Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
TensorSpeech
GitHub Repository: TensorSpeech/TensorFlowTTS
Path: blob/master/tensorflow_tts/configs/base_config.py
1558 views
1
# -*- coding: utf-8 -*-
2
# Copyright 2020 TensorFlowTTS Team.
3
#
4
# Licensed under the Apache License, Version 2.0 (the "License");
5
# you may not use this file except in compliance with the License.
6
# You may obtain a copy of the License at
7
#
8
# http://www.apache.org/licenses/LICENSE-2.0
9
#
10
# Unless required by applicable law or agreed to in writing, software
11
# distributed under the License is distributed on an "AS IS" BASIS,
12
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
# See the License for the specific language governing permissions and
14
# limitations under the License.
15
"""Base Config for all config."""
16
17
import abc
18
import yaml
19
import os
20
21
from tensorflow_tts.utils.utils import CONFIG_FILE_NAME
22
23
24
class BaseConfig(abc.ABC):
25
def set_config_params(self, config_params):
26
self.config_params = config_params
27
28
def save_pretrained(self, saved_path):
29
"""Save config to file"""
30
os.makedirs(saved_path, exist_ok=True)
31
with open(os.path.join(saved_path, CONFIG_FILE_NAME), "w") as file:
32
yaml.dump(self.config_params, file, Dumper=yaml.Dumper)
33
34