datasetsANDmodels commited on
Commit
ea60ee0
·
verified ·
1 Parent(s): 149ba64

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. usage.py +16 -0
  6. vocab.json +47 -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": 45,
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:be018653a1c04349ee8dccc51bb905aedd6a6a71548302b7a84ef3475fdf62d4
3
+ size 145394098
special_tokens_map.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "pad_token": "7",
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": "spa",
6
+ "model_max_length": 1000000000000000019884624838656,
7
+ "normalize": true,
8
+ "pad_token": "7",
9
+ "phonemize": false,
10
+ "tokenizer_class": "VitsTokenizer",
11
+ "unk_token": "<unk>"
12
+ }
usage.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import VitsModel, AutoTokenizer
2
+ import torch
3
+ import scipy.io.wavfile as wavfile
4
+
5
+ model = VitsModel.from_pretrained("spanish-tts")
6
+ tokenizer = AutoTokenizer.from_pretrained("spanish-tts")
7
+ text= "Estoy llamando desde la oficina de impuestos."
8
+
9
+ inputs = tokenizer(text, return_tensors="pt")
10
+
11
+ with torch.no_grad():
12
+ output = model(**inputs).waveform # Output is a tensor of shape [batch_size, waveform_length]
13
+
14
+ output_audio = output.squeeze(0).numpy() # Remove batch dimension
15
+ wavfile.write("spanish.wav", rate=model.config.sampling_rate, data=output_audio)
16
+
vocab.json ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ " ": 27,
3
+ "0": 5,
4
+ "1": 24,
5
+ "2": 36,
6
+ "3": 32,
7
+ "4": 12,
8
+ "5": 6,
9
+ "6": 44,
10
+ "7": 0,
11
+ "8": 8,
12
+ "9": 23,
13
+ "_": 22,
14
+ "a": 1,
15
+ "b": 31,
16
+ "c": 3,
17
+ "d": 29,
18
+ "e": 39,
19
+ "f": 25,
20
+ "g": 34,
21
+ "h": 19,
22
+ "i": 37,
23
+ "j": 33,
24
+ "k": 15,
25
+ "l": 35,
26
+ "m": 13,
27
+ "n": 20,
28
+ "o": 41,
29
+ "p": 9,
30
+ "q": 18,
31
+ "r": 43,
32
+ "s": 16,
33
+ "t": 26,
34
+ "u": 38,
35
+ "v": 2,
36
+ "x": 28,
37
+ "y": 10,
38
+ "z": 11,
39
+ "á": 17,
40
+ "é": 21,
41
+ "í": 30,
42
+ "ñ": 42,
43
+ "ó": 7,
44
+ "ú": 40,
45
+ "ü": 14,
46
+ "—": 4
47
+ }