Git Product home page Git Product logo

neuralner's Introduction

NeuralNER

Implementation of Multilingual Neural NER mentioned in the paper "Judicious Selection of Training Data in Assisting Language for Multilingual Neural NER, Rudra Murthy and Anoop Kunchukuttan and Dr. Pushpak Bhattacharyya, ACL 2018 , Melbourne, July 15-20, 2018"

Please read the Readme file here https://github.com/murthyrudra/NeuralNER/blob/master/NeuralNERMono/README.md on how to train the network. The multilingual learning code works but needs some polishing and there might be some errors. If any please raise an issue and I will immediately address the issue.

Important:

Please use a batch-size of 1. I found a bug with the code during test time when the batch size is greater than 1. To be safer, please use a batch-size of 1.

To-Do

  • NeuralNERMono code is polished. Update NeuralNERYang and NeuralNERAllShared with similar code standards
  • The system gives erroneous output when batch size is greater than 1.

Note:

Parts of the code are borrowed from NeuroNLP2 https://github.com/XuezheMax/NeuroNLP2/. Because of their code it was easier for me to convert my earlier Torch implementation to PyTorch.

neuralner's People

Contributors

murthyrudra avatar

Stargazers

Kalyan Guntupalli avatar Manuraj avatar Yong Jiang avatar  avatar yuanke avatar

Watchers

James Cloos avatar  avatar

neuralner's Issues

CRF intsead of softmax?

I want to use CRF instead of softmax(logsoftmax). How would you recommend doing it? There is a library "Pytorch-crf" available.

Different formats of the dataset

I am using spanish as primary and english as assisting language. Datasets are downloaded the links provided in the readme.

The format for spanish data is :
Melbourne B-LOC
( O
Australia B-LOC
) O

and the format for english data is :
EU NNP I-NP I-ORG
rejects VBZ I-VP O
German JJ I-NP I-MISC
call NN I-NP O

Do the above work, with the code provided in NeuralNERYang?

Invalid argument

While evaluating the model(NeuralNER)/NeuralNERMono/), --vocabTag is specified as the parameter but it doesn't exist.

Error in NeuralNERAllShared.py

Recieved Error :

in main()
82 use_gpu = torch.cuda.is_available()
83
---> 84 network = BiCNNLSTMTranstion(vocabularySize, embeddingDimension, min_filter_width, max_filter_width, len(charVocabulary), num_filters, hidden_size, len(tagVocabulary) , embedd_dict, beta)
85
86 lr = learning_rate

/content/modules.py in init(self, vocabularySize, embedDimension, minNgrams, maxNgrams, charInputDim, charOutDim, hiddenDim, tagSize, init_embedding, tagSizeAux)
79 self.logsoftmax = nn.LogSoftmax(dim=1)
80 self.nll_loss = nn.NLLLoss(size_average=True, reduce=False)
---> 81
82 self.language_weight = language_weight
83

/content/modules.py in init(self, inputDimension, outputDimension)
41
42 self.inputDimension = inputDimension
---> 43 self.outputDimension = outputDimension
44
45 self.linear = nn.Linear(self.inputDimension, self.outputDimension, bias = False)

/usr/local/lib/python3.6/dist-packages/torch/nn/modules/linear.py in init(self, in_features, out_features, bias)
74 self.in_features = in_features
75 self.out_features = out_features
---> 76 self.weight = Parameter(torch.Tensor(out_features, in_features))
77 if bias:
78 self.bias = Parameter(torch.Tensor(out_features))

TypeError: new() received an invalid combination of arguments - got (float, float), but expected one of:

  • (torch.device device)
  • (torch.Storage storage)
  • (Tensor other)
  • (tuple of ints size, torch.device device)
    didn't match because some of the arguments have invalid types: (!float!, !float!)
  • (object data, torch.device device)
    didn't match because some of the arguments have invalid types: (!float!, !float!)

NeuralNERmono printing embeddings

When I execute NeuralNer.py for monolingual , it is printing the whole embedding file. I don't understand why it is printing as such. I found that it is happening because of the line 124 from load_embeddings method. Please look into this

Difference in evaluation scores

I ran the code for Spanish and after 20 epochs, it showed that the test accuracy is 90.8% and F-score is 55%. Then I downloaded the annotated test file(after 19 epochs) and I evaluated the file using sklearn's f1-score. But this time I got the f1-score as 32%, though the accuracy is the same(90.8%). Why is there a difference in f1-scores between them?

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.