Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Inference for emotion is not implemented #572

@KansaiTraining

Description

@KansaiTraining

I have been trying s3prl for emotion recognition and reading the code
I have tried train and evaluate already but found out that there is a inference method.

def inference(self):
        filepath = Path(self.args.evaluate_split)
        assert filepath.is_file(), filepath
        filename = filepath.stem

        if hasattr(self.downstream.model, "load_audio"):
            wav = self.downstream.model.load_audio(filepath)
        else:
            wav, sr = torchaudio.load(str(filepath))
            if sr != SAMPLE_RATE:
                print(f"[INFO] Resampling from {sr} Hz to {SAMPLE_RATE} Hz")
                resampler = torchaudio.transforms.Resample(orig_freq=sr, new_freq=SAMPLE_RATE)
                wav = resampler(wav)
            # assert sr == SAMPLE_RATE, sr
        wavs = [wav.view(-1).to(self.args.device)]

        for entry in self.all_entries:
            entry.model.eval()

        with torch.no_grad():
            features = self.upstream.model(wavs)
            features = self.featurizer.model(wavs, features)
            self.downstream.model.inference(features, [filename])

it seems this method is not documented.
Also does this works only on some downstream tasks? I ask these because for emotion I got that

AttributeError: 'DownstreamExpert' object has no attribute 'inference'

Is this not impemented, in plans to be implemented or what is the state on this?
Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions