Giter VIP home page Giter VIP logo

Comments (11)

dathudeptrai avatar dathudeptrai commented on May 15, 2024 1

@linhld0811 cay you try

pretrained_config.vocab_size = NEW_VOCAB_SIZE
tacotron2 = TFTacotron2(pretrained_config, training=True, name='tacotron2')
tacotron2._build()
tacotron2.summary()
tacotron2.load_weights(path, by_name=True, skip_mismatch=True)

....

btw, what is ur tensorflow version ?

from tensorflowtts.

dathudeptrai avatar dathudeptrai commented on May 15, 2024 1

@linhld0811 no i mean this code, i just test and it worked.

    pretrained_config = Tacotron2Config(**config["tacotron2_params"])
    pretrained_config.vocab_size = NEW_VOCAB_SIZE
    tacotron2 = TFTacotron2(config=pretrained_config, training=True, name='tacotron2')
    tacotron2._build()
    tacotron2.summary()
    tacotron2.load_weights("./examples/tacotron2/exp/train.tacotron2.v1/checkpoints/model-120000.h5", by_name=True, skip_mismatch=True)

from tensorflowtts.

dathudeptrai avatar dathudeptrai commented on May 15, 2024 1

@sujeendran no, the code should be like this, do not need re build and redefine embedding layer

    pretrained_config = Tacotron2Config(**config["tacotron2_params"])
    pretrained_config.vocab_size = NEW_VOCAB_SIZE
    tacotron2 = TFTacotron2(config=pretrained_config, training=True, name='tacotron2')
    tacotron2._build()
    tacotron2.summary()
    tacotron2.load_weights("./examples/tacotron2/exp/train.tacotron2.v1/checkpoints/model-120000.h5", by_name=True, skip_mismatch=True)

from tensorflowtts.

linhld0811 avatar linhld0811 commented on May 15, 2024

Here my code:

tacotron2 = TFTacotron2(config=Tacotron2Config(**config["tacotron2_params"]), training=True, name='tacotron2')
    tacotron2._build()
    #tacotron2.summary()
    if args.pretrained_model != None:
        print("use pretrained_model ljspeech", args.pretrained_model)
        tacotron2.load_weights(args.pretrained_model)
        pretrained_config = Tacotron2Config(**config["tacotron2_params"])
        pretrained_config.set_params(len(symbols))
        print("vocab_size of new model:", pretrained_config.vocab_size)
        new_embedding_layers = TFTacotronEmbeddings(pretrained_config, name='embeddings')
        tacotron2.encoder.embeddings = new_embedding_layers
        tacotron2._build()
        tacotron2.summary()

I use TF version 2.2.0

from tensorflowtts.

linhld0811 avatar linhld0811 commented on May 15, 2024

Thanks, i fixed this error. I loaded model but did not use the param skip_mismatch=True of the function tacotron2.load_weights

from tensorflowtts.

dathudeptrai avatar dathudeptrai commented on May 15, 2024

@sujeendran Fixed.

from tensorflowtts.

linhld0811 avatar linhld0811 commented on May 15, 2024

I have a question, can you help me to figured out:

  • Can i use your pretrained tacotron2 model to extract duration of my own dataset(not english) to teach fastspeech model?! Or i have to training tacotron2 model on my dataset and use best_model to extract duration?!

from tensorflowtts.

dathudeptrai avatar dathudeptrai commented on May 15, 2024

You cannot do that :))

from tensorflowtts.

sujeendran avatar sujeendran commented on May 15, 2024

@dathudeptrai I tried the same. Didn't work. I'm also running Tensorflow 2.2.0. To be clear, here is the code after your fix:

    pretrained_config = Tacotron2Config(**config["tacotron2_params"])
    tacotron2 = TFTacotron2(pretrained_config, training=True, name='tacotron2')
    tacotron2._build()
    tacotron2.summary()
    tacotron2.load_weights("./examples/tacotron2/exp/train.tacotron2.v1/checkpoints/model-1400.h5", by_name=True, skip_mismatch=True)
    pretrained_config.vocab_size = len(symbols)
    new_embedding_layers = TFTacotronEmbeddings(pretrained_config, name='embeddings')
    tacotron2.encoder.embeddings = new_embedding_layers
    # re-build model
    tacotron2._build()
    tacotron2.summary()

from tensorflowtts.

sujeendran avatar sujeendran commented on May 15, 2024

@dathudeptrai Oh, in that case my fix was doing the same. Thanks! :) Maybe you can update the documentation for fine-tuning now that this is clear so others don't fall into this issue again.

from tensorflowtts.

dathudeptrai avatar dathudeptrai commented on May 15, 2024

Yeah i will update it asap :))) maybe add some flags :3

from tensorflowtts.

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.