nazemi commited on
Commit
9cc385f
·
verified ·
1 Parent(s): 35c3716

Upload 6 files

Browse files
Files changed (6) hide show
  1. config.json +82 -0
  2. pytorch_model.bin +3 -0
  3. special_tokens_map.json +4 -0
  4. tokenizer_config.json +12 -0
  5. tts.py +22 -0
  6. vocab.json +74 -0
config.json ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "activation_dropout": 0.1,
3
+ "architectures": [
4
+ "VitsModel"
5
+ ],
6
+ "attention_dropout": 0.1,
7
+ "depth_separable_channels": 2,
8
+ "depth_separable_num_layers": 3,
9
+ "duration_predictor_dropout": 0.5,
10
+ "duration_predictor_filter_channels": 256,
11
+ "duration_predictor_flow_bins": 10,
12
+ "duration_predictor_kernel_size": 3,
13
+ "duration_predictor_num_flows": 4,
14
+ "duration_predictor_tail_bound": 5.0,
15
+ "ffn_dim": 768,
16
+ "ffn_kernel_size": 3,
17
+ "flow_size": 192,
18
+ "hidden_act": "relu",
19
+ "hidden_dropout": 0.1,
20
+ "hidden_size": 192,
21
+ "initializer_range": 0.02,
22
+ "layer_norm_eps": 1e-05,
23
+ "layerdrop": 0.1,
24
+ "leaky_relu_slope": 0.1,
25
+ "model_type": "vits",
26
+ "noise_scale": 0.667,
27
+ "noise_scale_duration": 0.8,
28
+ "num_attention_heads": 2,
29
+ "num_hidden_layers": 6,
30
+ "num_speakers": 1,
31
+ "posterior_encoder_num_wavenet_layers": 16,
32
+ "prior_encoder_num_flows": 4,
33
+ "prior_encoder_num_wavenet_layers": 4,
34
+ "resblock_dilation_sizes": [
35
+ [
36
+ 1,
37
+ 3,
38
+ 5
39
+ ],
40
+ [
41
+ 1,
42
+ 3,
43
+ 5
44
+ ],
45
+ [
46
+ 1,
47
+ 3,
48
+ 5
49
+ ]
50
+ ],
51
+ "resblock_kernel_sizes": [
52
+ 3,
53
+ 7,
54
+ 11
55
+ ],
56
+ "sampling_rate": 16000,
57
+ "speaker_embedding_size": 0,
58
+ "speaking_rate": 1.0,
59
+ "spectrogram_bins": 513,
60
+ "torch_dtype": "float32",
61
+ "transformers_version": "4.33.0.dev0",
62
+ "upsample_initial_channel": 512,
63
+ "upsample_kernel_sizes": [
64
+ 16,
65
+ 16,
66
+ 4,
67
+ 4
68
+ ],
69
+ "upsample_rates": [
70
+ 8,
71
+ 8,
72
+ 2,
73
+ 2
74
+ ],
75
+ "use_bias": true,
76
+ "use_stochastic_duration_prediction": true,
77
+ "vocab_size": 72,
78
+ "wavenet_dilation_rate": 1,
79
+ "wavenet_dropout": 0.0,
80
+ "wavenet_kernel_size": 5,
81
+ "window_size": 4
82
+ }
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9976bca6a9d1fb449e730b69076369612afee3394a71a5a9f75df955650350f6
3
+ size 145414834
special_tokens_map.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "pad_token": "फ",
3
+ "unk_token": "<unk>"
4
+ }
tokenizer_config.json ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_blank": true,
3
+ "clean_up_tokenization_spaces": true,
4
+ "is_uroman": false,
5
+ "language": "hin",
6
+ "model_max_length": 1000000000000000019884624838656,
7
+ "normalize": true,
8
+ "pad_token": "फ",
9
+ "phonemize": false,
10
+ "tokenizer_class": "VitsTokenizer",
11
+ "unk_token": "<unk>"
12
+ }
tts.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import VitsModel, AutoTokenizer
2
+ import torch
3
+ import numpy as np
4
+ from scipy.io.wavfile import write
5
+
6
+ model = VitsModel.from_pretrained("tts_hindi")
7
+ tokenizer = AutoTokenizer.from_pretrained("tts_hindi")
8
+
9
+ i = 1
10
+ with open('transcription.txt', 'r', encoding='utf-8') as file:
11
+ for line in file:
12
+ # text = "नमस्ते, आप कैसे हैं? मैं टैक्स ऑफिस से बोल रहा हूँ"
13
+ text = line
14
+ inputs = tokenizer(text, return_tensors="pt")
15
+ with torch.no_grad():
16
+ output = model(**inputs).waveform
17
+
18
+ output = output.squeeze()
19
+ output_np = output.cpu().numpy()
20
+ output_int16 = (output_np * 32767).astype(np.int16)
21
+ write("hindi/"+str(i)+".wav", rate=model.config.sampling_rate, data=output_int16)
22
+ i = i+1
vocab.json ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ " ": 7,
3
+ "'": 44,
4
+ "-": 3,
5
+ "0": 8,
6
+ "1": 2,
7
+ "2": 18,
8
+ "3": 25,
9
+ "4": 1,
10
+ "8": 6,
11
+ "_": 33,
12
+ "`": 45,
13
+ "ँ": 16,
14
+ "ं": 30,
15
+ "ः": 35,
16
+ "अ": 4,
17
+ "आ": 55,
18
+ "इ": 5,
19
+ "ई": 34,
20
+ "उ": 32,
21
+ "ऊ": 65,
22
+ "ए": 11,
23
+ "ऐ": 12,
24
+ "ऑ": 19,
25
+ "ओ": 67,
26
+ "औ": 60,
27
+ "क": 70,
28
+ "ख": 42,
29
+ "ग": 49,
30
+ "घ": 47,
31
+ "च": 17,
32
+ "छ": 9,
33
+ "ज": 57,
34
+ "झ": 58,
35
+ "ञ": 26,
36
+ "ट": 68,
37
+ "ठ": 29,
38
+ "ड": 56,
39
+ "ढ": 50,
40
+ "ण": 43,
41
+ "त": 69,
42
+ "थ": 20,
43
+ "द": 62,
44
+ "ध": 37,
45
+ "न": 10,
46
+ "प": 48,
47
+ "फ": 0,
48
+ "ब": 41,
49
+ "भ": 21,
50
+ "म": 71,
51
+ "य": 51,
52
+ "र": 39,
53
+ "ल": 38,
54
+ "व": 46,
55
+ "श": 59,
56
+ "ष": 14,
57
+ "स": 40,
58
+ "ह": 36,
59
+ "़": 13,
60
+ "ा": 54,
61
+ "ि": 15,
62
+ "ी": 22,
63
+ "ु": 28,
64
+ "ू": 66,
65
+ "ृ": 63,
66
+ "ॅ": 24,
67
+ "े": 52,
68
+ "ै": 27,
69
+ "ॉ": 31,
70
+ "ो": 61,
71
+ "ौ": 64,
72
+ "्": 53,
73
+ "‍": 23
74
+ }