lt-tensor 0.0.1a40__tar.gz → 0.0.1a41__tar.gz

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.
Files changed (51) hide show
  1. {lt_tensor-0.0.1a40 → lt_tensor-0.0.1a41}/PKG-INFO +1 -1
  2. {lt_tensor-0.0.1a40 → lt_tensor-0.0.1a41}/lt_tensor/__init__.py +1 -1
  3. {lt_tensor-0.0.1a40 → lt_tensor-0.0.1a41}/lt_tensor/losses.py +6 -18
  4. lt_tensor-0.0.1a41/lt_tensor/model_zoo/audio_models/__init__.py +3 -0
  5. {lt_tensor-0.0.1a40 → lt_tensor-0.0.1a41}/lt_tensor/processors/audio.py +1 -63
  6. {lt_tensor-0.0.1a40 → lt_tensor-0.0.1a41}/lt_tensor.egg-info/PKG-INFO +1 -1
  7. {lt_tensor-0.0.1a40 → lt_tensor-0.0.1a41}/setup.py +1 -1
  8. lt_tensor-0.0.1a40/lt_tensor/model_zoo/audio_models/__init__.py +0 -3
  9. {lt_tensor-0.0.1a40 → lt_tensor-0.0.1a41}/LICENSE +0 -0
  10. {lt_tensor-0.0.1a40 → lt_tensor-0.0.1a41}/README.md +0 -0
  11. {lt_tensor-0.0.1a40 → lt_tensor-0.0.1a41}/lt_tensor/config_templates.py +0 -0
  12. {lt_tensor-0.0.1a40 → lt_tensor-0.0.1a41}/lt_tensor/lr_schedulers.py +0 -0
  13. {lt_tensor-0.0.1a40 → lt_tensor-0.0.1a41}/lt_tensor/math_ops.py +0 -0
  14. {lt_tensor-0.0.1a40 → lt_tensor-0.0.1a41}/lt_tensor/misc_utils.py +0 -0
  15. {lt_tensor-0.0.1a40 → lt_tensor-0.0.1a41}/lt_tensor/model_base.py +0 -0
  16. {lt_tensor-0.0.1a40 → lt_tensor-0.0.1a41}/lt_tensor/model_zoo/__init__.py +0 -0
  17. {lt_tensor-0.0.1a40 → lt_tensor-0.0.1a41}/lt_tensor/model_zoo/activations/__init__.py +0 -0
  18. {lt_tensor-0.0.1a40 → lt_tensor-0.0.1a41}/lt_tensor/model_zoo/activations/alias_free/__init__.py +0 -0
  19. {lt_tensor-0.0.1a40 → lt_tensor-0.0.1a41}/lt_tensor/model_zoo/activations/alias_free/act.py +0 -0
  20. {lt_tensor-0.0.1a40 → lt_tensor-0.0.1a41}/lt_tensor/model_zoo/activations/alias_free/filter.py +0 -0
  21. {lt_tensor-0.0.1a40 → lt_tensor-0.0.1a41}/lt_tensor/model_zoo/activations/alias_free/resample.py +0 -0
  22. {lt_tensor-0.0.1a40 → lt_tensor-0.0.1a41}/lt_tensor/model_zoo/activations/snake/__init__.py +0 -0
  23. {lt_tensor-0.0.1a40 → lt_tensor-0.0.1a41}/lt_tensor/model_zoo/audio_models/bemaganv2/__init__.py +0 -0
  24. {lt_tensor-0.0.1a40 → lt_tensor-0.0.1a41}/lt_tensor/model_zoo/audio_models/bigvgan/__init__.py +0 -0
  25. {lt_tensor-0.0.1a40 → lt_tensor-0.0.1a41}/lt_tensor/model_zoo/audio_models/diffwave/__init__.py +0 -0
  26. {lt_tensor-0.0.1a40 → lt_tensor-0.0.1a41}/lt_tensor/model_zoo/audio_models/hifigan/__init__.py +0 -0
  27. {lt_tensor-0.0.1a40 → lt_tensor-0.0.1a41}/lt_tensor/model_zoo/audio_models/istft/__init__.py +0 -0
  28. {lt_tensor-0.0.1a40 → lt_tensor-0.0.1a41}/lt_tensor/model_zoo/audio_models/resblocks.py +0 -0
  29. {lt_tensor-0.0.1a40 → lt_tensor-0.0.1a41}/lt_tensor/model_zoo/basic.py +0 -0
  30. {lt_tensor-0.0.1a40 → lt_tensor-0.0.1a41}/lt_tensor/model_zoo/convs.py +0 -0
  31. {lt_tensor-0.0.1a40 → lt_tensor-0.0.1a41}/lt_tensor/model_zoo/features.py +0 -0
  32. {lt_tensor-0.0.1a40 → lt_tensor-0.0.1a41}/lt_tensor/model_zoo/fusion.py +0 -0
  33. {lt_tensor-0.0.1a40 → lt_tensor-0.0.1a41}/lt_tensor/model_zoo/losses/CQT/__init__.py +0 -0
  34. {lt_tensor-0.0.1a40 → lt_tensor-0.0.1a41}/lt_tensor/model_zoo/losses/CQT/transforms.py +0 -0
  35. {lt_tensor-0.0.1a40 → lt_tensor-0.0.1a41}/lt_tensor/model_zoo/losses/CQT/utils.py +0 -0
  36. {lt_tensor-0.0.1a40 → lt_tensor-0.0.1a41}/lt_tensor/model_zoo/losses/__init__.py +0 -0
  37. {lt_tensor-0.0.1a40 → lt_tensor-0.0.1a41}/lt_tensor/model_zoo/losses/_envelope_disc/__init__.py +0 -0
  38. {lt_tensor-0.0.1a40 → lt_tensor-0.0.1a41}/lt_tensor/model_zoo/losses/discriminators.py +0 -0
  39. {lt_tensor-0.0.1a40 → lt_tensor-0.0.1a41}/lt_tensor/model_zoo/pos_encoder.py +0 -0
  40. {lt_tensor-0.0.1a40 → lt_tensor-0.0.1a41}/lt_tensor/model_zoo/residual.py +0 -0
  41. {lt_tensor-0.0.1a40 → lt_tensor-0.0.1a41}/lt_tensor/model_zoo/transformer.py +0 -0
  42. {lt_tensor-0.0.1a40 → lt_tensor-0.0.1a41}/lt_tensor/monotonic_align.py +0 -0
  43. {lt_tensor-0.0.1a40 → lt_tensor-0.0.1a41}/lt_tensor/noise_tools.py +0 -0
  44. {lt_tensor-0.0.1a40 → lt_tensor-0.0.1a41}/lt_tensor/processors/__init__.py +0 -0
  45. {lt_tensor-0.0.1a40 → lt_tensor-0.0.1a41}/lt_tensor/torch_commons.py +0 -0
  46. {lt_tensor-0.0.1a40 → lt_tensor-0.0.1a41}/lt_tensor/transform.py +0 -0
  47. {lt_tensor-0.0.1a40 → lt_tensor-0.0.1a41}/lt_tensor.egg-info/SOURCES.txt +0 -0
  48. {lt_tensor-0.0.1a40 → lt_tensor-0.0.1a41}/lt_tensor.egg-info/dependency_links.txt +0 -0
  49. {lt_tensor-0.0.1a40 → lt_tensor-0.0.1a41}/lt_tensor.egg-info/requires.txt +0 -0
  50. {lt_tensor-0.0.1a40 → lt_tensor-0.0.1a41}/lt_tensor.egg-info/top_level.txt +0 -0
  51. {lt_tensor-0.0.1a40 → lt_tensor-0.0.1a41}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lt-tensor
