Giter Club home page Giter Club logo

Comments (5)

HawkAaron avatar HawkAaron commented on August 18, 2024 4

Hi,
Recently, I write a greedy decoding for transducer:

    def greedy_decode(self, batch):
        x, y, x_lens, y_lens = self.collate(*batch)
        x = self.encode(x)[0]
        vy = autograd.Variable(torch.LongTensor([0]), volatile=True).view(1,1) # vector preserve for embedding
        y, h = self.dec_rnn(autograd.Variable(torch.zeros((1, 1, 256)), volatile=True)) # decode first zero 
        y_seq = []; logp = 0
        for i in x:
            out = self.fc1(i) + self.fc1(y[0][0])
            out = nn.functional.relu(out)
            out = self.fc2(out)
            out = F.log_softmax(out, dim=0)
            p, pred = torch.max(out, dim=0)
            pred = int(pred); logp += float(p)
            if pred != self.blank:
                y_seq.append(pred)
                vy.data[0][0] = pred # change pm state
                y = self.embedding(vy)
                y, h = self.dec_rnn(y, h)
        return [y_seq]

This code can be placed in your transducer_model.py file. Here just support one sequence per batch.

After decoding, PER is 24.4% in your training model ( maybe not converged).

It seems that the training PER calculated in the CTC way doesn't make sense.

Beam search would be much better.

from speech.

smolendawid avatar smolendawid commented on August 18, 2024

It seems that the training PER calculated in the CTC way doesn't make sense.
@HawkAaron what do you mean?

from speech.

HawkAaron avatar HawkAaron commented on August 18, 2024

@smolendawid what you said is exactly what I mean.
Since the CTC transition topology is almost the same with HMM, the greedy search can be treated as viterbi decode. But the transition of RNN Transducer is two dimensional, decode any one of them doesn't make any sense.

from speech.

Duum avatar Duum commented on August 18, 2024

@HawkAaron your greed decode implement is wrong. this will not find the best path
Here is my implement
you may need some change for your decoder.

from speech.

HawkAaron avatar HawkAaron commented on August 18, 2024

@Duum That is based on the assumption that one acoustic feature frame has at most one corresponding label.

To find more comparable paths, you can refer to my beam search implementation.

from speech.

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.