ertk.preprocessing.fairseq.FairseqExtractor

class ertk.preprocessing.fairseq.FairseqExtractor(config: FairseqExtractorConfig)

Bases: FeatureExtractor, AudioClipProcessor

Fairseq processor.

__init__(config: FairseqExtractorConfig) None

Methods

__init__(config)

process_file(path[, sr])

Process individual audio file.

process_instance(x, **kwargs)

Process a single audio clip.

Inherited Methods

finish()

Perform any cleanup necesasry (e.g.

friendly_name()

Get the friendly name for this processor.

get_config_type()

Get the configuration type for this processor.

get_default_config()

Get the default configuration for this processor.

get_processor_class(name)

Get the class for the named processor.

make_processor(name, config)

Create an instance of the named processor.

process_all(xs, batch_size, **kwargs)

Process all instances in batches.

process_batch(batch, **kwargs)

Process a batch of instances.

process_files(paths, batch_size[, sr])

Process a set of files.

valid_processors()

Get a list of all registered processor names.

Attributes

dim

The dimensionality of the extracted features.

feature_names

The names of the features produced by this processor.

is_sequence

Whether this FeatureExtractor yields sequence features.

config

The configuration for this processor.

config: FairseqExtractorConfig

The configuration for this processor.

property dim: int

The dimensionality of the extracted features.

property feature_names: List[str]

The names of the features produced by this processor.

property is_sequence: bool

Whether this FeatureExtractor yields sequence features.

process_file(path: PathLike | str, sr: float | None = None) ndarray

Process individual audio file.

Parameters:
path: pathlike or str

The path to an audio file.

sr: float, optional

Target sample rate. If not given, then each audio file is loaded with its native sample rate. Otherwise audio data is resampled to this sample rate.

Returns:
processed: np.ndarray

Processed instance.

process_instance(x: ndarray, **kwargs) ndarray

Process a single audio clip.

Parameters:
x: np.ndarray

The audio data to process.

Returns:
result: np.ndarray

The processed instance.