Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decode without beam search #68

Open
Khanifsaleh opened this issue Jul 6, 2021 · 0 comments
Open

Decode without beam search #68

Khanifsaleh opened this issue Jul 6, 2021 · 0 comments

Comments

@Khanifsaleh
Copy link

Hi, what a amazing repository.

After got out/logits of model, how to decode it without beamsearch?
i've been run like this in my model
( and I have id2labels

{0: "'", 1: ' ', 2: 'a', 3: 'b', 4: 'c', 5: 'd', 6: 'e', 7: 'f', 8: 'g', 9: 'h', 10: 'i', 11: 'j', 12: 'k', 13: 'l', 14: 'm', 15: 'n', 16: 'o', 17: 'p', 18: 'q', 19: 'r', 20: 's', 21: 't', 22: 'u', 23: 'v', 24: 'w', 25: 'x', 26: 'y', 27: 'z', 28: '_'}

)

with torch.no_grad():
        log_mel = featurizer(waveform).unsqueeze(1)
        out, hidden = model(log_mel, hidden)
        out = torch.nn.functional.softmax(out, dim=2)
        out = out.transpose(0, 1)
        pred_ids = torch.argmax(out, -1)
        preds = [id2label[i] for i in pred_ids[0].tolist() if id2label[i]!='_']

is that right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant