Code Monkey home page Code Monkey logo

Comments (3)

nreimers avatar nreimers commented on August 22, 2024 1

Hi davidvscl,
I think the code will not work with Keras 2.1.1. The API changed significantly so that the CRF layer must be changed significantly. If you have done this, it would be great if you could share the code.

Sadly I cannot provide any insights how to port the code to 2.1.1 as I didn't yet have the time to run it with Keras 2

from emnlp2017-bilstm-cnn-crf.

nreimers avatar nreimers commented on August 22, 2024

Not sure why this happens.

You could change line 381 to:
'init': 'glorot_uniform'

Hopefully this fixes the issue.

Which keras version are you using?

from emnlp2017-bilstm-cnn-crf.

davidvcsl avatar davidvcsl commented on August 22, 2024

Hi! Same problem here! Changing line 381 as you suggested throws this error:

  File /BiLSTM.py, line 383, in evaluate
    self.trainModel()
  File /BiLSTM.py, line 123, in trainModel
    self.model.train_on_batch(nnInput, labels)   
  File /lib/python3.5/site-packages/keras/engine/training.py, line 1808, in train_on_batch
    check_batch_axis=True)
  File /lib/python3.5/site-packages/keras/engine/training.py, line 1411, in _standardize_user_data
    exception_prefix='target')
  File /lib/python3.5/site-packages/keras/engine/training.py, line 153, in _standardize_input_data
    str(array.shape))
ValueError: Error when checking target: expected chain_crf_1 to have shape (None, None, 4) but got array with shape (2, 139, 1)

PD: I'm using Keras 2.1.1 (I'm trying to move code from Keras 1.2.2 to last one)

from emnlp2017-bilstm-cnn-crf.

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.