Skip to content

Commit

Permalink
nits and minor improvements (#384)
Browse files Browse the repository at this point in the history
* Update utils.py

Sorting once is sufficient

* Update utils.py, nit

* Update executor.py
  • Loading branch information
vikcost authored Nov 14, 2024
1 parent e9bbf73 commit 4fdc23a
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
1 change: 0 additions & 1 deletion wespeaker/utils/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ def run_epoch(dataloader, epoch_iter, model, criterion, optimizer, scheduler,
features = spec_aug(features,
**configs['dataset_args']['spec_aug_args'])

with torch.cuda.amp.autocast(enabled=configs['enable_amp']):
outputs = model(features) # (embed_a,embed_b) in most cases
embeds = outputs[-1] if isinstance(outputs, tuple) else outputs
outputs = model.module.projection(embeds, targets)
Expand Down
3 changes: 1 addition & 2 deletions wespeaker/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,9 @@ def set_seed(seed=42):

def spk2id(utt_spk_list):
_, spk_list = zip(*utt_spk_list)
spk_list = sorted(list(set(spk_list))) # remove overlap and sort
spk_list = sorted(set(spk_list)) # remove overlap and sort

spk2id_dict = {}
spk_list.sort()
for i, spk in enumerate(spk_list):
spk2id_dict[spk] = i
return spk2id_dict

0 comments on commit 4fdc23a

Please sign in to comment.