SprintInterface

This is a Sprint interface implementation, i.e. you would specify this module in your Sprint config. (Sprint = the RWTH ASR toolkit.) Note that there are multiple Sprint interface implementations provided. This one would be used explicitly, e.g. for forwarding in recognition or wherever else Sprint needs posteriors (a FeatureScorer). Most of the other Sprint interfaces will be used automatically, e.g. via ExternSprintDataset, when it spawns its Sprint subprocess.

class SprintInterface.Criterion[source]
error = None[source]
errorSignal = None[source]
gotErrorSignal = <threading._Event object>[source]
gotPosteriors = <threading._Event object>[source]
make_node(posteriors, seq_lengths)[source]
perform(node, inputs, output_storage, params=None)[source]
posteriors = None[source]
SprintInterface.demo()[source]
SprintInterface.dumpFlags()[source]
SprintInterface.exit()[source]
SprintInterface.feedInput(features, weights=None, segmentName=None)[source]
SprintInterface.feedInputAndTarget(features, weights=None, segmentName=None, orthography=None, alignment=None, speaker_name=None, speaker_gender=None, **kwargs)[source]
SprintInterface.feedInputAndTargetAlignment(features, targetAlignment, weights=None, segmentName=None)[source]
SprintInterface.feedInputAndTargetSegmentOrth(features, targetSegmentOrth, weights=None, segmentName=None)[source]
SprintInterface.feedInputForwarding(features, weights=None, segmentName=None)[source]
SprintInterface.feedInputUnsupervised(features, weights=None, segmentName=None)[source]
SprintInterface.finishDiscard()[source]
SprintInterface.finishError(error, errorSignal, naturalPairingType=None)[source]
SprintInterface.forward(segmentName, features)[source]
Parameters:features (numpy.ndarray) – format (input-feature,time) (via Sprint)

:return numpy.ndarray, format (output-dim,time)

SprintInterface.getFinalEpoch()[source]
SprintInterface.getSegmentList(corpusName, segmentList, **kwargs)[source]

Called by Sprint PythonSegmentOrder. Set python-segment-order = true in Sprint to use this.

If this is used, this gets called really early. If it is used together with the Sprint PythonTrainer, it will get called way earlier before the init() below. It might also get called multiple times, e.g. if Sprint is in interactive mode to calc the seg count. This is optional. You can use the SprintInterface only for the PythonTrainer.

Return type:list[str]

:returns segment list. Can also be an iterator.

SprintInterface.init(inputDim, outputDim, config, targetMode, **kwargs)[source]

Called by Sprint when it initializes the PythonTrainer. Set trainer = python-trainer in Sprint to enable. Note that Sprint will call this, i.e. the trainer init lazily quite late, only once it sees the first data.

Parameters:
  • config (str) – config string, passed by Sprint. assumed to be ”,”-separated
  • targetMode (str) – “target-alignment” or “criterion-by-sprint” or so
SprintInterface.initBase(configfile=None, targetMode=None, epoch=None)[source]
SprintInterface.initDataset()[source]
SprintInterface.prepareForwarding()[source]
SprintInterface.setTargetMode(mode)[source]
Parameters:mode (str) – target mode
SprintInterface.startTrainThread(epoch=None)[source]
SprintInterface.train(segmentName, features, targets=None)[source]
Parameters:
  • segmentName (str|None) – full name
  • features (numpy.ndarray) – 2d array
  • targets (numpy.ndarray|dict[str,numpy.ndarray]|None) – 2d or 1d array