add requirements.txt, remove debug prints

This commit is contained in:
Paul Sajna
2023-05-13 20:00:55 -07:00
parent becbee637c
commit 3b640103bc
5 changed files with 29 additions and 16 deletions
+1
View File
@@ -2,3 +2,4 @@
*.wav
*.pt
*.pth
env/
+9 -3
View File
@@ -18,7 +18,13 @@ class MDXModel:
self.window = torch.hann_window(self.n_fft)
self.freq_pad = torch.zeros([1, self.dim_c, self.n_bins-self.dim_f, self.dim_t])
self.adjust = 1
self.ort_ = ort.InferenceSession("models/" + model_file)
self.ort_ = ort.InferenceSession(
"models/" + model_file,
providers=[
"CUDAExecutionProvider",
"CPUExecutionProvider"
]
)
self.model_run = lambda spek:self.ort_.run(None, {'input': spek})[0]
@@ -100,5 +106,5 @@ class ReverbHQ(MDXModel):
if __name__ == "__main__":
ReverbHQ().process("/mnt/8terra/tts/voice-conversion-sources/eyeofthetiger.wav", "/tmp/stem1.wav", "/tmp/stem2.wav")
#MDXNetMain().process("/tmp/Carly Rae Jepsen - Call Me Maybe [fWNaR-rxAic].webm", "stem1.wav", "stem2.wav")
#ReverbHQ().process("/mnt/8terra/tts/voice-conversion-sources/eyeofthetiger.wav", "/tmp/stem1.wav", "/tmp/stem2.wav")
MDXNetMain().process("/tmp/Carly Rae Jepsen - Call Me Maybe [fWNaR-rxAic].webm", "stem1.wav", "stem2.wav")
-2
View File
@@ -56,14 +56,12 @@ class VR_Arch:
self.primary_source = spec_utils.normalize(self.spec_to_wav(y_spec), self.is_normalization).T
if not self.model_samplerate == 44100:
self.primary_source = librosa.resample(self.primary_source.T, orig_sr=self.model_samplerate, target_sr=44100)
print(self.primary_source.shape)
torchaudio.save(primary_stem_path, torch.from_numpy(self.primary_source).float().T, 44100)
self.secondary_source = self.spec_to_wav(v_spec)
self.secondary_source = spec_utils.normalize(self.spec_to_wav(v_spec), self.is_normalization).T
if not self.model_samplerate == 44100:
self.secondary_source = librosa.resample(self.secondary_source.T, orig_sr=self.model_samplerate, target_sr=44100)
print(self.secondary_source.shape)
torchaudio.save(secondary_stem_path, torch.from_numpy(self.secondary_source).float().T, 44100)
torch.cuda.empty_cache()
+11 -11
View File
@@ -112,14 +112,14 @@ def normalize(wave, is_normalize=False):
"""Save output music files"""
maxv = np.abs(wave).max()
if maxv > 1.0:
print(f"\nNormalization Set {is_normalize}: Input above threshold for clipping. Max:{maxv}")
#print(f"\nNormalization Set {is_normalize}: Input above threshold for clipping. Max:{maxv}")
if is_normalize:
print(f"The result was normalized.")
# print(f"The result was normalized.")
wave /= maxv
else:
print(f"The result was not normalized.")
# print(f"The result was not normalized.")
else:
print(f"\nNormalization Set {is_normalize}: Input not above threshold for clipping. Max:{maxv}")
#print(f"\nNormalization Set {is_normalize}: Input not above threshold for clipping. Max:{maxv}")
return wave
@@ -130,20 +130,20 @@ def normalize_two_stem(wave, mix, is_normalize=False):
max_mix = np.abs(mix).max()
if maxv > 1.0:
print(f"\nNormalization Set {is_normalize}: Primary source above threshold for clipping. Max:{maxv}")
print(f"\nNormalization Set {is_normalize}: Mixture above threshold for clipping. Max:{max_mix}")
#print(f"\nNormalization Set {is_normalize}: Primary source above threshold for clipping. Max:{maxv}")
#print(f"\nNormalization Set {is_normalize}: Mixture above threshold for clipping. Max:{max_mix}")
if is_normalize:
print(f"The result was normalized.")
#print(f"The result was normalized.")
wave /= maxv
mix /= maxv
else:
print(f"The result was not normalized.")
#print(f"The result was not normalized.")
else:
print(f"\nNormalization Set {is_normalize}: Input not above threshold for clipping. Max:{maxv}")
#print(f"\nNormalization Set {is_normalize}: Input not above threshold for clipping. Max:{maxv}")
print(f"\nNormalization Set {is_normalize}: Primary source - Max:{np.abs(wave).max()}")
print(f"\nNormalization Set {is_normalize}: Mixture - Max:{np.abs(mix).max()}")
#print(f"\nNormalization Set {is_normalize}: Primary source - Max:{np.abs(wave).max()}")
#print(f"\nNormalization Set {is_normalize}: Mixture - Max:{np.abs(mix).max()}")
return wave, mix
+8
View File
@@ -0,0 +1,8 @@
librosa==0.9.2
torch==2.0.1
torchaudio==2.0.2
onnxruntime-gpu==1.14.1
numpy==1.23.5
six==1.16.0
soundfile==0.12.1
samplerate==0.1.0