aboutsummaryrefslogtreecommitdiffstats
path: root/look2hear
diff options
context:
space:
mode:
authorKai Li (李凯) <tsinghua.kaili@gmail.com>2025-01-07 23:46:46 +0800
committerKai Li (李凯) <tsinghua.kaili@gmail.com>2025-01-07 23:46:46 +0800
commitec25e5e4495b37d73097f786901dea083c35eefd (patch)
treec9446222b02479a60763f7e2015209d830296d39 /look2hear
parentbaf931c712257c3071dd9f2e868d8a0c4fd98663 (diff)
parent0130c633d3d126e76df9840d293d9dd5b78bddce (diff)
downloadapollo-gfx803-ec25e5e4495b37d73097f786901dea083c35eefd.tar.gz
Merge branch 'main' of https://github.com/JusperLee/Apollo
Diffstat (limited to 'look2hear')
-rw-r--r--look2hear/datas/musdb_moisesdb_datamodule.py4
-rw-r--r--look2hear/models/base_model.py4
-rw-r--r--look2hear/system/audio_litmodule.py1
3 files changed, 6 insertions, 3 deletions
diff --git a/look2hear/datas/musdb_moisesdb_datamodule.py b/look2hear/datas/musdb_moisesdb_datamodule.py
index ef3267e..85c9527 100644
--- a/look2hear/datas/musdb_moisesdb_datamodule.py
+++ b/look2hear/datas/musdb_moisesdb_datamodule.py
@@ -120,7 +120,7 @@ class MusdbMoisesdbDataset(Dataset):
start = random.randint(0, music_wav.shape[-1] - self.segments)
ori_wav = music_wav[:, start:start+self.segments]
- codec_wav = codec_simu(ori_wav, sr=self.sr, codec_type=self.codec_type, options=self.codec_options)
+ codec_wav = codec_simu(ori_wav, sr=self.sr, options=self.codec_options)
max_scale = max(ori_wav.abs().max(), codec_wav.abs().max())
@@ -212,4 +212,4 @@ class MusdbMoisesdbDataModule(LightningDataModule):
num_workers=self.hparams.num_workers,
shuffle=False,
pin_memory=True,
- ) \ No newline at end of file
+ )
diff --git a/look2hear/models/base_model.py b/look2hear/models/base_model.py
index 89b36ad..730194d 100644
--- a/look2hear/models/base_model.py
+++ b/look2hear/models/base_model.py
@@ -7,6 +7,8 @@
import torch
import torch.nn as nn
+from huggingface_hub import PyTorchModelHubMixin
+
def _unsqueeze_to_3d(x):
"""Normalize shape of `x` to [batch, n_chan, time]."""
@@ -32,7 +34,7 @@ def pad_to_appropriate_length(x, lcm):
return x
-class BaseModel(nn.Module):
+class BaseModel(nn.Module, PyTorchModelHubMixin, repo_url="https://github.com/JusperLee/Apollo", pipeline_tag="audio-to-audio"):
def __init__(self, sample_rate, in_chan=1):
super().__init__()
self._sample_rate = sample_rate
diff --git a/look2hear/system/audio_litmodule.py b/look2hear/system/audio_litmodule.py
index 8faa6df..5888485 100644
--- a/look2hear/system/audio_litmodule.py
+++ b/look2hear/system/audio_litmodule.py
@@ -158,6 +158,7 @@ class AudioLightningModule(pl.LightningModule):
)
self.validation_step_outputs.clear() # free memory
+ torch.cuda.empty_cache()
def test_step(self, batch, batch_nb):
mixtures, targets = batch