primepake commited on
Commit
11db1dc
·
1 Parent(s): a80fff9

add config

Browse files
Files changed (1) hide show
  1. speech/config.yaml +206 -0
speech/config.yaml ADDED
@@ -0,0 +1,206 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # set random seed, so that you may reproduce your result.
2
+ __set_seed1: !apply:random.seed [1986]
3
+ __set_seed2: !apply:numpy.random.seed [1986]
4
+ __set_seed3: !apply:torch.manual_seed [1986]
5
+ __set_seed4: !apply:torch.cuda.manual_seed_all [1986]
6
+
7
+ # fixed params
8
+ sample_rate: 24000
9
+ llm_input_size: 896
10
+ llm_output_size: 896
11
+ spk_embed_dim: 192
12
+ qwen_pretrain_path: ''
13
+ token_frame_rate: 25
14
+ token_mel_ratio: 2
15
+
16
+ # stream related params
17
+ chunk_size: 25 # streaming inference chunk size, in token
18
+ num_decoding_left_chunks: -1 # streaming inference flow decoder left chunk size, <0 means use all left chunks
19
+
20
+ # model params
21
+ # for all class/function included in this repo, we use !<name> or !<new> for intialization, so that user may find all corresponding class/function according to one single yaml.
22
+ # for system/third_party class/function, we do not require this.
23
+ llm: !new:cosyvoice.llm.llm.Qwen2LM
24
+ llm_input_size: !ref <llm_input_size>
25
+ llm_output_size: !ref <llm_output_size>
26
+ speech_token_size: 6561
27
+ length_normalized_loss: True
28
+ lsm_weight: 0
29
+ mix_ratio: [5, 15]
30
+ llm: !new:cosyvoice.llm.llm.Qwen2Encoder
31
+ pretrain_path: !ref <qwen_pretrain_path>
32
+ sampling: !name:cosyvoice.utils.common.ras_sampling
33
+ top_p: 0.8
34
+ top_k: 25
35
+ win_size: 10
36
+ tau_r: 0.1
37
+
38
+ flow: !new:cosyvoice.flow.flow.CausalMaskedDiffWithXvec
39
+ input_size: 512
40
+ output_size: 80
41
+ spk_embed_dim: !ref <spk_embed_dim>
42
+ output_type: 'mel'
43
+ vocab_size: 6561
44
+ input_frame_rate: !ref <token_frame_rate>
45
+ only_mask_loss: True
46
+ token_mel_ratio: !ref <token_mel_ratio>
47
+ pre_lookahead_len: 3
48
+ encoder: !new:cosyvoice.transformer.upsample_encoder.UpsampleConformerEncoder
49
+ output_size: 512
50
+ attention_heads: 8
51
+ linear_units: 2048
52
+ num_blocks: 6
53
+ dropout_rate: 0.1
54
+ positional_dropout_rate: 0.1
55
+ attention_dropout_rate: 0.1
56
+ normalize_before: True
57
+ input_layer: 'linear'
58
+ pos_enc_layer_type: 'rel_pos_espnet'
59
+ selfattention_layer_type: 'rel_selfattn'
60
+ input_size: 512
61
+ use_cnn_module: False
62
+ macaron_style: False
63
+ static_chunk_size: !ref <chunk_size>
64
+ decoder: !new:cosyvoice.flow.flow_matching.CausalConditionalCFM
65
+ in_channels: 240
66
+ n_spks: 1
67
+ spk_emb_dim: 80
68
+ cfm_params: !new:omegaconf.DictConfig
69
+ content:
70
+ sigma_min: 1e-06
71
+ solver: 'euler'
72
+ t_scheduler: 'cosine'
73
+ training_cfg_rate: 0.2
74
+ inference_cfg_rate: 0.7
75
+ reg_loss_type: 'l1'
76
+ estimator: !new:cosyvoice.flow.decoder.CausalConditionalDecoder
77
+ in_channels: 320
78
+ out_channels: 80
79
+ channels: [256]
80
+ dropout: 0.0
81
+ attention_head_dim: 64
82
+ n_blocks: 4
83
+ num_mid_blocks: 12
84
+ num_heads: 8
85
+ act_fn: 'gelu'
86
+ static_chunk_size: !ref <chunk_size> * <token_mel_ratio>
87
+ num_decoding_left_chunks: !ref <num_decoding_left_chunks>
88
+
89
+ hift: !new:cosyvoice.hifigan.generator.HiFTGenerator
90
+ in_channels: 80
91
+ base_channels: 512
92
+ nb_harmonics: 8
93
+ sampling_rate: !ref <sample_rate>
94
+ nsf_alpha: 0.1
95
+ nsf_sigma: 0.003
96
+ nsf_voiced_threshold: 10
97
+ upsample_rates: [8, 5, 3]
98
+ upsample_kernel_sizes: [16, 11, 7]
99
+ istft_params:
100
+ n_fft: 16
101
+ hop_len: 4
102
+ resblock_kernel_sizes: [3, 7, 11]
103
+ resblock_dilation_sizes: [[1, 3, 5], [1, 3, 5], [1, 3, 5]]
104
+ source_resblock_kernel_sizes: [7, 7, 11]
105
+ source_resblock_dilation_sizes: [[1, 3, 5], [1, 3, 5], [1, 3, 5]]
106
+ lrelu_slope: 0.1
107
+ audio_limit: 0.99
108
+ f0_predictor: !new:cosyvoice.hifigan.f0_predictor.ConvRNNF0Predictor
109
+ num_class: 1
110
+ in_channels: 80
111
+ cond_channels: 512
112
+
113
+ # gan related module
114
+ mel_spec_transform1: !name:matcha.utils.audio.mel_spectrogram
115
+ n_fft: 1920
116
+ num_mels: 80
117
+ sampling_rate: !ref <sample_rate>
118
+ hop_size: 480
119
+ win_size: 1920
120
+ fmin: 0
121
+ fmax: null
122
+ center: False
123
+ hifigan: !new:cosyvoice.hifigan.hifigan.HiFiGan
124
+ generator: !ref <hift>
125
+ discriminator: !new:cosyvoice.hifigan.discriminator.MultipleDiscriminator
126
+ mpd: !new:matcha.hifigan.models.MultiPeriodDiscriminator
127
+ mrd: !new:cosyvoice.hifigan.discriminator.MultiResSpecDiscriminator
128
+ mel_spec_transform: [
129
+ !ref <mel_spec_transform1>
130
+ ]
131
+
132
+ individual_file_opener: !name:cosyvoice.dataset.processor.individual_file_opener
133
+
134
+
135
+ # processor functions
136
+ parquet_opener: !name:cosyvoice.dataset.processor.parquet_opener
137
+ get_tokenizer: !name:cosyvoice.tokenizer.tokenizer.get_qwen_tokenizer
138
+ token_path: !ref <qwen_pretrain_path>
139
+ skip_special_tokens: True
140
+ allowed_special: 'all'
141
+ tokenize: !name:cosyvoice.dataset.processor.tokenize
142
+ get_tokenizer: !ref <get_tokenizer>
143
+ allowed_special: !ref <allowed_special>
144
+ filter: !name:cosyvoice.dataset.processor.filter
145
+ max_length: 40960
146
+ min_length: 100
147
+ token_max_length: 200
148
+ token_min_length: 1
149
+ resample: !name:cosyvoice.dataset.processor.resample
150
+ resample_rate: !ref <sample_rate>
151
+ truncate: !name:cosyvoice.dataset.processor.truncate
152
+ truncate_length: 24480 # must be a multiplier of hop_size
153
+ feat_extractor: !name:matcha.utils.audio.mel_spectrogram
154
+ n_fft: 1920
155
+ num_mels: 80
156
+ sampling_rate: !ref <sample_rate>
157
+ hop_size: 480
158
+ win_size: 1920
159
+ fmin: 0
160
+ fmax: 8000
161
+ center: False
162
+ compute_fbank: !name:cosyvoice.dataset.processor.compute_fbank
163
+ feat_extractor: !ref <feat_extractor>
164
+ compute_f0: !name:cosyvoice.dataset.processor.compute_f0
165
+ sample_rate: !ref <sample_rate>
166
+ hop_size: 480
167
+ parse_embedding: !name:cosyvoice.dataset.processor.parse_embedding
168
+ normalize: True
169
+ shuffle: !name:cosyvoice.dataset.processor.shuffle
170
+ shuffle_size: 1000
171
+ sort: !name:cosyvoice.dataset.processor.sort
172
+ sort_size: 500 # sort_size should be less than shuffle_size
173
+ batch: !name:cosyvoice.dataset.processor.batch
174
+ batch_type: 'dynamic'
175
+ max_frames_in_batch: 2000
176
+ padding: !name:cosyvoice.dataset.processor.padding
177
+ use_spk_embedding: False # change to True during sft
178
+
179
+
180
+ # dataset processor pipeline
181
+ data_pipeline: [
182
+ !ref <individual_file_opener>,
183
+ !ref <tokenize>,
184
+ !ref <filter>,
185
+ !ref <resample>,
186
+ !ref <compute_fbank>,
187
+ !ref <parse_embedding>,
188
+ !ref <shuffle>,
189
+ !ref <sort>,
190
+ !ref <batch>,
191
+ !ref <padding>,
192
+ ]
193
+
194
+ # llm flow train conf
195
+ train_conf:
196
+ optim: adamw
197
+ optim_conf:
198
+ lr: 1e-5 # change to 1e-5 during sft
199
+ scheduler: constantlr # change to constantlr during sft
200
+ scheduler_conf:
201
+ warmup_steps: 2500
202
+ max_epoch: 200
203
+ grad_clip: 1
204
+ accum_grad: 1
205
+ log_interval: 100
206
+ save_per_step: -1