Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[lint] format files #2296

Merged
merged 1 commit into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions wenet/bin/average_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@ def main():
if args.mode == "hybrid":
yamls = glob.glob('{}/*.yaml'.format(args.src_path))
yamls = [
f for f in yamls if not (os.path.basename(f).startswith('train')
or os.path.basename(f).startswith('init'))
f for f in yamls
if not (os.path.basename(f).startswith('train')
or os.path.basename(f).startswith('init'))
]
elif args.mode == "step":
yamls = glob.glob('{}/step_*.yaml'.format(args.src_path))
Expand Down
8 changes: 6 additions & 2 deletions wenet/ctl_model/asr_model_ctl.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ def __init__(
@torch.jit.ignore(drop=True)
def forward(
self,
batch: dict,
device: torch.device,
) -> Dict[str, Optional[torch.Tensor]]:

speech = batch['feats'].to(device)
Expand Down Expand Up @@ -145,7 +147,8 @@ def forward_full(
elif loss_att is None:
loss = loss_ctc
else:
loss = self.ctc_weight * loss_ctc[0] + (1 - self.ctc_weight) * loss_att
loss = self.ctc_weight * loss_ctc[0] + (1 -
self.ctc_weight) * loss_att
return loss, encoder_out, encoder_out_lens, encoder_mask

def forward_chunk(
Expand Down Expand Up @@ -193,7 +196,8 @@ def forward_chunk(
elif loss_att is None:
loss = loss_ctc
else:
loss = self.ctc_weight * loss_ctc[0] + (1 - self.ctc_weight) * loss_att
loss = self.ctc_weight * loss_ctc[0] + (1 -
self.ctc_weight) * loss_att
return loss, encoder_out, encoder_out_lens, encoder_mask

def sample_negatives(self, y, num, padding_count=0, speech_lengths=None):
Expand Down
3 changes: 1 addition & 2 deletions wenet/utils/init_tokenizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ def init_tokenizer(configs) -> BaseTokenizer:
configs['tokenizer_conf']['non_lang_syms_path'],
split_with_space=configs['tokenizer_conf'].get(
'split_with_space', False),
connect_symbol=configs['tokenizer_conf'].get(
'connect_symbol', ''))
connect_symbol=configs['tokenizer_conf'].get('connect_symbol', ''))
elif tokenizer_type == "bpe":
tokenizer = BpeTokenizer(
configs['tokenizer_conf']['bpe_path'],
Expand Down
Loading