MCPcopy Create free account
hub / github.com/espnet/espnet / __init__

Method __init__

espnet2/train/preprocessor.py:1519–1582  ·  view source on GitHub ↗
(
        self,
        train: bool,
        token_type: Optional[str] = None,
        token_list: Union[Path, str, Iterable[str]] = None,
        bpemodel: Union[Path, str, Iterable[str]] = None,
        text_cleaner: Collection[str] = None,
        g2p_type: Optional[str] = None,
        unk_symbol: str = "<unk>",
        space_symbol: str = "<space>",
        non_linguistic_symbols: Union[Path, str, Iterable[str]] = None,
        delimiter: Optional[str] = None,
        singing_volume_normalize: float = None,
        singing_name: str = "singing",
        text_name: str = "text",
        label_name: str = "label",
        midi_name: str = "score",
        fs: np.int32 = 0,
        hop_length: np.int32 = 256,
        phn_seg: dict = {
            1: [1],
            2: [0.25, 1],
            3: [0.1, 0.5, 1],
            4: [0.05, 0.1, 0.5, 1],
        },
        discrete_token_name: str = "discrete_token",
        pos_sample_name: str = "pos_idx",
        neg_sample_name: str = "neg_idx",
    )

Source from the content-addressed store, hash-verified

1517 """Preprocessor for Sing Voice Sythesis (SVS) task."""
1518
1519 def __init__(
1520 self,
1521 train: bool,
1522 token_type: Optional[str] = None,
1523 token_list: Union[Path, str, Iterable[str]] = None,
1524 bpemodel: Union[Path, str, Iterable[str]] = None,
1525 text_cleaner: Collection[str] = None,
1526 g2p_type: Optional[str] = None,
1527 unk_symbol: str = "<unk>",
1528 space_symbol: str = "<space>",
1529 non_linguistic_symbols: Union[Path, str, Iterable[str]] = None,
1530 delimiter: Optional[str] = None,
1531 singing_volume_normalize: float = None,
1532 singing_name: str = "singing",
1533 text_name: str = "text",
1534 label_name: str = "label",
1535 midi_name: str = "score",
1536 fs: np.int32 = 0,
1537 hop_length: np.int32 = 256,
1538 phn_seg: dict = {
1539 1: [1],
1540 2: [0.25, 1],
1541 3: [0.1, 0.5, 1],
1542 4: [0.05, 0.1, 0.5, 1],
1543 },
1544 discrete_token_name: str = "discrete_token",
1545 pos_sample_name: str = "pos_idx",
1546 neg_sample_name: str = "neg_idx",
1547 ):
1548 super().__init__(train)
1549 self.train = train
1550 self.singing_name = singing_name
1551 self.text_name = text_name
1552 self.label_name = label_name
1553 self.midi_name = midi_name
1554 self.fs = fs
1555 self.hop_length = hop_length
1556 self.singing_volume_normalize = singing_volume_normalize
1557 self.phn_seg = phn_seg
1558 self.time_shift = hop_length / fs
1559 self.discrete_token_name = discrete_token_name
1560 self.pos_sample_name = pos_sample_name
1561 self.neg_sample_name = neg_sample_name
1562 if token_type is not None:
1563 if token_list is None:
1564 raise ValueError("token_list is required if token_type is not None")
1565 self.text_cleaner = TextCleaner(text_cleaner)
1566
1567 self.tokenizer = build_tokenizer(
1568 token_type=token_type,
1569 bpemodel=bpemodel,
1570 delimiter=delimiter,
1571 space_symbol=space_symbol,
1572 non_linguistic_symbols=non_linguistic_symbols,
1573 g2p_type=g2p_type,
1574 )
1575 self.token_id_converter = TokenIDConverter(
1576 token_list=token_list,

Callers

nothing calls this directly

Calls 4

TextCleanerClass · 0.90
build_tokenizerFunction · 0.90
TokenIDConverterClass · 0.90
__init__Method · 0.45

Tested by

no test coverage detected