MCPcopy Create free account
hub / github.com/modelscope/FunASR / __init__

Method __init__

funasr/models/sanm_kws/model.py:37–110  ·  view source on GitHub ↗

Initialize SanmKWS. Args: specaug: TODO. specaug_conf: Configuration dict for specaug. normalize: TODO. normalize_conf: Configuration dict for normalize. encoder: TODO. encoder_conf:

(
        self,
        specaug: Optional[str] = None,
        specaug_conf: Optional[Dict] = None,
        normalize: str = None,
        normalize_conf: Optional[Dict] = None,
        encoder: str = None,
        encoder_conf: Optional[Dict] = None,
        ctc: str = None,
        ctc_conf: Optional[Dict] = None,
        ctc_weight: float = 1.0,
        input_size: int = 360,
        vocab_size: int = -1,
        ignore_id: int = -1,
        blank_id: int = 0,
        sos: int = 1,
        eos: int = 2,
        **kwargs,
    )

Source from the content-addressed store, hash-verified

35 """
36
37 def __init__(
38 self,
39 specaug: Optional[str] = None,
40 specaug_conf: Optional[Dict] = None,
41 normalize: str = None,
42 normalize_conf: Optional[Dict] = None,
43 encoder: str = None,
44 encoder_conf: Optional[Dict] = None,
45 ctc: str = None,
46 ctc_conf: Optional[Dict] = None,
47 ctc_weight: float = 1.0,
48 input_size: int = 360,
49 vocab_size: int = -1,
50 ignore_id: int = -1,
51 blank_id: int = 0,
52 sos: int = 1,
53 eos: int = 2,
54 **kwargs,
55 ):
56
57 """Initialize SanmKWS.
58
59 Args:
60 specaug: TODO.
61 specaug_conf: Configuration dict for specaug.
62 normalize: TODO.
63 normalize_conf: Configuration dict for normalize.
64 encoder: TODO.
65 encoder_conf: Configuration dict for encoder.
66 ctc: TODO.
67 ctc_conf: Configuration dict for ctc.
68 ctc_weight: TODO.
69 input_size: Size/dimension parameter.
70 vocab_size: Size/dimension parameter.
71 ignore_id: TODO.
72 blank_id: TODO.
73 sos: TODO.
74 eos: TODO.
75 **kwargs: Additional keyword arguments.
76 """
77 super().__init__()
78
79 if specaug is not None:
80 specaug_class = tables.specaug_classes.get(specaug)
81 specaug = specaug_class(**specaug_conf)
82
83 if normalize is not None:
84 normalize_class = tables.normalize_classes.get(normalize)
85 normalize = normalize_class(**normalize_conf)
86
87 encoder_class = tables.encoder_classes.get(encoder)
88 encoder = encoder_class(input_size=input_size, **encoder_conf)
89 encoder_output_size = encoder.output_size()
90
91 if ctc_conf is None:
92 ctc_conf = {}
93 ctc = CTC(odim=vocab_size, encoder_output_size=encoder_output_size, **ctc_conf)
94

Callers

nothing calls this directly

Calls 2

CTCClass · 0.90
output_sizeMethod · 0.45

Tested by

no test coverage detected