id int64 0 190k | prompt stringlengths 21 13.4M | docstring stringlengths 1 12k ⌀ |
|---|---|---|
17,506 | import re
from unidecode import unidecode
from .numbers import normalize_numbers
def expand_abbreviations(text):
for regex, replacement in _abbreviations:
text = re.sub(regex, replacement, text)
return text
def expand_numbers(text):
return normalize_numbers(text)
def lowercase(text):
return text... | Pipeline for English text, including number and abbreviation expansion. |
17,507 | from pathlib import Path
from typing import List, Tuple
import os
import numpy as np
import torch
from text.symbol_table import SymbolTable
from text import text_to_sequence
class TextTokenCollator:
def __init__(
self,
text_tokens: List[str],
add_eos: bool = True,
add_bos: bool = Tru... | null |
17,508 | import re
_alt_re = re.compile(r"\([0-9]+\)")
def _get_pronunciation(s):
parts = s.strip().split(" ")
for part in parts:
if part not in _valid_symbol_set:
return None
return " ".join(parts)
def _parse_cmudict(file):
cmudict = {}
for line in file:
if len(line) and (line[0... | null |
17,509 | import argparse
import torch
from models.vocoders.gan.gan_vocoder_trainer import GANVocoderTrainer
from models.vocoders.diffusion.diffusion_vocoder_trainer import DiffusionVocoderTrainer
from utils.util import load_config
class GANVocoderTrainer(VocoderTrainer):
def __init__(self, args, cfg):
super().__ini... | null |
17,510 | import argparse
import torch
from models.vocoders.gan.gan_vocoder_trainer import GANVocoderTrainer
from models.vocoders.diffusion.diffusion_vocoder_trainer import DiffusionVocoderTrainer
from utils.util import load_config
def cuda_relevant(deterministic=False):
torch.cuda.empty_cache()
# TF32 on Ampere and abo... | null |
17,511 | import argparse
import os
import torch
from models.vocoders.vocoder_inference import VocoderInference
from utils.util import load_config
class VocoderInference(object):
def __init__(self, args=None, cfg=None, infer_type="from_dataset"):
super().__init__()
start = time.monotonic_ns()
self.a... | null |
17,512 | import argparse
import os
import torch
from models.vocoders.vocoder_inference import VocoderInference
from utils.util import load_config
def cuda_relevant(deterministic=False):
torch.cuda.empty_cache()
# TF32 on Ampere and above
torch.backends.cuda.matmul.allow_tf32 = True
torch.backends.cudnn.enabled ... | null |
17,513 | import argparse
import os
import torch
from models.vocoders.vocoder_inference import VocoderInference
from utils.util import load_config
The provided code snippet includes necessary dependencies for implementing the `build_parser` function. Write a Python function `def build_parser()` to solve the following problem:
r... | r"""Build argument parser for inference.py. Anything else should be put in an extra config YAML file. |
17,514 | import faulthandler
import os
import argparse
import json
import pyworld as pw
from multiprocessing import cpu_count
from utils.util import load_config
from preprocessors.processor import preprocess_dataset, prepare_align
from preprocessors.metadata import cal_metadata
from processors import acoustic_extractor, content... | Proprocess raw data of single or multiple datasets (in cfg.dataset) Args: cfg (dict): dictionary that stores configurations args (ArgumentParser): specify the configuration file and num_workers |
17,515 | import argparse
import os
import torch
from models.tta.autoencoder.autoencoder_trainer import AutoencoderKLTrainer
from models.tta.ldm.audioldm_trainer import AudioLDMTrainer
from utils.util import load_config
class AutoencoderKLTrainer(BaseTrainer):
def __init__(self, args, cfg):
BaseTrainer.__init__(self... | null |
17,516 | import argparse
from argparse import ArgumentParser
import os
from models.tta.ldm.audioldm_inference import AudioLDMInference
from utils.util import save_config, load_model_config, load_config
import numpy as np
import torch
class AudioLDMInference:
def __init__(self, args, cfg):
def build_autoencoderkl(self... | null |
17,517 | import argparse
from argparse import ArgumentParser
import os
from models.tta.ldm.audioldm_inference import AudioLDMInference
from utils.util import save_config, load_model_config, load_config
import numpy as np
import torch
def build_parser():
parser = argparse.ArgumentParser()
parser.add_argument(
"... | null |
17,518 | import faulthandler
import os
import argparse
import json
import pyworld as pw
from multiprocessing import cpu_count
from utils.util import load_config
from preprocessors.processor import preprocess_dataset, prepare_align
from preprocessors.metadata import cal_metadata
from processors import acoustic_extractor, content... | Proprocess raw data of single or multiple datasets (in cfg.dataset) Args: cfg (dict): dictionary that stores configurations args (ArgumentParser): specify the configuration file and num_workers |
17,519 | import os
import sys
import numpy as np
import json
import argparse
import whisper
import torch
from glob import glob
from tqdm import tqdm
from collections import defaultdict
from evaluation.metrics.energy.energy_rmse import extract_energy_rmse
from evaluation.metrics.energy.energy_pearson_coefficients import (
ex... | null |
17,520 | import argparse
import torch
from models.svc.diffusion.diffusion_trainer import DiffusionTrainer
from models.svc.comosvc.comosvc_trainer import ComoSVCTrainer
from models.svc.transformer.transformer_trainer import TransformerTrainer
from models.svc.vits.vits_trainer import VitsSVCTrainer
from utils.util import load_con... | null |
17,521 | import argparse
import torch
from models.svc.diffusion.diffusion_trainer import DiffusionTrainer
from models.svc.comosvc.comosvc_trainer import ComoSVCTrainer
from models.svc.transformer.transformer_trainer import TransformerTrainer
from models.svc.vits.vits_trainer import VitsSVCTrainer
from utils.util import load_con... | null |
17,522 | import argparse
import os
import glob
from tqdm import tqdm
import json
import torch
import time
from models.svc.diffusion.diffusion_inference import DiffusionInference
from models.svc.comosvc.comosvc_inference import ComoSVCInference
from models.svc.transformer.transformer_inference import TransformerInference
from mo... | null |
17,523 | import argparse
import os
import glob
from tqdm import tqdm
import json
import torch
import time
from models.svc.diffusion.diffusion_inference import DiffusionInference
from models.svc.comosvc.comosvc_inference import ComoSVCInference
from models.svc.transformer.transformer_inference import TransformerInference
from mo... | null |
17,524 | import argparse
import os
import glob
from tqdm import tqdm
import json
import torch
import time
from models.svc.diffusion.diffusion_inference import DiffusionInference
from models.svc.comosvc.comosvc_inference import ComoSVCInference
from models.svc.transformer.transformer_inference import TransformerInference
from mo... | null |
17,525 | import argparse
import os
import glob
from tqdm import tqdm
import json
import torch
import time
from models.svc.diffusion.diffusion_inference import DiffusionInference
from models.svc.comosvc.comosvc_inference import ComoSVCInference
from models.svc.transformer.transformer_inference import TransformerInference
from mo... | null |
17,526 | import argparse
import os
import glob
from tqdm import tqdm
import json
import torch
import time
from models.svc.diffusion.diffusion_inference import DiffusionInference
from models.svc.comosvc.comosvc_inference import ComoSVCInference
from models.svc.transformer.transformer_inference import TransformerInference
from mo... | r"""Build argument parser for inference.py. Anything else should be put in an extra config YAML file. |
17,527 | import faulthandler
import os
import argparse
import json
from multiprocessing import cpu_count
from utils.util import load_config
from preprocessors.processor import preprocess_dataset
from preprocessors.metadata import cal_metadata
from processors import acoustic_extractor, content_extractor, data_augment
def extract... | Proprocess raw data of single or multiple datasets (in cfg.dataset) Args: cfg (dict): dictionary that stores configurations args (ArgumentParser): specify the configuration file and num_workers |
17,528 | import argparse
import torch
from models.tts.fastspeech2.fs2_trainer import FastSpeech2Trainer
from models.tts.vits.vits_trainer import VITSTrainer
from models.tts.valle.valle_trainer import VALLETrainer
from models.tts.naturalspeech2.ns2_trainer import NS2Trainer
from utils.util import load_config
class FastSpeech2Tr... | null |
17,529 | import argparse
import torch
from models.tts.fastspeech2.fs2_trainer import FastSpeech2Trainer
from models.tts.vits.vits_trainer import VITSTrainer
from models.tts.valle.valle_trainer import VALLETrainer
from models.tts.naturalspeech2.ns2_trainer import NS2Trainer
from utils.util import load_config
def cuda_relevant(d... | null |
17,530 | import argparse
from argparse import ArgumentParser
import os
from models.tts.fastspeech2.fs2_inference import FastSpeech2Inference
from models.tts.vits.vits_inference import VitsInference
from models.tts.valle.valle_inference import VALLEInference
from models.tts.naturalspeech2.ns2_inference import NS2Inference
from u... | null |
17,531 | import argparse
from argparse import ArgumentParser
import os
from models.tts.fastspeech2.fs2_inference import FastSpeech2Inference
from models.tts.vits.vits_inference import VitsInference
from models.tts.valle.valle_inference import VALLEInference
from models.tts.naturalspeech2.ns2_inference import NS2Inference
from u... | null |
17,532 | import argparse
from argparse import ArgumentParser
import os
from models.tts.fastspeech2.fs2_inference import FastSpeech2Inference
from models.tts.vits.vits_inference import VitsInference
from models.tts.valle.valle_inference import VALLEInference
from models.tts.naturalspeech2.ns2_inference import NS2Inference
from u... | null |
17,533 | import faulthandler
import os
import argparse
import json
import pyworld as pw
from multiprocessing import cpu_count
from utils.util import load_config
from preprocessors.processor import preprocess_dataset, prepare_align
from preprocessors.metadata import cal_metadata
from processors import (
acoustic_extractor,
... | Preprocess raw data of single or multiple datasets (in cfg.dataset) Args: cfg (dict): dictionary that stores configurations args (ArgumentParser): specify the configuration file and num_workers |
17,534 | import random
import os
import json
import torchaudio
from tqdm import tqdm
from glob import glob
from collections import defaultdict
from utils.util import has_existed
from preprocessors import GOLDEN_TEST_SAMPLES
GOLDEN_TEST_SAMPLES = defaultdict(list)
GOLDEN_TEST_SAMPLES["m4singer"] = [
"Alto-1_美错_0014",
"B... | null |
17,535 | import random
import os
import json
import torchaudio
from tqdm import tqdm
from glob import glob
from collections import defaultdict
from utils.util import has_existed
from preprocessors import GOLDEN_TEST_SAMPLES
def KiSing_statistics(data_dir):
folders = []
folders2utts = defaultdict(list)
folder_infos... | null |
17,536 | import os
import json
import os
from collections import defaultdict
from tqdm import tqdm
def get_uids_and_wav_paths(cfg, dataset, dataset_type):
assert dataset == "bigdata"
dataset_dir = os.path.join(
cfg.OUTPUT_PATH,
"preprocess/{}_version".format(cfg.PREPROCESS_VERSION),
"bigdata/{}"... | null |
17,537 | import os
import json
import os
from collections import defaultdict
from tqdm import tqdm
def take_duration(utt):
return utt["Duration"] | null |
17,538 | import os
import json
import os
from tqdm import tqdm
import torchaudio
from glob import glob
from collections import defaultdict
from utils.util import has_existed
from utils.io import save_audio
from utils.audio_slicer import Slicer
from preprocessors import GOLDEN_TEST_SAMPLES
def split_to_utterances(language_dir, o... | Split to utterances |
17,539 | import os
import json
import os
from tqdm import tqdm
import torchaudio
from glob import glob
from collections import defaultdict
from utils.util import has_existed
from utils.io import save_audio
from utils.audio_slicer import Slicer
from preprocessors import GOLDEN_TEST_SAMPLES
GOLDEN_TEST_SAMPLES = defaultdict(list... | null |
17,540 | import os
import json
import os
from tqdm import tqdm
import torchaudio
from glob import glob
from collections import defaultdict
from utils.util import has_existed
from utils.io import save_audio
from utils.audio_slicer import Slicer
from preprocessors import GOLDEN_TEST_SAMPLES
def opera_statistics(data_dir):
si... | null |
17,541 | import random
import os
import json
import torchaudio
from tqdm import tqdm
from glob import glob
from collections import defaultdict
from utils.util import has_existed
from utils.audio_slicer import split_utterances_from_audio
from preprocessors import GOLDEN_TEST_SAMPLES
def split_utterances_from_audio(
wav_file... | null |
17,542 | import random
import os
import json
import torchaudio
from tqdm import tqdm
from glob import glob
from collections import defaultdict
from utils.util import has_existed
from utils.audio_slicer import split_utterances_from_audio
from preprocessors import GOLDEN_TEST_SAMPLES
def cocoeval_statistics(data_dir):
song2u... | null |
17,543 | import os
import json
import torchaudio
import librosa
from tqdm import tqdm
from glob import glob
from collections import defaultdict
from utils.util import has_existed
from preprocessors import GOLDEN_TEST_SAMPLES
GOLDEN_TEST_SAMPLES = defaultdict(list)
GOLDEN_TEST_SAMPLES["m4singer"] = [
"Alto-1_美错_0014",
"... | null |
17,544 | import os
import json
import torchaudio
import librosa
from tqdm import tqdm
from glob import glob
from collections import defaultdict
from utils.util import has_existed
from preprocessors import GOLDEN_TEST_SAMPLES
def popbutfy_statistics(data_dir):
singers = []
songs = []
singer2songs = defaultdict(lambd... | null |
17,545 | import os
import json
import torchaudio
from glob import glob
from collections import defaultdict
from utils.util import has_existed
from preprocessors import GOLDEN_TEST_SAMPLES
GOLDEN_TEST_SAMPLES = defaultdict(list)
GOLDEN_TEST_SAMPLES["m4singer"] = [
"Alto-1_美错_0014",
"Bass-1_十年_0008",
"Soprano-2_同桌的你_... | null |
17,546 | import os
import json
import torchaudio
from glob import glob
from collections import defaultdict
from utils.util import has_existed
from preprocessors import GOLDEN_TEST_SAMPLES
def popcs_statistics(data_dir):
songs = []
songs2utts = defaultdict(list)
song_infos = glob(data_dir + "/*")
for song_info... | null |
17,547 | import os
import json
import pickle
import glob
from collections import defaultdict
from tqdm import tqdm
from preprocessors import get_golden_samples_indexes
TRAIN_MAX_NUM_EVERY_PERSON = 250
TEST_MAX_NUM_EVERY_PERSON = 25
def get_golden_samples_indexes(
dataset_name,
dataset_dir=None,
cfg=None,
split=... | null |
17,548 | import os
import json
import os
import glob
from tqdm import tqdm
import torchaudio
import pandas as pd
from glob import glob
from collections import defaultdict
from utils.io import save_audio
from utils.util import has_existed
from preprocessors import GOLDEN_TEST_SAMPLES
def split_to_utterances(language_dir, output_... | Split to utterances |
17,549 | import os
import json
import os
import glob
from tqdm import tqdm
import torchaudio
import pandas as pd
from glob import glob
from collections import defaultdict
from utils.io import save_audio
from utils.util import has_existed
from preprocessors import GOLDEN_TEST_SAMPLES
GOLDEN_TEST_SAMPLES = defaultdict(list)
GOLD... | null |
17,550 | import os
import json
import os
import glob
from tqdm import tqdm
import torchaudio
import pandas as pd
from glob import glob
from collections import defaultdict
from utils.io import save_audio
from utils.util import has_existed
from preprocessors import GOLDEN_TEST_SAMPLES
def csd_statistics(data_dir):
languages ... | null |
17,551 | import os
import json
import torchaudio
from tqdm import tqdm
from glob import glob
from collections import defaultdict
from utils.io import save_audio
from utils.util import has_existed
from utils.audio_slicer import Slicer
from preprocessors import GOLDEN_TEST_SAMPLES
def split_to_utterances(dataset_path, singer, sty... | Split to utterances |
17,552 | import os
import json
import torchaudio
from tqdm import tqdm
from glob import glob
from collections import defaultdict
from utils.io import save_audio
from utils.util import has_existed
from utils.audio_slicer import Slicer
from preprocessors import GOLDEN_TEST_SAMPLES
GOLDEN_TEST_SAMPLES = defaultdict(list)
GOLDEN_T... | null |
17,553 | import os
import json
import torchaudio
from tqdm import tqdm
from glob import glob
from collections import defaultdict
from utils.io import save_audio
from utils.util import has_existed
from utils.audio_slicer import Slicer
from preprocessors import GOLDEN_TEST_SAMPLES
def nus48e_statistics(data_dir):
singers = [... | null |
17,554 | import os
import json
import librosa
from tqdm import tqdm
from glob import glob
from collections import defaultdict
from utils.util import has_existed
def vctk_statistics(data_dir):
speakers = []
speakers2utts = defaultdict(list)
speaker_infos = glob(data_dir + "/wav48_silence_trimmed" + "/*")
for s... | null |
17,555 | import os
import json
import librosa
from tqdm import tqdm
from glob import glob
from collections import defaultdict
from utils.util import has_existed
def get_lines(file):
with open(file, "r") as f:
lines = f.readlines()
lines = [l.strip() for l in lines]
return lines
def vctk_speaker_infos(da... | null |
17,556 | import glob
import os
import json
import torchaudio
from tqdm import tqdm
from collections import defaultdict
from utils.io import save_audio
from utils.util import has_existed, remove_and_create
from utils.audio_slicer import Slicer
from preprocessors import GOLDEN_TEST_SAMPLES
def split_to_utterances(input_dir, outpu... | Split to utterances |
17,557 | import glob
import os
import json
import torchaudio
from tqdm import tqdm
from collections import defaultdict
from utils.io import save_audio
from utils.util import has_existed, remove_and_create
from utils.audio_slicer import Slicer
from preprocessors import GOLDEN_TEST_SAMPLES
GOLDEN_TEST_SAMPLES = defaultdict(list)... | null |
17,558 | import glob
import os
import json
import torchaudio
from tqdm import tqdm
from collections import defaultdict
from utils.io import save_audio
from utils.util import has_existed, remove_and_create
from utils.audio_slicer import Slicer
from preprocessors import GOLDEN_TEST_SAMPLES
def statistics(utt_dir):
song2utts ... | null |
17,559 | import random
import os
import json
import librosa
from tqdm import tqdm
from glob import glob
from collections import defaultdict
from utils.util import has_existed
from preprocessors import GOLDEN_TEST_SAMPLES
GOLDEN_TEST_SAMPLES = defaultdict(list)
GOLDEN_TEST_SAMPLES["m4singer"] = [
"Alto-1_美错_0014",
"Bass... | null |
17,560 | import random
import os
import json
import librosa
from tqdm import tqdm
from glob import glob
from collections import defaultdict
from utils.util import has_existed
from preprocessors import GOLDEN_TEST_SAMPLES
def opensinger_statistics(data_dir):
singers = []
songs = []
singer2songs = defaultdict(lambda:... | null |
17,561 | import json
from tqdm import tqdm
import os
import torchaudio
from utils import audio
import csv
import random
from utils.util import has_existed
from text import _clean_text
import librosa
import soundfile as sf
from scipy.io import wavfile
from pathlib import Path
import numpy as np
def get_lines(file):
lines = ... | null |
17,562 | import json
from tqdm import tqdm
import os
import torchaudio
from utils import audio
import csv
import random
from utils.util import has_existed
from text import _clean_text
import librosa
import soundfile as sf
from scipy.io import wavfile
from pathlib import Path
import numpy as np
def get_uid2utt(ljspeech_path, da... | null |
17,563 | import json
from tqdm import tqdm
import os
import torchaudio
from utils import audio
import csv
import random
from utils.util import has_existed
from text import _clean_text
import librosa
import soundfile as sf
from scipy.io import wavfile
from pathlib import Path
import numpy as np
def split_dataset(
lines, tes... | null |
17,564 | import json
from tqdm import tqdm
import os
import torchaudio
from utils import audio
import csv
import random
from utils.util import has_existed
from text import _clean_text
import librosa
import soundfile as sf
from scipy.io import wavfile
from pathlib import Path
import numpy as np
def textgird_extract(
corpus_d... | null |
17,565 | import os
import json
import librosa
from tqdm import tqdm
from collections import defaultdict
from utils.util import has_existed
from preprocessors import GOLDEN_TEST_SAMPLES
GOLDEN_TEST_SAMPLES = defaultdict(list)
GOLDEN_TEST_SAMPLES["m4singer"] = [
"Alto-1_美错_0014",
"Bass-1_十年_0008",
"Soprano-2_同桌的你_001... | null |
17,566 | import os
import json
import librosa
from tqdm import tqdm
from collections import defaultdict
from utils.util import has_existed
from preprocessors import GOLDEN_TEST_SAMPLES
def m4singer_statistics(meta):
singers = []
songs = []
singer2songs = defaultdict(lambda: defaultdict(list))
for utt in meta:
... | null |
17,567 | import os
import json
import torchaudio
from tqdm import tqdm
from glob import glob
from collections import defaultdict
from utils.util import has_existed
from preprocessors import GOLDEN_TEST_SAMPLES
def get_test_songs():
return ["007Di Da Di"] | null |
17,568 | import os
import json
import torchaudio
from tqdm import tqdm
from glob import glob
from collections import defaultdict
from utils.util import has_existed
from preprocessors import GOLDEN_TEST_SAMPLES
def coco_statistics(data_dir):
song2utts = defaultdict(list)
song_infos = glob(data_dir + "/*")
for song... | null |
17,569 | import os
import json
import pickle
import glob
from collections import defaultdict
from tqdm import tqdm
TEST_MAX_NUM_EVERY_PERSON = 5
def get_chosen_speakers():
def select_sample_idxs():
chosen_speakers = get_chosen_speakers()
with open(os.path.join(vctk_dir, "train.json"), "r") as f:
raw_train = js... | null |
17,570 | import os
import json
import torchaudio
from tqdm import tqdm
from glob import glob
from collections import defaultdict
from utils.util import has_existed
def vocalist_statistics(data_dir):
singers = []
songs = []
global2singer2songs = defaultdict(lambda: defaultdict(lambda: defaultdict(list)))
global... | null |
17,571 | from glob import glob
import os
import json
import torchaudio
from tqdm import tqdm
from collections import defaultdict
from utils.util import has_existed, remove_and_create
from utils.audio_slicer import split_utterances_from_audio
def split_to_utterances(input_dir, output_dir):
print("Splitting to utterances for ... | Split to utterances |
17,572 | from glob import glob
import os
import json
import torchaudio
from tqdm import tqdm
from collections import defaultdict
from utils.util import has_existed, remove_and_create
from utils.audio_slicer import split_utterances_from_audio
def statistics(utterance_dir):
singers = []
songs = []
singers2songs = def... | null |
17,573 | import json
from tqdm import tqdm
import os
import librosa
from utils.util import has_existed
def get_lines(file):
with open(file, "r") as f:
lines = f.readlines()
lines = [l.strip() for l in lines]
return lines
def get_uid2utt(opencpop_path, dataset, dataset_type):
index_count = 0
tota... | null |
17,574 | import os
from tqdm import tqdm
import glob
import json
import torchaudio
from utils.util import has_existed
from utils.io import save_audio
def save_audio(path, waveform, fs, add_silence=False, turn_up=False, volume_peak=0.9):
"""Save audio to path with processing (turn up volume, add silence)
Args:
... | null |
17,575 | import json
from tqdm import tqdm
import os
import torchaudio
import torch
from utils.mfa_prepare import (
process_wav_files,
get_wav_files,
filter_wav_files_by_length,
)
from utils.cut_by_vad import cut_segments
from utils.whisper_transcription import asr_main
from utils.util import has_existed
import subp... | Get statistics for librilight dataset |
17,576 | import json
from tqdm import tqdm
import os
import torchaudio
import torch
from utils.mfa_prepare import (
process_wav_files,
get_wav_files,
filter_wav_files_by_length,
)
from utils.cut_by_vad import cut_segments
from utils.whisper_transcription import asr_main
from utils.util import has_existed
import subp... | null |
17,577 | import json
from tqdm import tqdm
import os
import torchaudio
import torch
from utils.mfa_prepare import (
process_wav_files,
get_wav_files,
filter_wav_files_by_length,
)
from utils.cut_by_vad import cut_segments
from utils.whisper_transcription import asr_main
from utils.util import has_existed
import subp... | Save metadata for librilight dataset |
17,578 | from glob import glob
import os
import json
import torchaudio
from tqdm import tqdm
from collections import defaultdict
from utils.util import has_existed
def statistics(utterance_dir):
singers = []
songs = []
utts_all = []
singers2songs = defaultdict(lambda: defaultdict(list))
singer_infos = glob... | null |
17,579 | import os
import json
import torchaudio
from tqdm import tqdm
from glob import glob
from collections import defaultdict
from utils.util import has_existed
def libritts_statistics(data_dir):
speakers = []
distribution2speakers2pharases2utts = defaultdict(
lambda: defaultdict(lambda: defaultdict(list))
... | null |
17,580 | import torchcrepe
import math
import librosa
import torch
import numpy as np
The provided code snippet includes necessary dependencies for implementing the `extract_f0_periodicity_rmse` function. Write a Python function `def extract_f0_periodicity_rmse( audio_ref, audio_deg, hop_length=256, **kwargs, )... | Compute f0 periodicity Root Mean Square Error (RMSE) between the predicted and the ground truth audio. audio_ref: path to the ground truth audio. audio_deg: path to the predicted audio. fs: sampling rate. hop_length: hop length. method: "dtw" will use dtw algorithm to align the length of the ground truth and predicted ... |
17,581 | import math
import librosa
import torch
import numpy as np
from utils.util import JsonHParams
from utils.f0 import get_f0_features_using_parselmouth
class JsonHParams:
def __init__(self, **kwargs):
for k, v in kwargs.items():
if type(v) == dict:
v = JsonHParams(**v)
... | Compute F1 socre of voiced/unvoiced accuracy between the predicted and the ground truth audio. audio_ref: path to the ground truth audio. audio_deg: path to the predicted audio. fs: sampling rate. hop_length: hop length. f0_min: lower limit for f0. f0_max: upper limit for f0. pitch_bin: number of bins for f0 quantizati... |
17,582 | import torch
import librosa
import numpy as np
from torchmetrics import PearsonCorrCoef
from utils.util import JsonHParams
from utils.f0 import get_f0_features_using_parselmouth, get_pitch_sub_median
class JsonHParams:
def __init__(self, **kwargs):
for k, v in kwargs.items():
if type(v) == dict... | Compute F0 Pearson Distance (FPC) between the predicted and the ground truth audio. audio_ref: path to the ground truth audio. audio_deg: path to the predicted audio. fs: sampling rate. hop_length: hop length. f0_min: lower limit for f0. f0_max: upper limit for f0. pitch_bin: number of bins for f0 quantization. pitch_m... |
17,583 | import math
import librosa
import torch
import numpy as np
from utils.util import JsonHParams
from utils.f0 import get_f0_features_using_parselmouth, get_pitch_sub_median
class JsonHParams:
def __init__(self, **kwargs):
for k, v in kwargs.items():
if type(v) == dict:
v = JsonHPa... | Compute F0 Root Mean Square Error (RMSE) between the predicted and the ground truth audio. audio_ref: path to the ground truth audio. audio_deg: path to the predicted audio. fs: sampling rate. hop_length: hop length. f0_min: lower limit for f0. f0_max: upper limit for f0. pitch_bin: number of bins for f0 quantization. ... |
17,584 | import math
import librosa
import torch
import numpy as np
from numpy import linalg as LA
from torchmetrics import PearsonCorrCoef
The provided code snippet includes necessary dependencies for implementing the `extract_energy_pearson_coeffcients` function. Write a Python function `def extract_energy_pearson_coeffcient... | Compute Energy Pearson Coefficients between the predicted and the ground truth audio. audio_ref: path to the ground truth audio. audio_deg: path to the predicted audio. fs: sampling rate. n_fft: fft size. hop_length: hop length. win_length: window length. method: "dtw" will use dtw algorithm to align the length of the ... |
17,585 | import math
import librosa
import torch
import numpy as np
from numpy import linalg as LA
The provided code snippet includes necessary dependencies for implementing the `extract_energy_rmse` function. Write a Python function `def extract_energy_rmse( audio_ref, audio_deg, n_fft=1024, hop_length=256, ... | Compute Energy Root Mean Square Error (RMSE) between the predicted and the ground truth audio. audio_ref: path to the ground truth audio. audio_deg: path to the predicted audio. fs: sampling rate. n_fft: fft size. hop_length: hop length. win_length: window length. method: "dtw" will use dtw algorithm to align the lengt... |
17,586 | import os
import numpy as np
import soundfile as sf
import torch
import torch.nn.functional as F
from tqdm import tqdm
import librosa
from evaluation.metrics.similarity.models.RawNetModel import RawNet3
from evaluation.metrics.similarity.models.RawNetBasicBlock import Bottle2neck
from transformers import Wav2Vec2Featur... | null |
17,587 | import torch
import torch.nn as nn
from asteroid_filterbanks import Encoder, ParamSincFB
from .RawNetBasicBlock import Bottle2neck, PreEmphasis
class RawNet3(nn.Module):
def __init__(self, block, model_scale, context, summed, C=1024, **kwargs):
super().__init__()
nOut = kwargs["nOut"]
self.c... | null |
17,588 | import whisper
import torch
from torchmetrics import WordErrorRate
The provided code snippet includes necessary dependencies for implementing the `extract_wer` function. Write a Python function `def extract_wer( model, **kwargs, )` to solve the following problem:
Compute Word Error Rate (WER) between the predi... | Compute Word Error Rate (WER) between the predicted and the ground truth audio. content_gt: the ground truth content. audio_ref: path to the ground truth audio. audio_deg: path to the predicted audio. mode: "gt_content" computes the WER between the predicted content obtained from the whisper model and the ground truth ... |
17,589 | import whisper
import torch
from torchmetrics import CharErrorRate
The provided code snippet includes necessary dependencies for implementing the `extract_cer` function. Write a Python function `def extract_cer( model, **kwargs, )` to solve the following problem:
Compute Character Error Rate (CER) between the ... | Compute Character Error Rate (CER) between the predicted and the ground truth audio. content_gt: the ground truth content. audio_ref: path to the ground truth audio. audio_deg: path to the predicted audio. mode: "gt_content" computes the CER between the predicted content obtained from the whisper model and the ground t... |
17,590 | import torch
import librosa
import numpy as np
from torchmetrics import ScaleInvariantSignalDistortionRatio
def extract_si_sdr(audio_ref, audio_deg, **kwargs):
# Load hyperparameters
kwargs = kwargs["kwargs"]
fs = kwargs["fs"]
method = kwargs["method"]
si_sdr = ScaleInvariantSignalDistortionRatio(... | null |
17,591 | from frechet_audio_distance import FrechetAudioDistance
The provided code snippet includes necessary dependencies for implementing the `extract_fad` function. Write a Python function `def extract_fad( audio_dir1, audio_dir2, **kwargs, )` to solve the following problem:
Extract Frechet Audio Distance for tw... | Extract Frechet Audio Distance for two given audio folders. audio_dir1: path to the ground truth audio folder. audio_dir2: path to the predicted audio folder. mode: "vggish", "pann", "clap" for different models. |
17,592 | import librosa
import torch
import numpy as np
The provided code snippet includes necessary dependencies for implementing the `extract_mstft` function. Write a Python function `def extract_mstft( audio_ref, audio_deg, **kwargs, )` to solve the following problem:
Compute Multi-Scale STFT Distance (mstft) be... | Compute Multi-Scale STFT Distance (mstft) between the predicted and the ground truth audio. audio_ref: path to the ground truth audio. audio_deg: path to the predicted audio. fs: sampling rate. med_freq: division frequency for mid frequency parts. high_freq: division frequency for high frequency parts. method: "dtw" wi... |
17,593 | from pymcd.mcd import Calculate_MCD
The provided code snippet includes necessary dependencies for implementing the `extract_mcd` function. Write a Python function `def extract_mcd(audio_ref, audio_deg, **kwargs)` to solve the following problem:
Extract Mel-Cepstral Distance for a two given audio. Args: audio_ref: The ... | Extract Mel-Cepstral Distance for a two given audio. Args: audio_ref: The given reference audio. It is an audio path. audio_deg: The given synthesized audio. It is an audio path. |
17,594 | import torch
import librosa
import numpy as np
from torchmetrics.audio.stoi import ShortTimeObjectiveIntelligibility
The provided code snippet includes necessary dependencies for implementing the `extract_stoi` function. Write a Python function `def extract_stoi(audio_ref, audio_deg, **kwargs)` to solve the following ... | Compute Short-Time Objective Intelligibility between the predicted and the ground truth audio. audio_ref: path to the ground truth audio. audio_deg: path to the predicted audio. fs: sampling rate. method: "dtw" will use dtw algorithm to align the length of the ground truth and predicted audio. "cut" will cut both audio... |
17,595 | import librosa
import numpy as np
from pypesq import pesq
The provided code snippet includes necessary dependencies for implementing the `extract_pesq` function. Write a Python function `def extract_pesq(audio_ref, audio_deg, **kwargs)` to solve the following problem:
Extract PESQ for a two given audio. audio1: the gi... | Extract PESQ for a two given audio. audio1: the given reference audio. It is a numpy array. audio2: the given synthesized audio. It is a numpy array. fs: sampling rate. method: "dtw" will use dtw algorithm to align the length of the ground truth and predicted audio. "cut" will cut both audios into a same length accordi... |
17,596 | import torch
import librosa
import numpy as np
from torchmetrics import ScaleInvariantSignalNoiseRatio
def extract_si_snr(audio_ref, audio_deg, **kwargs):
# Load hyperparameters
kwargs = kwargs["kwargs"]
fs = kwargs["fs"]
method = kwargs["method"]
si_snr = ScaleInvariantSignalNoiseRatio()
if ... | null |
17,597 | import numpy as np
import scipy.signal as sig
import copy
import librosa
def bandpower(ps, mode="time"):
"""
estimate bandpower, see https://de.mathworks.com/help/signal/ref/bandpower.html
"""
if mode == "time":
x = ps
l2norm = np.linalg.norm(x) ** 2.0 / len(x)
return l2norm
... | Extract Signal-to-Noise Ratio for a given audio. |
17,598 | import librosa
from scipy import signal
The provided code snippet includes necessary dependencies for implementing the `extract_ltas` function. Write a Python function `def extract_ltas(audio, fs=None, n_fft=1024, hop_length=256)` to solve the following problem:
Extract Long-Term Average Spectrum for a given audio.
H... | Extract Long-Term Average Spectrum for a given audio. |
17,599 | import torch
import librosa
from utils.util import JsonHParams
from utils.f0 import get_f0_features_using_parselmouth, get_pitch_sub_median
from utils.mel import extract_mel_features
class JsonHParams:
def __init__(self, **kwargs):
for k, v in kwargs.items():
if type(v) == dict:
... | Compute Singing Power Ratio (SPR) from a given audio. audio: path to the audio. fs: sampling rate. hop_length: hop length. win_length: window length. n_mels: number of mel filters. f0_min: lower limit for f0. f0_max: upper limit for f0. pitch_bin: number of bins for f0 quantization. pitch_max: upper limit for f0 quanti... |
17,600 | import os
from tqdm import tqdm
from text.g2p_module import G2PModule, LexiconModule
from text.symbol_table import SymbolTable
class SymbolTable(Generic[Symbol]):
"""SymbolTable that maps symbol IDs, found on the FSA arcs to
actual objects. These objects can be arbitrary Python objects
that can serve as ke... | null |
17,601 | import os
import torch
import numpy as np
import json
from tqdm import tqdm
from sklearn.preprocessing import StandardScaler
from utils.io import save_feature, save_txt, save_torch_audio
from utils.util import has_existed
from utils.tokenizer import extract_encodec_token
from utils.stft import TacotronSTFT
from utils.d... | Extract acoustic features from utterances using muliprocess Args: metadata (dict): dictionary that stores data in train.json and test.json files dataset_output (str): directory to store acoustic features cfg (dict): dictionary that stores configurations n_workers (int, optional): num of processes to extract features in... |
17,602 | import os
import torch
import numpy as np
import json
from tqdm import tqdm
from sklearn.preprocessing import StandardScaler
from utils.io import save_feature, save_txt, save_torch_audio
from utils.util import has_existed
from utils.tokenizer import extract_encodec_token
from utils.stft import TacotronSTFT
from utils.d... | mel: (n_mels, T) |
17,603 | import os
import torch
import numpy as np
import json
from tqdm import tqdm
from sklearn.preprocessing import StandardScaler
from utils.io import save_feature, save_txt, save_torch_audio
from utils.util import has_existed
from utils.tokenizer import extract_encodec_token
from utils.stft import TacotronSTFT
from utils.d... | Args: pred: a list whose every element is (frame_len, n_mels) Return: similar like pred |
17,604 | import os
import torch
import numpy as np
import json
from tqdm import tqdm
from sklearn.preprocessing import StandardScaler
from utils.io import save_feature, save_txt, save_torch_audio
from utils.util import has_existed
from utils.tokenizer import extract_encodec_token
from utils.stft import TacotronSTFT
from utils.d... | null |
17,605 | import torch
from torch.optim import Optimizer
from typing import List, Optional, Tuple, Union
def calc_lr(step, dim_embed, warmup_steps):
return dim_embed ** (-0.5) * min(step ** (-0.5), step * warmup_steps ** (-1.5)) | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.