mzboito commited on
Commit
814c648
1 Parent(s): 218c13c

config.json

Browse files
Files changed (3) hide show
  1. config.json +80 -0
  2. config.yaml +0 -24
  3. inference_code/run_inference.py +1 -12
config.json ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "naver/mHuBERT-147-ASR-fr",
3
+ "activation_dropout": 0.1,
4
+ "add_interface": true,
5
+ "apply_spec_augment": true,
6
+ "architectures": [
7
+ "MHubertForCTC"
8
+ ],
9
+ "attention_dropout": 0.1,
10
+ "bos_token_id": 1,
11
+ "classifier_proj_size": 256,
12
+ "conv_bias": false,
13
+ "conv_dim": [
14
+ 512,
15
+ 512,
16
+ 512,
17
+ 512,
18
+ 512,
19
+ 512,
20
+ 512
21
+ ],
22
+ "conv_kernel": [
23
+ 10,
24
+ 3,
25
+ 3,
26
+ 3,
27
+ 3,
28
+ 2,
29
+ 2
30
+ ],
31
+ "conv_stride": [
32
+ 5,
33
+ 2,
34
+ 2,
35
+ 2,
36
+ 2,
37
+ 2,
38
+ 2
39
+ ],
40
+ "ctc_loss_reduction": "mean",
41
+ "ctc_token_id": 174,
42
+ "ctc_zero_infinity": false,
43
+ "do_stable_layer_norm": false,
44
+ "eos_token_id": 2,
45
+ "feat_extract_activation": "gelu",
46
+ "feat_extract_dropout": 0.0,
47
+ "feat_extract_norm": "group",
48
+ "feat_proj_dropout": 0.1,
49
+ "feat_proj_layer_norm": true,
50
+ "final_dropout": 0.3,
51
+ "fine_tuning_strategy": "all",
52
+ "gradient_checkpointing": false,
53
+ "hidden_act": "gelu",
54
+ "hidden_dropout": 0.1,
55
+ "hidden_dropout_prob": 0.1,
56
+ "hidden_size": 768,
57
+ "initializer_range": 0.02,
58
+ "intermediate_size": 3072,
59
+ "layer_norm_eps": 1e-05,
60
+ "layerdrop": 0.1,
61
+ "mask_feature_length": 10,
62
+ "mask_feature_min_masks": 0,
63
+ "mask_feature_prob": 0.0,
64
+ "mask_time_length": 10,
65
+ "mask_time_min_masks": 2,
66
+ "mask_time_prob": 0.05,
67
+ "model_type": "hubert",
68
+ "num_attention_heads": 12,
69
+ "num_conv_pos_embedding_groups": 16,
70
+ "num_conv_pos_embeddings": 128,
71
+ "num_feat_extract_layers": 7,
72
+ "num_hidden_layers": 12,
73
+ "num_interface_layers": 3,
74
+ "pad_token_id": 173,
75
+ "tokenizer_class": "Wav2Vec2CTCTokenizer",
76
+ "torch_dtype": "float32",
77
+ "transformers_version": "4.32.0",
78
+ "use_weighted_layer_sum": false,
79
+ "vocab_size": 175
80
+ }
config.yaml DELETED
@@ -1,24 +0,0 @@
1
- group_by_length: True
2
- evaluation_strategy: "steps"
3
- num_train_epochs: 100
4
- fp16: False
5
- gradient_checkpointing: True
6
- eval_steps: 10000
7
- save_steps: 10000
8
- logging_steps: 10000
9
- learning_rate: 1e-4
10
- adam_beta1: 0.9
11
- adam_beta2: 0.98
12
- adam_epsilon: 1e-08
13
- warmup_ratio: 0.2
14
- save_total_limit: 4
15
- load_best_model_at_end: True
16
- per_device_train_batch_size: 8
17
- per_device_eval_batch_size: 2
18
- metric_for_best_model: "cer"
19
- greater_is_better: False
20
- gradient_accumulation_steps: 8
21
- final_dropout: 0.3
22
- seed: 3452
23
- add_interface_layer: True
24
- num_interface_layers: 3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
inference_code/run_inference.py CHANGED
@@ -16,23 +16,12 @@ fbk_test_id = 'FBK-MT/Speech-MASSIVE-test'
16
  mhubert_id = 'utter-project/mHuBERT-147'
17
 
18
  def load_asr_model():
19
- def init_config():
20
- config = HubertConfig.from_pretrained(mhubert_id)
21
- config.pad_token_id = processor.tokenizer.pad_token_id
22
- config.ctc_token_id = processor.tokenizer.convert_tokens_to_ids('[CTC]')
23
- config.vocab_size = len(processor.tokenizer)
24
-
25
- config.output_hidden_states = False
26
- config.add_interface = True
27
- config.num_interface_layers = 3
28
- return config
29
-
30
  # Load the ASR model
31
  tokenizer = Wav2Vec2CTCTokenizer('vocab.json', unk_token="[UNK]", pad_token="[PAD]", word_delimiter_token="|")
32
  feature_extractor = Wav2Vec2FeatureExtractor.from_pretrained(mhubert_id)
33
  processor = Wav2Vec2Processor(feature_extractor=feature_extractor, tokenizer=tokenizer)
34
 
35
- config = init_config()
36
  model = mHubertForCTC.from_pretrained("naver/mHuBERT-147-ASR-fr", config=config)
37
  model.eval()
38
  return model, processor
 
16
  mhubert_id = 'utter-project/mHuBERT-147'
17
 
18
  def load_asr_model():
 
 
 
 
 
 
 
 
 
 
 
19
  # Load the ASR model
20
  tokenizer = Wav2Vec2CTCTokenizer('vocab.json', unk_token="[UNK]", pad_token="[PAD]", word_delimiter_token="|")
21
  feature_extractor = Wav2Vec2FeatureExtractor.from_pretrained(mhubert_id)
22
  processor = Wav2Vec2Processor(feature_extractor=feature_extractor, tokenizer=tokenizer)
23
 
24
+ config = HubertConfig.from_pretrained('config.json')
25
  model = mHubertForCTC.from_pretrained("naver/mHuBERT-147-ASR-fr", config=config)
26
  model.eval()
27
  return model, processor