nazemi commited on
Commit
136a816
·
verified ·
1 Parent(s): 235c900

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 +21 -0
  6. vocab.json +60 -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": 58,
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:e7da672f856f8cc23d30075f925ce42ed8015cbdbaccbdc2e1bc137ee43af71a
3
+ size 145404082
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": "urd-script_arabic",
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,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ from transformers import VitsModel, AutoTokenizer
3
+ import torch
4
+ import numpy as np
5
+ from scipy.io.wavfile import write
6
+
7
+ model = VitsModel.from_pretrained("tts_urdu")
8
+ tokenizer = AutoTokenizer.from_pretrained("tts_urdu")
9
+ text = "ہیلو، آپ کیسے ہیں؟ میں ٹیکس آفس سے کال کر رہا ہوں۔"
10
+ inputs = tokenizer(text, return_tensors="pt")
11
+
12
+ inputs["input_ids"] = inputs["input_ids"].long()
13
+ with torch.no_grad():
14
+ output = model(**inputs).waveform
15
+
16
+ output = output.squeeze()
17
+ output_np = output.cpu().numpy()
18
+ output_int16 = (output_np * 32767).astype(np.int16)
19
+ write("urdu.wav", rate=model.config.sampling_rate, data=output_int16)
20
+
21
+
vocab.json ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ " ": 26,
3
+ "'": 4,
4
+ "0": 48,
5
+ "1": 36,
6
+ "2": 24,
7
+ "3": 20,
8
+ "4": 35,
9
+ "5": 8,
10
+ "6": 51,
11
+ "7": 27,
12
+ "8": 7,
13
+ "9": 23,
14
+ "_": 30,
15
+ "آ": 2,
16
+ "أ": 12,
17
+ "ؤ": 3,
18
+ "ئ": 25,
19
+ "ا": 15,
20
+ "ب": 31,
21
+ "ت": 28,
22
+ "ث": 16,
23
+ "ج": 49,
24
+ "ح": 54,
25
+ "خ": 1,
26
+ "د": 0,
27
+ "ذ": 47,
28
+ "ر": 22,
29
+ "ز": 44,
30
+ "س": 57,
31
+ "ش": 34,
32
+ "ص": 19,
33
+ "ض": 42,
34
+ "ط": 6,
35
+ "ظ": 32,
36
+ "ع": 38,
37
+ "غ": 37,
38
+ "ف": 29,
39
+ "ق": 17,
40
+ "ل": 13,
41
+ "م": 40,
42
+ "ن": 9,
43
+ "و": 10,
44
+ "ٰ": 39,
45
+ "ٹ": 46,
46
+ "پ": 52,
47
+ "چ": 5,
48
+ "ڈ": 55,
49
+ "ڑ": 21,
50
+ "ژ": 43,
51
+ "ک": 45,
52
+ "گ": 14,
53
+ "ں": 56,
54
+ "ھ": 41,
55
+ "ہ": 53,
56
+ "ۂ": 50,
57
+ "ی": 18,
58
+ "ے": 11,
59
+ "—": 33
60
+ }