-
Notifications
You must be signed in to change notification settings - Fork 267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pb running NER_Keras.py code with Keras 1.0.3 #3
Comments
Dear G., embedding = Embedding(output_dim=embeddings.shape[1], input_dim=embeddings.shape[0], input_length=numInputUnits, weights=[embeddings]) Maybe this works for you too. |
Hi, if I remember well, the problem was caused by the SharedX import, which causes trouble in newer versions. You can comment that import out and instead define these in the FixedEmbeddings.py:
Then it shall work also in newer versions. Cheers, |
@beinborn : thanks Lisa. I followed your post and it works fine. |
But I don't get the performance announced by Nils (F-score around 0.7). Here are my benchmark: |
Thanks great tutorial. The NER_Keras.py implements the word-level method. How to implement the sentence-level log likelihood method for NER ? Can anybody give some hints ? |
@stone8oy Currently Keras is not supporting this. You would need to implement a HMM model by yourself and add it to Keras. However, there is a CRF model for Keras which can be found in the keras contrib. repository. This is quite similar to the STC model for Keras. In the near future (within this month), I will also publish some code on Github that includes a CRF model for Keras. |
Dear Nils,
First of all thanks a lot for the great tutorial. I'm learning a lot watching your videos and reading through your code.
I naively wanted to run our implementation of the SENNA model with Keras and cannot make it work even after trying many things and spending of lot of time on forums dedicated to Theano and Keras.
For the record, I think it has something to do with The FixEmbedding layer and/or my version of Keras==1.0.3. I'm running Python 3.5 but I fixed all print and unicode trivial issues in the code so it should not be a pb with compatibility with Python 3.
Here is the traceback:
Traceback (most recent call last):
File "NER_Keras.py", line 126, in
model.add(FixedEmbedding(output_dim=embeddings.shape[1], input_dim=embeddings.shape[0], input_length=n_in, weights=[embeddings]))
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/keras/models.py", line 114, in add
layer.create_input_layer(batch_input_shape, input_dtype)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/keras/engine/topology.py", line 341, in create_input_layer
self(x)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/keras/engine/topology.py", line 458, in call
self.build(input_shapes[0])
TypeError: build() takes 1 positional argument but 2 were given
Thanks for your help.
G.
The text was updated successfully, but these errors were encountered: