mirror of
https://github.com/modelscope/FunASR
synced 2025-09-15 14:48:36 +08:00
update
This commit is contained in:
parent
bc19499b48
commit
cb8b09e085
@ -26,9 +26,10 @@ class SpeechPreprocessSpeedPerturb(nn.Module):
|
|||||||
return waveform
|
return waveform
|
||||||
speed = random.choice(self.speed_perturb)
|
speed = random.choice(self.speed_perturb)
|
||||||
if speed != 1.0:
|
if speed != 1.0:
|
||||||
waveform, _ = torchaudio.sox_effects.apply_effects_tensor(
|
with torch.no_grad():
|
||||||
torch.tensor(waveform).view(1, -1), fs, [['speed', str(speed)], ['rate', str(fs)]])
|
waveform, _ = torchaudio.sox_effects.apply_effects_tensor(
|
||||||
waveform = waveform.view(-1)
|
torch.tensor(waveform).view(1, -1), fs, [['speed', str(speed)], ['rate', str(fs)]])
|
||||||
|
waveform = waveform.view(-1)
|
||||||
|
|
||||||
return waveform
|
return waveform
|
||||||
|
|
||||||
|
|||||||
@ -273,8 +273,9 @@ class Trainer:
|
|||||||
speed_stats["total_time"] = total_time
|
speed_stats["total_time"] = total_time
|
||||||
|
|
||||||
|
|
||||||
pbar.update(1)
|
|
||||||
if self.local_rank == 0:
|
if self.local_rank == 0:
|
||||||
|
pbar.update(1)
|
||||||
gpu_info = "GPU, memory: {:.3f} GB, " \
|
gpu_info = "GPU, memory: {:.3f} GB, " \
|
||||||
"{:.3f} GB, "\
|
"{:.3f} GB, "\
|
||||||
"{:.3f} GB, "\
|
"{:.3f} GB, "\
|
||||||
@ -290,6 +291,7 @@ class Trainer:
|
|||||||
f"(loss: {loss.detach().cpu().item():.3f}), "
|
f"(loss: {loss.detach().cpu().item():.3f}), "
|
||||||
f"{[(k, round(v.cpu().item(), 3)) for k, v in stats.items()]}"
|
f"{[(k, round(v.cpu().item(), 3)) for k, v in stats.items()]}"
|
||||||
f"{gpu_info}"
|
f"{gpu_info}"
|
||||||
|
f"rank: {self.local_rank}"
|
||||||
)
|
)
|
||||||
pbar.set_description(description)
|
pbar.set_description(description)
|
||||||
if self.writer:
|
if self.writer:
|
||||||
@ -344,14 +346,16 @@ class Trainer:
|
|||||||
loss = loss
|
loss = loss
|
||||||
time4 = time.perf_counter()
|
time4 = time.perf_counter()
|
||||||
|
|
||||||
pbar.update(1)
|
|
||||||
if self.local_rank == 0:
|
if self.local_rank == 0:
|
||||||
|
pbar.update(1)
|
||||||
description = (
|
description = (
|
||||||
f"validation epoch: {epoch}/{self.max_epoch}, "
|
f"validation epoch: {epoch}/{self.max_epoch}, "
|
||||||
f"step {batch_idx}/{len(self.dataloader_train)}, "
|
f"step {batch_idx}/{len(self.dataloader_train)}, "
|
||||||
f"{speed_stats}, "
|
f"{speed_stats}, "
|
||||||
f"(loss: {loss.detach().cpu().item():.3f}), "
|
f"(loss: {loss.detach().cpu().item():.3f}), "
|
||||||
f"{[(k, round(v.cpu().item(), 3)) for k, v in stats.items()]}"
|
f"{[(k, round(v.cpu().item(), 3)) for k, v in stats.items()]}"
|
||||||
|
f"rank: {self.local_rank}"
|
||||||
)
|
)
|
||||||
pbar.set_description(description)
|
pbar.set_description(description)
|
||||||
if self.writer:
|
if self.writer:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user