Add model.pt + model.py/config from AeiROBOT (funasr.AutoModel PyTorch support)
#1
by HueyWoo - opened
- config.yaml +10 -10
- model.pt +3 -0
- model.py +2 -2
config.yaml
CHANGED
|
@@ -41,7 +41,7 @@ dataset_conf:
|
|
| 41 |
batch_sampler: BatchSampler
|
| 42 |
data_split_num: 1
|
| 43 |
batch_type: token
|
| 44 |
-
batch_size:
|
| 45 |
max_token_length: 2000
|
| 46 |
min_token_length: 60
|
| 47 |
max_source_length: 2000
|
|
@@ -49,7 +49,7 @@ dataset_conf:
|
|
| 49 |
max_target_length: 200
|
| 50 |
min_target_length: 0
|
| 51 |
shuffle: true
|
| 52 |
-
num_workers:
|
| 53 |
sos: 1
|
| 54 |
eos: 2
|
| 55 |
IndexDSJsonl: IndexDSJsonl
|
|
@@ -58,21 +58,21 @@ dataset_conf:
|
|
| 58 |
train_conf:
|
| 59 |
accum_grad: 1
|
| 60 |
grad_clip: 5
|
| 61 |
-
max_epoch:
|
| 62 |
-
keep_nbest_models:
|
| 63 |
avg_nbest_model: 10
|
| 64 |
log_interval: 1
|
| 65 |
resume: true
|
| 66 |
-
validate_interval:
|
| 67 |
-
save_checkpoint_interval:
|
| 68 |
use_deepspeed: false
|
| 69 |
-
deepspeed_config: /home/khw/
|
| 70 |
optim: adamw
|
| 71 |
optim_conf:
|
| 72 |
lr: 0.0002
|
| 73 |
scheduler: warmuplr
|
| 74 |
scheduler_conf:
|
| 75 |
-
warmup_steps:
|
| 76 |
specaug: SpecAugLFR
|
| 77 |
specaug_conf:
|
| 78 |
apply_time_warp: false
|
|
@@ -93,8 +93,8 @@ init_param: /home/khw/.cache/modelscope/hub/models/iic/SenseVoiceSmall/model.pt
|
|
| 93 |
config: /home/khw/.cache/modelscope/hub/models/iic/SenseVoiceSmall/config.yaml
|
| 94 |
is_training: true
|
| 95 |
trust_remote_code: true
|
| 96 |
-
train_data_set_list: /home/khw/
|
| 97 |
-
valid_data_set_list: /home/khw/
|
| 98 |
output_dir: ./outputs
|
| 99 |
model_path: /home/khw/.cache/modelscope/hub/models/iic/SenseVoiceSmall
|
| 100 |
device: cpu
|
|
|
|
| 41 |
batch_sampler: BatchSampler
|
| 42 |
data_split_num: 1
|
| 43 |
batch_type: token
|
| 44 |
+
batch_size: 3200
|
| 45 |
max_token_length: 2000
|
| 46 |
min_token_length: 60
|
| 47 |
max_source_length: 2000
|
|
|
|
| 49 |
max_target_length: 200
|
| 50 |
min_target_length: 0
|
| 51 |
shuffle: true
|
| 52 |
+
num_workers: 8
|
| 53 |
sos: 1
|
| 54 |
eos: 2
|
| 55 |
IndexDSJsonl: IndexDSJsonl
|
|
|
|
| 58 |
train_conf:
|
| 59 |
accum_grad: 1
|
| 60 |
grad_clip: 5
|
| 61 |
+
max_epoch: 1000
|
| 62 |
+
keep_nbest_models: 2
|
| 63 |
avg_nbest_model: 10
|
| 64 |
log_interval: 1
|
| 65 |
resume: true
|
| 66 |
+
validate_interval: 200
|
| 67 |
+
save_checkpoint_interval: 200
|
| 68 |
use_deepspeed: false
|
| 69 |
+
deepspeed_config: /home/khw/workspace_tk/SenseVoice/deepspeed_conf/ds_stage1.json
|
| 70 |
optim: adamw
|
| 71 |
optim_conf:
|
| 72 |
lr: 0.0002
|
| 73 |
scheduler: warmuplr
|
| 74 |
scheduler_conf:
|
| 75 |
+
warmup_steps: 200
|
| 76 |
specaug: SpecAugLFR
|
| 77 |
specaug_conf:
|
| 78 |
apply_time_warp: false
|
|
|
|
| 93 |
config: /home/khw/.cache/modelscope/hub/models/iic/SenseVoiceSmall/config.yaml
|
| 94 |
is_training: true
|
| 95 |
trust_remote_code: true
|
| 96 |
+
train_data_set_list: /home/khw/workspace_tk/SenseVoice/data/train_noise.jsonl
|
| 97 |
+
valid_data_set_list: /home/khw/workspace_tk/SenseVoice/data/val.jsonl
|
| 98 |
output_dir: ./outputs
|
| 99 |
model_path: /home/khw/.cache/modelscope/hub/models/iic/SenseVoiceSmall
|
| 100 |
device: cpu
|
model.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:036bca0e9b512e41778ff6fc45d41ceee221b34cae4af36dee59bd234cb550e2
|
| 3 |
+
size 2809160142
|
model.py
CHANGED
|
@@ -896,7 +896,7 @@ class SenseVoiceSmall(nn.Module):
|
|
| 896 |
align = ctc_forced_align(
|
| 897 |
logits_speech.unsqueeze(0).float(),
|
| 898 |
torch.Tensor(token_int[4:]).unsqueeze(0).long().to(logits_speech.device),
|
| 899 |
-
(encoder_out_lens-4).long(),
|
| 900 |
torch.tensor(len(token_int)-4).unsqueeze(0).long().to(logits_speech.device),
|
| 901 |
ignore_id=self.ignore_id,
|
| 902 |
)
|
|
@@ -907,7 +907,7 @@ class SenseVoiceSmall(nn.Module):
|
|
| 907 |
ts_max = encoder_out_lens[i] - 4
|
| 908 |
for pred_token, pred_frame in pred:
|
| 909 |
_end = _start + len(list(pred_frame))
|
| 910 |
-
if pred_token != 0:
|
| 911 |
ts_left = max((_start*60-30)/1000, 0)
|
| 912 |
ts_right = min((_end*60-30)/1000, (ts_max*60-30)/1000)
|
| 913 |
timestamp.append([tokens[token_id], ts_left, ts_right])
|
|
|
|
| 896 |
align = ctc_forced_align(
|
| 897 |
logits_speech.unsqueeze(0).float(),
|
| 898 |
torch.Tensor(token_int[4:]).unsqueeze(0).long().to(logits_speech.device),
|
| 899 |
+
(encoder_out_lens-4).long()[i],
|
| 900 |
torch.tensor(len(token_int)-4).unsqueeze(0).long().to(logits_speech.device),
|
| 901 |
ignore_id=self.ignore_id,
|
| 902 |
)
|
|
|
|
| 907 |
ts_max = encoder_out_lens[i] - 4
|
| 908 |
for pred_token, pred_frame in pred:
|
| 909 |
_end = _start + len(list(pred_frame))
|
| 910 |
+
if pred_token != 0 and token_id < len(tokens):
|
| 911 |
ts_left = max((_start*60-30)/1000, 0)
|
| 912 |
ts_right = min((_end*60-30)/1000, (ts_max*60-30)/1000)
|
| 913 |
timestamp.append([tokens[token_id], ts_left, ts_right])
|