lt-tensor 0.0.1a28__py3-none-any.whl → 0.0.1a30__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- lt_tensor/model_base.py +36 -12
- lt_tensor/processors/audio.py +0 -8
- {lt_tensor-0.0.1a28.dist-info → lt_tensor-0.0.1a30.dist-info}/METADATA +1 -1
- {lt_tensor-0.0.1a28.dist-info → lt_tensor-0.0.1a30.dist-info}/RECORD +7 -7
- {lt_tensor-0.0.1a28.dist-info → lt_tensor-0.0.1a30.dist-info}/WHEEL +0 -0
- {lt_tensor-0.0.1a28.dist-info → lt_tensor-0.0.1a30.dist-info}/licenses/LICENSE +0 -0
- {lt_tensor-0.0.1a28.dist-info → lt_tensor-0.0.1a30.dist-info}/top_level.txt +0 -0
lt_tensor/model_base.py
CHANGED
@@ -70,6 +70,7 @@ class LossTracker:
|
|
70
70
|
|
71
71
|
class _Devices_Base(nn.Module):
|
72
72
|
_device: torch.device = ROOT_DEVICE
|
73
|
+
_setting_device: bool = False
|
73
74
|
|
74
75
|
@property
|
75
76
|
def device(self):
|
@@ -136,17 +137,35 @@ class _Devices_Base(nn.Module):
|
|
136
137
|
f"Item '{module_or_name}' is not a valid module, parameter or tensor."
|
137
138
|
)
|
138
139
|
|
139
|
-
def
|
140
|
-
"""
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
140
|
+
def apply_device(self):
|
141
|
+
"""Helps to apply devices towards all the internal components"""
|
142
|
+
if self._setting_device:
|
143
|
+
return
|
144
|
+
|
145
|
+
self._setting_device = True
|
146
|
+
|
147
|
+
try:
|
148
|
+
for modules in self.modules():
|
149
|
+
try:
|
150
|
+
modules.to(self.device)
|
151
|
+
except:
|
152
|
+
pass
|
153
|
+
|
154
|
+
for buffer in self.buffers():
|
155
|
+
try:
|
156
|
+
buffer.to(self.device)
|
157
|
+
except:
|
158
|
+
pass
|
159
|
+
|
160
|
+
for tensor in self.parameters():
|
161
|
+
try:
|
162
|
+
tensor.to(self.device)
|
163
|
+
except:
|
164
|
+
pass
|
165
|
+
except:
|
166
|
+
pass
|
167
|
+
finally:
|
168
|
+
self._setting_device = False
|
150
169
|
|
151
170
|
def _to_dvc(
|
152
171
|
self, device_name: str, device_id: Optional[Union[int, torch.device]] = None
|
@@ -158,7 +177,11 @@ class _Devices_Base(nn.Module):
|
|
158
177
|
elif hasattr(device_id, "index"):
|
159
178
|
device += ":" + str(device_id.index)
|
160
179
|
self.device = device
|
161
|
-
self.
|
180
|
+
if not self._setting_device:
|
181
|
+
self.apply_device()
|
182
|
+
|
183
|
+
def _to(self, *args, **kwargs):
|
184
|
+
self.to(*args, _internal=True, **kwargs)
|
162
185
|
|
163
186
|
def to(self, *args, **kwargs):
|
164
187
|
device, dtype, non_blocking, convert_to_format = torch._C._nn._parse_to(
|
@@ -370,6 +393,7 @@ class Model(_Devices_Base, ABC):
|
|
370
393
|
state_dict = self.state_dict()
|
371
394
|
if not save_with_adapters or isinstance(self.low_rank_adapter, nn.Identity):
|
372
395
|
state_dict.pop("low_rank_adapter", None)
|
396
|
+
state_dict.pop("_setting_device", None)
|
373
397
|
torch.save(obj=state_dict, f=str(model_dir))
|
374
398
|
|
375
399
|
def save_lora(
|
lt_tensor/processors/audio.py
CHANGED
@@ -119,14 +119,6 @@ class AudioProcessor(Model):
|
|
119
119
|
(torch.hann_window(self.cfg.win_length) if window is None else window),
|
120
120
|
)
|
121
121
|
|
122
|
-
def _apply_device(self):
|
123
|
-
self._mel_spec.to(device=self.device)
|
124
|
-
self.mel_rscale.to(device=self.device)
|
125
|
-
try:
|
126
|
-
self.window.to(device=self.device)
|
127
|
-
except:
|
128
|
-
pass
|
129
|
-
|
130
122
|
def from_numpy(
|
131
123
|
self,
|
132
124
|
array: np.ndarray,
|
@@ -4,7 +4,7 @@ lt_tensor/losses.py,sha256=zvkCOnE5XpF3v6ymivRIdqPTsMM5zc94ZMom7YDi3zM,4946
|
|
4
4
|
lt_tensor/lr_schedulers.py,sha256=LSZzqrOOLzSthD8k-W4cYPJt0vCjmHkiJkLr5e3yRTE,3659
|
5
5
|
lt_tensor/math_ops.py,sha256=TkD4WQG42KsQ9Fg7FXOjf8f-ixtW0apf2XjaooecVx4,2257
|
6
6
|
lt_tensor/misc_utils.py,sha256=N2r3UmxC4RM2BZBQhpjDZ_BKLrzsyIlKzopTzJbnjFU,28962
|
7
|
-
lt_tensor/model_base.py,sha256=
|
7
|
+
lt_tensor/model_base.py,sha256=5T4dbAh4MXbQmPRpihGtMYwTY8sJTQOhY6An3VboM58,18086
|
8
8
|
lt_tensor/monotonic_align.py,sha256=LhBd8p1xdBzg6jQrQX1j7b4PNeYGwIqM24zcU-pHOLE,2239
|
9
9
|
lt_tensor/noise_tools.py,sha256=wFeAsHhLhSlEc5XU5LbFKaXoHeVxrWjiMeljjGdIKyM,11363
|
10
10
|
lt_tensor/torch_commons.py,sha256=8l0bxmrAzwvyqjivCIVISXlbvKarlg4DdE0BOGSnMuQ,812
|
@@ -29,9 +29,9 @@ lt_tensor/model_zoo/audio_models/istft/__init__.py,sha256=ltIuD9t1gmS3bTmCqZIwJH
|
|
29
29
|
lt_tensor/model_zoo/losses/__init__.py,sha256=B9RAUxBiOZwooztnij1oLeRwZ7_MjnN3mPoum7saD6s,59
|
30
30
|
lt_tensor/model_zoo/losses/discriminators.py,sha256=yYh7HzRTUtr0RVTG7cWpcYsJZsRCz6yzg6Loq8FtyOk,20405
|
31
31
|
lt_tensor/processors/__init__.py,sha256=Pvxhh0KR65zLCgUd53_k5Z0y5JWWcO0ZBXFK9rv0o5w,109
|
32
|
-
lt_tensor/processors/audio.py,sha256=
|
33
|
-
lt_tensor-0.0.
|
34
|
-
lt_tensor-0.0.
|
35
|
-
lt_tensor-0.0.
|
36
|
-
lt_tensor-0.0.
|
37
|
-
lt_tensor-0.0.
|
32
|
+
lt_tensor/processors/audio.py,sha256=1JuxxexfUsXkLjVjWUk-oTRU-QNnCCwvKX3eP0m7LGE,16452
|
33
|
+
lt_tensor-0.0.1a30.dist-info/licenses/LICENSE,sha256=tQHc38scHOba4kDBNG4U0U6PpObaloiZG-FvKSgv2b0,11336
|
34
|
+
lt_tensor-0.0.1a30.dist-info/METADATA,sha256=73mjJFbTkXB3ouVxTkDOwQRPcSM78orTlB5ix-U0D-w,1062
|
35
|
+
lt_tensor-0.0.1a30.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
36
|
+
lt_tensor-0.0.1a30.dist-info/top_level.txt,sha256=35FuhFeXnUyvHWdbVHGPh0hS8euofafnJ_GJAVSF4Kk,10
|
37
|
+
lt_tensor-0.0.1a30.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|