nazemi commited on
Commit
7ff1c5c
·
verified ·
1 Parent(s): 197b948

Upload 6 files

Browse files
Files changed (6) hide show
  1. config.json +83 -0
  2. pytorch_model.bin +3 -0
  3. special_tokens_map.json +4 -0
  4. tokenizer_config.json +12 -0
  5. tts.py +20 -0
  6. vocab.json +41 -0
config.json ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "facebook/mms-tts-ara",
3
+ "activation_dropout": 0.1,
4
+ "architectures": [
5
+ "VitsModel"
6
+ ],
7
+ "attention_dropout": 0.1,
8
+ "depth_separable_channels": 2,
9
+ "depth_separable_num_layers": 3,
10
+ "duration_predictor_dropout": 0.5,
11
+ "duration_predictor_filter_channels": 256,
12
+ "duration_predictor_flow_bins": 10,
13
+ "duration_predictor_kernel_size": 3,
14
+ "duration_predictor_num_flows": 4,
15
+ "duration_predictor_tail_bound": 5.0,
16
+ "ffn_dim": 768,
17
+ "ffn_kernel_size": 3,
18
+ "flow_size": 192,
19
+ "hidden_act": "relu",
20
+ "hidden_dropout": 0.1,
21
+ "hidden_size": 192,
22
+ "initializer_range": 0.02,
23
+ "layer_norm_eps": 1e-05,
24
+ "layerdrop": 0.1,
25
+ "leaky_relu_slope": 0.1,
26
+ "model_type": "vits",
27
+ "noise_scale": 0.667,
28
+ "noise_scale_duration": 0.8,
29
+ "num_attention_heads": 2,
30
+ "num_hidden_layers": 6,
31
+ "num_speakers": 1,
32
+ "posterior_encoder_num_wavenet_layers": 16,
33
+ "prior_encoder_num_flows": 4,
34
+ "prior_encoder_num_wavenet_layers": 4,
35
+ "resblock_dilation_sizes": [
36
+ [
37
+ 1,
38
+ 3,
39
+ 5
40
+ ],
41
+ [
42
+ 1,
43
+ 3,
44
+ 5
45
+ ],
46
+ [
47
+ 1,
48
+ 3,
49
+ 5
50
+ ]
51
+ ],
52
+ "resblock_kernel_sizes": [
53
+ 3,
54
+ 7,
55
+ 11
56
+ ],
57
+ "sampling_rate": 16000,
58
+ "speaker_embedding_size": 0,
59
+ "speaking_rate": 1.0,
60
+ "spectrogram_bins": 513,
61
+ "torch_dtype": "float32",
62
+ "transformers_version": "4.33.2",
63
+ "upsample_initial_channel": 512,
64
+ "upsample_kernel_sizes": [
65
+ 16,
66
+ 16,
67
+ 4,
68
+ 4
69
+ ],
70
+ "upsample_rates": [
71
+ 8,
72
+ 8,
73
+ 2,
74
+ 2
75
+ ],
76
+ "use_bias": true,
77
+ "use_stochastic_duration_prediction": true,
78
+ "vocab_size": 39,
79
+ "wavenet_dilation_rate": 1,
80
+ "wavenet_dropout": 0.0,
81
+ "wavenet_kernel_size": 5,
82
+ "window_size": 4
83
+ }
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:34d1ae05a8e6f865e7c8e355a23d626a3fe5ebd8f640849cf37a75d5e33f3314
3
+ size 145389045
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": "ara",
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,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_arabic")
7
+ tokenizer = AutoTokenizer.from_pretrained("SeyedAli/Arabic-Speech-synthesis")
8
+
9
+ text = "عشر ديما خمسة وعشرين رجلا في ليلة واحدة ومن ثم قام بقتلها"
10
+ text = "يوفر مجتمع البناء قروضا عقارية وقروض وعقارية"
11
+ inputs = tokenizer(text, return_tensors="pt")
12
+
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("arabic.wav", rate=model.config.sampling_rate, data=output_int16)
20
+
vocab.json ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ " ": 25,
3
+ "_": 37,
4
+ "ء": 26,
5
+ "آ": 27,
6
+ "أ": 20,
7
+ "ؤ": 35,
8
+ "إ": 4,
9
+ "ئ": 38,
10
+ "ا": 0,
11
+ "ب": 28,
12
+ "ة": 7,
13
+ "ت": 12,
14
+ "ث": 19,
15
+ "ج": 13,
16
+ "ح": 23,
17
+ "خ": 11,
18
+ "د": 16,
19
+ "ذ": 6,
20
+ "ر": 9,
21
+ "ز": 34,
22
+ "س": 8,
23
+ "ش": 32,
24
+ "ص": 18,
25
+ "ض": 22,
26
+ "ط": 10,
27
+ "ظ": 14,
28
+ "ع": 3,
29
+ "غ": 5,
30
+ "ف": 36,
31
+ "ق": 33,
32
+ "ك": 2,
33
+ "ل": 31,
34
+ "م": 30,
35
+ "ن": 1,
36
+ "ه": 24,
37
+ "و": 29,
38
+ "ى": 21,
39
+ "ي": 15,
40
+ "–": 17
41
+ }