-
Notifications
You must be signed in to change notification settings - Fork 515
Open
Description
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
Labels
No labels