Spaces:
Sleeping
Sleeping
Commit
·
78820af
1
Parent(s):
ff526b3
Fix random crop length
Browse files- README.md +2 -1
- config.yaml +2 -1
- remfx/datasets.py +2 -0
- remfx/models.py +7 -3
- scripts/download_egfx.sh +1 -0
README.md
CHANGED
@@ -3,7 +3,8 @@
|
|
3 |
1. `python3 -m venv env`
|
4 |
2. `source env/bin/activate`
|
5 |
3. `pip install -e .`
|
6 |
-
4. `
|
|
|
7 |
|
8 |
## Download [GuitarFX Dataset] (https://zenodo.org/record/7044411/)
|
9 |
`./scripts/download_egfx.sh`
|
|
|
3 |
1. `python3 -m venv env`
|
4 |
2. `source env/bin/activate`
|
5 |
3. `pip install -e .`
|
6 |
+
4. `git submodule update --init --recursive`
|
7 |
+
5. `pip install -e umx`
|
8 |
|
9 |
## Download [GuitarFX Dataset] (https://zenodo.org/record/7044411/)
|
10 |
`./scripts/download_egfx.sh`
|
config.yaml
CHANGED
@@ -26,12 +26,13 @@ datamodule:
|
|
26 |
sample_rate: ${sample_rate}
|
27 |
root: ${oc.env:DATASET_ROOT}
|
28 |
length: ${length}
|
29 |
-
chunk_size_in_sec:
|
30 |
num_chunks: 10
|
31 |
val_split: 0.2
|
32 |
batch_size: 16
|
33 |
num_workers: 8
|
34 |
pin_memory: True
|
|
|
35 |
|
36 |
logger:
|
37 |
_target_: pytorch_lightning.loggers.WandbLogger
|
|
|
26 |
sample_rate: ${sample_rate}
|
27 |
root: ${oc.env:DATASET_ROOT}
|
28 |
length: ${length}
|
29 |
+
chunk_size_in_sec: 6
|
30 |
num_chunks: 10
|
31 |
val_split: 0.2
|
32 |
batch_size: 16
|
33 |
num_workers: 8
|
34 |
pin_memory: True
|
35 |
+
persistent_workers: True
|
36 |
|
37 |
logger:
|
38 |
_target_: pytorch_lightning.loggers.WandbLogger
|
remfx/datasets.py
CHANGED
@@ -88,6 +88,8 @@ def create_random_chunks(
|
|
88 |
"""
|
89 |
audio, sr = torchaudio.load(audio_file)
|
90 |
chunk_size_in_samples = chunk_size * sr
|
|
|
|
|
91 |
chunks = []
|
92 |
for i in range(num_chunks):
|
93 |
start = torch.randint(0, audio.shape[-1] - chunk_size_in_samples, (1,)).item()
|
|
|
88 |
"""
|
89 |
audio, sr = torchaudio.load(audio_file)
|
90 |
chunk_size_in_samples = chunk_size * sr
|
91 |
+
if chunk_size_in_samples >= audio.shape[-1]:
|
92 |
+
chunk_size_in_samples = audio.shape[-1] - 1
|
93 |
chunks = []
|
94 |
for i in range(num_chunks):
|
95 |
start = torch.randint(0, audio.shape[-1] - chunk_size_in_samples, (1,)).item()
|
remfx/models.py
CHANGED
@@ -73,6 +73,7 @@ class RemFXModel(pl.LightningModule):
|
|
73 |
on_epoch=True,
|
74 |
logger=True,
|
75 |
prog_bar=True,
|
|
|
76 |
)
|
77 |
|
78 |
return loss
|
@@ -83,18 +84,21 @@ class RemFXModel(pl.LightningModule):
|
|
83 |
def on_validation_batch_start(self, batch, batch_idx, dataloader_idx):
|
84 |
if self.log_next:
|
85 |
x, target, label = batch
|
86 |
-
|
|
|
|
|
87 |
|
88 |
# Concat samples together for easier viewing in dashboard
|
89 |
-
concat_samples = torch.cat([
|
90 |
log_wandb_audio_batch(
|
91 |
logger=self.logger,
|
92 |
-
id="
|
93 |
samples=concat_samples.cpu(),
|
94 |
sampling_rate=self.sample_rate,
|
95 |
caption=f"Epoch {self.current_epoch}",
|
96 |
)
|
97 |
self.log_next = False
|
|
|
98 |
|
99 |
|
100 |
class OpenUnmixModel(torch.nn.Module):
|
|
|
73 |
on_epoch=True,
|
74 |
logger=True,
|
75 |
prog_bar=True,
|
76 |
+
sync_dist=True,
|
77 |
)
|
78 |
|
79 |
return loss
|
|
|
84 |
def on_validation_batch_start(self, batch, batch_idx, dataloader_idx):
|
85 |
if self.log_next:
|
86 |
x, target, label = batch
|
87 |
+
self.model.eval()
|
88 |
+
with torch.no_grad():
|
89 |
+
y = self.model.sample(x)
|
90 |
|
91 |
# Concat samples together for easier viewing in dashboard
|
92 |
+
concat_samples = torch.cat([y, x, target], dim=-1)
|
93 |
log_wandb_audio_batch(
|
94 |
logger=self.logger,
|
95 |
+
id="prediction_input_target",
|
96 |
samples=concat_samples.cpu(),
|
97 |
sampling_rate=self.sample_rate,
|
98 |
caption=f"Epoch {self.current_epoch}",
|
99 |
)
|
100 |
self.log_next = False
|
101 |
+
self.model.train()
|
102 |
|
103 |
|
104 |
class OpenUnmixModel(torch.nn.Module):
|
scripts/download_egfx.sh
CHANGED
@@ -17,5 +17,6 @@ wget https://zenodo.org/record/7044411/files/Sweep-Echo.zip?download=1 -O Sweep-
|
|
17 |
wget https://zenodo.org/record/7044411/files/TapeEcho.zip?download=1 -O TapeEcho.zip
|
18 |
wget https://zenodo.org/record/7044411/files/TubeScreamer.zip?download=1 -O TubeScreamer.zip
|
19 |
unzip -n \*.zip
|
|
|
20 |
|
21 |
|
|
|
17 |
wget https://zenodo.org/record/7044411/files/TapeEcho.zip?download=1 -O TapeEcho.zip
|
18 |
wget https://zenodo.org/record/7044411/files/TubeScreamer.zip?download=1 -O TubeScreamer.zip
|
19 |
unzip -n \*.zip
|
20 |
+
rm -rf *.zip
|
21 |
|
22 |
|