xvector

Copyright 2014-2020 Yevhenii Prokopalo, Anthony Larcher

class nnet.xvector.Xtractor(speaker_number, model_archi=None)[source]

Class that defines an x-vector extractor based on 5 convolutional layers and a mean standard deviation pooling

forward(x, is_eval=False)[source]
Parameters
  • x

  • is_eval

Returns

sequence_network_weight_decay = None

Prepapre last part of the network (after pooling)

nnet.xvector.cross_validation(model, validation_loader, device)[source]
Parameters
  • model

  • validation_loader

  • device

Returns

nnet.xvector.extract_idmap(args, segment_indices, fs_params, idmap_name, output_queue)[source]

Function that takes a model and an idmap and extract all x-vectors based on this model and return a StatServer containing the x-vectors

Parameters
  • args

  • segment_indices

  • fs_params

  • idmap_name

  • output_queue

Returns

nnet.xvector.extract_parallel(args, fs_params)[source]
Parameters
  • args

  • fs_params

Returns

nnet.xvector.get_lr(optimizer)[source]
Parameters

optimizer

Returns

nnet.xvector.save_checkpoint(state, is_best, filename='checkpoint.pth.tar', best_filename='model_best.pth.tar')[source]
Parameters
  • state

  • is_best

  • filename

  • best_filename

Returns

nnet.xvector.train_epoch(model, epoch, training_loader, optimizer, log_interval, device, clipping=False)[source]
Parameters
  • model

  • epoch

  • training_loader

  • optimizer

  • log_interval

  • device

  • clipping

Returns

nnet.xvector.xtrain(speaker_number, dataset_yaml, epochs=100, lr=0.01, model_yaml=None, model_name=None, tmp_model_name=None, best_model_name=None, multi_gpu=True, clipping=False, num_thread=1)[source]
Parameters
  • speaker_number

  • dataset_yaml

  • epochs

  • lr

  • model_yaml

  • model_name

  • tmp_model_name

  • best_model_name

  • multi_gpu

  • clipping

  • num_thread

Returns