Giter Club home page Giter Club logo

Comments (2)

nipengmath avatar nipengmath commented on July 18, 2024

`def process_text(train_text_path):

hparams = hp_tacotron2.create_hparams()
hparams.sampling_rate = hp.sample_rate

checkpoint_path = os.path.join("Tacotron2", os.path.join(
    "pre_trained_model", "tacotron2_statedict.pt"))

tacotron2 = train_tacotron2.load_model(hparams)
state_dict = torch.load(checkpoint_path)['state_dict']

tacotron2.load_state_dict(state_dict)
_ = tacotron2.cuda().eval().half()

with open(train_text_path, "r", encoding="utf-8") as f:
    inx = 0
    txt = []
    for line in f.readlines():
        cnt = 0
        l = line.strip().split("|")
        cid = l[0]
        n = int(cid.replace(".npy", "").split("-")[-1])
        text_seq = l[-1]
        sequence = np.array(text_to_sequence(text_seq, hp.text_cleaners))[None, :]
        sequence = torch.autograd.Variable(
            torch.from_numpy(sequence)).cuda().long()

        mel, mel_postnet, _, alignment = tacotron2.inference(sequence)
        alignment = alignment.float().data.cpu().numpy()[0]
        alignment = get_D(alignment)

        np.save("alignment_targets/%s.npy" %n, alignment)

    return txt`

this is my alignment, but i don't know if it is right @xcmyz

from fastspeech.

SerialLain3170 avatar SerialLain3170 commented on July 18, 2024

Thanks. I'll try it

from fastspeech.

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.