Git Product home page Git Product logo

numeric-t5's People

Contributors

lesterpjy avatar yintrigue avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

stjordanis

numeric-t5's Issues

Error when reading in model checkpoint

Hi,

I'd like to read in the model and convert it to PyTorch.

I use the following code snippet to read in the weights:

from transformers import T5Tokenizer, TFT5ForConditionalGeneration

tokenizer = T5Tokenizer.from_pretrained('t5-small')
model = TFT5ForConditionalGeneration.from_pretrained('t5-small')
model.compile()
model.load_weights("/content/drive/MyDrive/NT5/Checkpoints/model_chkpt_e_42_vl_0.04173539.h5")

The checkpoint is stored in my local Drive.

However, this is giving me the following error:

All model checkpoint layers were used when initializing TFT5ForConditionalGeneration.

All the layers of TFT5ForConditionalGeneration were initialized from the model checkpoint at t5-small.
If your task is similar to the task the model of the checkpoint was trained on, you can already use TFT5ForConditionalGeneration for predictions without further training.
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-5-afea930cf1a9> in <module>()
      4 model = TFT5ForConditionalGeneration.from_pretrained('t5-small')
      5 #model.compile()
----> 6 model.load_weights("/content/drive/MyDrive/NT5/Checkpoints/model_chkpt_e_42_vl_0.04173539.h5")

1 frames
/usr/local/lib/python3.7/dist-packages/tensorflow/python/keras/engine/training.py in load_weights(self, filepath, by_name, skip_mismatch, options)
   2232             f, self.layers, skip_mismatch=skip_mismatch)
   2233       else:
-> 2234         hdf5_format.load_weights_from_hdf5_group(f, self.layers)
   2235 
   2236   def _updated_config(self):

/usr/local/lib/python3.7/dist-packages/tensorflow/python/keras/saving/hdf5_format.py in load_weights_from_hdf5_group(f, layers)
    686                      'containing ' + str(len(layer_names)) +
    687                      ' layers into a model with ' + str(len(filtered_layers)) +
--> 688                      ' layers.')
    689 
    690   # We batch weight value assignments in a single backend call

ValueError: You are trying to load a weight file containing 4 layers into a model with 3 layers.

How to resolve this?

Notebook to reproduce: https://colab.research.google.com/drive/1vVORlnUAv1Tre71gEoh14C1fZvig0Vd1?usp=sharing

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.