Code Monkey home page Code Monkey logo

Comments (3)

hirofumi0810 avatar hirofumi0810 commented on June 8, 2024

@Cescfangs yes

from neural_sp.

Cescfangs avatar Cescfangs commented on June 8, 2024

@Cescfangs yes

Thanks for the reply, and I'm curious about the improvement of this mWER tuning, say 5% relative wer reduction?

from neural_sp.

Cescfangs avatar Cescfangs commented on June 8, 2024

class MBR(torch.autograd.Function):
"""Minimum Bayes Risk (MBR) training.
Args:
vocab (int): number of nodes in softmax layer
"""
@staticmethod
def forward(ctx, log_probs, hyps, exp_risk, grad_input):
"""Forward pass.
Args:
log_probs (FloatTensor): `[B * nbest, L, vocab]`
hyps (LongTensor): `[B * nbest, L]`
exp_risk (FloatTensor): `[1]` (for forward)
grad_input (FloatTensor): `[1]` (for backward)
Returns:
loss (FloatTensor): `[1]`
"""
ctx.save_for_backward(grad_input)
return exp_risk
@staticmethod
def backward(ctx, grad_output):
grads, = ctx.saved_tensors
# grads = torch.mul(grads, grad_output)
return grads, None, None, None

Also, I am a little confused about the “mbr” loss, the inputs are not used in backward function, how does the grad flow to model params?

from neural_sp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.