3
- Version: 0.0.1a40
3
+ Version: 0.0.1a41
4
4
  Summary: General utilities for PyTorch and others. Built for general use.
5
5
  Home-page: https://github.com/gr1336/lt-tensor/
6
6
  Author: gr1336
@@ -1,4 +1,4 @@
1
- __version__ = "0.0.1a40"
1
+ __version__ = "0.0.1a41"
2
2
 
3
3
  from . import (
4
4
  lr_schedulers,
@@ -140,7 +140,6 @@ class MultiMelScaleLoss(Model):
140
140
  onesided: Optional[bool] = None,
141
141
  std: int = 4,
142
142
  mean: int = -4,
143
- use_istft_norm: bool = True,
144
143
  use_pitch_loss: bool = True,
145
144
  use_rms_loss: bool = True,
146
145
  norm_pitch_fn: Callable[[Tensor], Tensor] = normalize_minmax,
@@ -165,7 +164,6 @@ class MultiMelScaleLoss(Model):
165
164
  self.loss_rms_fn = loss_rms_fn
166
165
  self.lambda_mel = lambda_mel
167
166
  self.weight = weight
168
- self.use_istft_norm = use_istft_norm
169
167
  self.use_pitch_loss = use_pitch_loss
170
168
  self.use_rms_loss = use_rms_loss
171
169
  self.lambda_pitch = lambda_pitch
@@ -251,36 +249,26 @@ class MultiMelScaleLoss(Model):
251
249
  def forward(
252
250
  self, input_wave: torch.Tensor, target_wave: torch.Tensor
253
251
  ) -> torch.Tensor:
254
- assert self.use_istft_norm or input_wave.shape[-1] == target_wave.shape[-1], (
255
- f"Size mismatch! input_wave {input_wave.shape[-1]} must match target_wave: {target_wave.shape[-1]}. "
256
- "Alternatively 'use_istft_norm' can be set to Trie with will automatically force the audio to that size."
257
- )
258
252
  target_wave = target_wave.to(input_wave.device)
259
253
  losses = 0.0
260
254
  for M in self.mel_spectrograms:
261
- if self.use_istft_norm and input_proc.shape[-1] != target_proc.shape[-1]:
262
- input_proc = M.istft_norm(input_wave, length=target_wave.shape[-1])
263
- target_proc = M.istft_norm(target_wave, length=target_wave.shape[-1])
264
- else:
265
- input_proc, target_proc = input_wave, target_wave
266
-
267
- x_mels = M(input_proc)
268
- y_mels = M(target_proc)
255
+ x_mels = M.compute_mel(input_wave)
256
+ y_mels = M.compute_mel(target_wave)
269
257
 
270
258
  loss = self.loss_mel_fn(x_mels.squeeze(), y_mels.squeeze())
271
259
  losses += loss * self.lambda_mel
272
260
 
273
261
  # pitch/f0 loss
274
262
  if self.use_pitch_loss:
275
- x_pitch = self.norm_pitch_fn(M.compute_pitch(input_proc))
276
- y_pitch = self.norm_pitch_fn(M.compute_pitch(target_proc))
263
+ x_pitch = self.norm_pitch_fn(M.compute_pitch(input_wave))
264
+ y_pitch = self.norm_pitch_fn(M.compute_pitch(target_wave))
277
265
  f0_loss = self.loss_pitch_fn(x_pitch, y_pitch)
278
266
  losses += f0_loss * self.lambda_pitch
279
267
 
280
268
  # energy/rms loss
281
269
  if self.use_rms_loss:
282
- x_rms = self.norm_rms(M.compute_rms(input_proc, x_mels))
283
- y_rms = self.norm_rms(M.compute_rms(target_proc, y_mels))
270
+ x_rms = self.norm_rms(M.compute_rms(input_wave, x_mels))
271
+ y_rms = self.norm_rms(M.compute_rms(target_wave, y_mels))
284
272
  rms_loss = self.loss_rms_fn(x_rms, y_rms)
285
273
  losses += rms_loss * self.lambda_rms
286
274
 
@@ -0,0 +1,3 @@
1
+ from . import diffwave, istft, hifigan, bigvgan, bemaganv2
2
+
3
+ __all__ = ["diffwave", "istft", "hifigan", "bigvgan", "bemaganv2"]
@@ -698,66 +698,4 @@ class AudioProcessor(Model):
698
698
  rms_batch_dim: bool = False,
699
699
  spec_phase_batch_dim: bool = False,
700
700
  ):
701
- results = {
702
- "wave": None,
703
- "mel": None,
704
- "pitch": None,
705
- "rms": None,
706
- "spec": None,
707
- "phase": None,
708
- }
709
- results["wave"] = (
710
- x.squeeze()
711
- if isinstance(x, Tensor)
712
- else self.load_audio(x, istft_norm=True).squeeze()
713
- )
714
- results["mel"] = self.compute_mel_librosa(
715
- wave=(
716
- results["wave"]
717
- if results["wave"].ndim == 3
718
- else results["wave"].unsqueeze(0)
719
- ),
720
- spectral_norm=spectral_norm,
721
- ).squeeze()
722
- try:
723
- results["pitch"] = self.compute_pitch(results["wave"]).squeeze()
724
- except Exception as e:
725
- results["pitch"] = e
726
- try:
727
- results["rms"] = self.compute_rms(results["wave"], results["mel"]).squeeze()
728
- except Exception as e:
729
- results["rms"] = e
730
- try:
731
- sp_ph = self.stft(results["wave"], return_complex=False)
732
- spec, phase = sp_ph.split(1, -1)
733
- results["spec"] = spec.squeeze()
734
- results["phase"] = phase.squeeze()
735
- except Exception as e:
736
- results["spec"] = e
737
- results["phase"] = e
738
-
739
- if (add_batch_to_all or wave_batch_dim) and results["wave"].ndim == 1:
740
- results["wave"] = results["wave"].unsqueeze(0)
741
- if (add_batch_to_all or mel_batch_dim) and results["mel"].ndim == 2:
742
- results["mel"] = results["mel"].unsqueeze(0)
743
- if (
744
- isinstance(results["rms"], Tensor)
745
- and (add_batch_to_all or rms_batch_dim)
746
- and results["rms"].ndim == 1
747
- ):
748
- results["rms"] = results["rms"].unsqueeze(0)
749
- if (
750
- isinstance(results["pitch"], Tensor)
751
- and (add_batch_to_all or pitch_batch_dim)
752
- and results["pitch"].ndim == 1
753
- ):
754
- results["pitch"] = results["pitch"].unsqueeze(0)
755
- if (
756
- isinstance(results["spec"], Tensor)
757
- and (add_batch_to_all or spec_phase_batch_dim)
758
- and results["spec"].ndim == 2
759
- ):
760
- results["spec"] = results["spec"].unsqueeze(0)
761
- results["phase"] = results["phase"].unsqueeze(0)
762
-
763
- return results
701
+ pass
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lt-tensor
3
- Version: 0.0.1a40
3
+ Version: 0.0.1a41
4
4
  Summary: General utilities for PyTorch and others. Built for general use.
5
5
  Home-page: https://github.com/gr1336/lt-tensor/
6
6
  Author: gr1336
@@ -4,7 +4,7 @@ with open("README.md", "r", encoding="utf-8") as f:
4
4
  long_description = f.read()
5
5
 
6
6
  setup(
7
- version="0.0.1a40",
7
+ version="0.0.1a41",
8
8
  name="lt-tensor",
9
9
  description="General utilities for PyTorch and others. Built for general use.",
10
10
  long_description=long_description,
@@ -1,3 +0,0 @@
1
- from . import diffwave, istft, hifigan, bigvgan
2
-
3
- __all__ = ["diffwave", "istft", "hifigan", "bigvgan"]
File without changes
File without changes
File without changes