Giter Site home page Giter Site logo

Comments (2)

kerstenj avatar kerstenj commented on July 16, 2024

OK, so far, I managed to switch to keras imports + I realized that the output from a BertLayer needs to be expanded, e.g. by

bert_output = tf.expand_dims(bert_output, axis=-1)

This fails when I instantiate the model

self.model = Model(inputs = bert_inputs, outputs=all_outputs)

AttributeError: 'NoneType' object has no attribute '_inbound_nodes'

As stated here, wrapping using a Lambda layer should fix this issue. Since I am not familiar with this, I am facing a problem:

The shape of the bert result tensor is shape=(?, 768)
When I try to expand this to (?,768,1) with

bert_output = Lambda(lambda x: expand_dims(x, -1))(bert_output)

I get the following error:
Error converting shape to a TensorShape: int() argument must be a string, a bytes-like object or a number, not 'tuple'.

Thanks for any comments on this.

from keras-bert.

kerstenj avatar kerstenj commented on July 16, 2024

All right, it seems that using a Reshape layer does the trick:

    bert_output = BertLayer.BertLayer(n_fine_tune_layers=10)(bert_inputs) 
    bert_output_r = Reshape((768, 1))(bert_output)
    vanilla_model = YoonKimCNN(128, [3,4,5])

from keras-bert.

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.