Initialize SenseVoiceSmall. Args: specaug: TODO. specaug_conf: Configuration dict for specaug. normalize: TODO. normalize_conf: Configuration dict for normalize. encoder: TODO. encode
(
self,
specaug: str = None,
specaug_conf: dict = None,
normalize: str = None,
normalize_conf: dict = None,
encoder: str = None,
encoder_conf: dict = None,
ctc_conf: dict = None,
input_size: int = 80,
vocab_size: int = -1,
ignore_id: int = -1,
blank_id: int = 0,
sos: int = 1,
eos: int = 2,
length_normalized_loss: bool = False,
**kwargs,
)
| 660 | """CTC-attention hybrid Encoder-Decoder model""" |
| 661 | |
| 662 | def __init__( |
| 663 | self, |
| 664 | specaug: str = None, |
| 665 | specaug_conf: dict = None, |
| 666 | normalize: str = None, |
| 667 | normalize_conf: dict = None, |
| 668 | encoder: str = None, |
| 669 | encoder_conf: dict = None, |
| 670 | ctc_conf: dict = None, |
| 671 | input_size: int = 80, |
| 672 | vocab_size: int = -1, |
| 673 | ignore_id: int = -1, |
| 674 | blank_id: int = 0, |
| 675 | sos: int = 1, |
| 676 | eos: int = 2, |
| 677 | length_normalized_loss: bool = False, |
| 678 | **kwargs, |
| 679 | ): |
| 680 | |
| 681 | """Initialize SenseVoiceSmall. |
| 682 | |
| 683 | Args: |
| 684 | specaug: TODO. |
| 685 | specaug_conf: Configuration dict for specaug. |
| 686 | normalize: TODO. |
| 687 | normalize_conf: Configuration dict for normalize. |
| 688 | encoder: TODO. |
| 689 | encoder_conf: Configuration dict for encoder. |
| 690 | ctc_conf: Configuration dict for ctc. |
| 691 | input_size: Size/dimension parameter. |
| 692 | vocab_size: Size/dimension parameter. |
| 693 | ignore_id: TODO. |
| 694 | blank_id: TODO. |
| 695 | sos: TODO. |
| 696 | eos: TODO. |
| 697 | length_normalized_loss: TODO. |
| 698 | **kwargs: Additional keyword arguments. |
| 699 | """ |
| 700 | super().__init__() |
| 701 | |
| 702 | if specaug is not None: |
| 703 | specaug_class = tables.specaug_classes.get(specaug) |
| 704 | specaug = specaug_class(**specaug_conf) |
| 705 | if normalize is not None: |
| 706 | normalize_class = tables.normalize_classes.get(normalize) |
| 707 | normalize = normalize_class(**normalize_conf) |
| 708 | encoder_class = tables.encoder_classes.get(encoder) |
| 709 | encoder = encoder_class(input_size=input_size, **encoder_conf) |
| 710 | encoder_output_size = encoder.output_size() |
| 711 | |
| 712 | if ctc_conf is None: |
| 713 | ctc_conf = {} |
| 714 | ctc = CTC(odim=vocab_size, encoder_output_size=encoder_output_size, **ctc_conf) |
| 715 | |
| 716 | self.blank_id = blank_id |
| 717 | self.sos = sos if sos is not None else vocab_size - 1 |
| 718 | self.eos = eos if eos is not None else vocab_size - 1 |
| 719 | self.vocab_size = vocab_size |
nothing calls this directly
no test coverage detected