DeepLearning101 commited on
Commit
430d145
1 Parent(s): f23907c

Create utils.py

Browse files
Files changed (1) hide show
  1. utils.py +36 -0
utils.py ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ """
3
+ adjust hparams for torch.load sovits model. fork from shibing624/parrots
4
+ """
5
+
6
+
7
+ class HParams:
8
+ def __init__(self, **kwargs):
9
+ for k, v in kwargs.items():
10
+ if type(v) == dict:
11
+ v = HParams(**v)
12
+ self[k] = v
13
+
14
+ def keys(self):
15
+ return self.__dict__.keys()
16
+
17
+ def items(self):
18
+ return self.__dict__.items()
19
+
20
+ def values(self):
21
+ return self.__dict__.values()
22
+
23
+ def __len__(self):
24
+ return len(self.__dict__)
25
+
26
+ def __getitem__(self, key):
27
+ return getattr(self, key)
28
+
29
+ def __setitem__(self, key, value):
30
+ return setattr(self, key, value)
31
+
32
+ def __contains__(self, key):
33
+ return key in self.__dict__
34
+
35
+ def __repr__(self):
36
+ return self.__dict__.__repr__()