Bidirectional LSTM-CRF and ELMo for Named-Entity Recognition, Part-of-Speech Tagging and so on.

Overview

anaGo

Codacy Badge

anaGo is a Python library for sequence labeling(NER, PoS Tagging,...), implemented in Keras.

anaGo can solve sequence labeling tasks such as named entity recognition (NER), part-of-speech tagging (POS tagging), semantic role labeling (SRL) and so on. Unlike traditional sequence labeling solver, anaGo don't need to define any language dependent features. Thus, we can easily use anaGo for any languages.

As an example of anaGo, the following image shows named entity recognition in English:

anaGo Demo

English NER

Get Started

In anaGo, the simplest type of model is the Sequence model. Sequence model includes essential methods like fit, score, analyze and save/load. For more complex features, you should use the anaGo modules such as models, preprocessing and so on.

Here is the data loader:

>>> from anago.utils import load_data_and_labels

>>> x_train, y_train = load_data_and_labels('train.txt')
>>> x_test, y_test = load_data_and_labels('test.txt')
>>> x_train[0]
['EU', 'rejects', 'German', 'call', 'to', 'boycott', 'British', 'lamb', '.']
>>> y_train[0]
['B-ORG', 'O', 'B-MISC', 'O', 'O', 'O', 'B-MISC', 'O', 'O']

You can now iterate on your training data in batches:

>>> import anago

>>> model = anago.Sequence()
>>> model.fit(x_train, y_train, epochs=15)
Epoch 1/15
541/541 [==============================] - 166s 307ms/step - loss: 12.9774
...

Evaluate your performance in one line:

>>> model.score(x_test, y_test)
0.802  # f1-micro score
# For more performance, you have to use pre-trained word embeddings.
# For now, anaGo's best score is 90.94 f1-micro score.

Or tagging text on new data:

>>> text = 'President Obama is speaking at the White House.'
>>> model.analyze(text)
{
    "words": [
        "President",
        "Obama",
        "is",
        "speaking",
        "at",
        "the",
        "White",
        "House."
    ],
    "entities": [
        {
            "beginOffset": 1,
            "endOffset": 2,
            "score": 1,
            "text": "Obama",
            "type": "PER"
        },
        {
            "beginOffset": 6,
            "endOffset": 8,
            "score": 1,
            "text": "White House.",
            "type": "LOC"
        }
    ]
}

To download a pre-trained model, call download function:

>>> from anago.utils import download

>>> url = 'https://s3-ap-northeast-1.amazonaws.com/dev.tech-sketch.jp/chakki/public/conll2003_en.zip'
>>> weights, params, preprocessor = download(url)
>>> model = anago.Sequence.load(weights, params, preprocessor)
>>> model.score(x_test, y_test)
0.909446369856927

If you want to use ELMo for better performance(f1: 92.22), you can use ELModel and ELMoTransformer:

# Transforming datasets.
p = ELMoTransformer()
p.fit(x_train, y_train)

# Building a model.
model = ELModel(...)
model, loss = model.build()
model.compile(loss=loss, optimizer='adam')

# Training the model.
trainer = Trainer(model, preprocessor=p)
trainer.train(x_train, y_train, x_test, y_test)

For futher details, see anago/examples/elmo_example.py.

Feature Support

anaGo supports following features:

  • Model Training
  • Model Evaluation
  • Tagging Text
  • Custom Model Support
  • Downloading pre-trained model
  • GPU Support
  • Character feature
  • CRF Support
  • Custom Callback Support
  • 💥 (new) ELMo

anaGo officially supports Python 3.4–3.6.

Installation

To install anaGo, simply use pip:

$ pip install anago

or install from the repository:

$ git clone https://github.com/Hironsan/anago.git
$ cd anago
$ python setup.py install

Documentation

(coming soon)

Reference

This library is based on the following papers:

Comments
  • Use markdown instead of reStructuredText for readme.

    Use markdown instead of reStructuredText for readme.

    PyPI doesn't support Markdown in long_description, so we use m2r to convert our markdown file to reStructuredText before and set that to our long_description in setup.py.

    opened by EmilStenstrom 12
  • ValueError: max() arg is an empty sequence

    ValueError: max() arg is an empty sequence

    When I run the code like below. I've got stack at the titled error. why??

    Using TensorFlow backend. 2018-05-22 11:47:25.286883: I tensorflow/core/platform/cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.2 AVX AVX2 FMA Epoch 1/15 Traceback (most recent call last): File "test.py", line 9, in model.train(x_train, y_train, x_valid, y_valid) File "/Users/norio.kosaka/anaconda3/envs/py36/lib/python3.6/site-packages/anago/wrapper.py", line 50, in train trainer.train(x_train, y_train, x_valid, y_valid) File "/Users/norio.kosaka/anaconda3/envs/py36/lib/python3.6/site-packages/anago/trainer.py", line 51, in train callbacks=callbacks) File "/Users/norio.kosaka/anaconda3/envs/py36/lib/python3.6/site-packages/keras/legacy/interfaces.py", line 91, in wrapper return func(*args, **kwargs) File "/Users/norio.kosaka/anaconda3/envs/py36/lib/python3.6/site-packages/keras/engine/training.py", line 2145, in fit_generator generator_output = next(output_generator) File "/Users/norio.kosaka/anaconda3/envs/py36/lib/python3.6/site-packages/keras/utils/data_utils.py", line 770, in get six.reraise(value.class, value, value.traceback) File "/Users/norio.kosaka/anaconda3/envs/py36/lib/python3.6/site-packages/six.py", line 693, in reraise raise value File "/Users/norio.kosaka/anaconda3/envs/py36/lib/python3.6/site-packages/keras/utils/data_utils.py", line 635, in _data_generator_task generator_output = next(self._generator) File "/Users/norio.kosaka/anaconda3/envs/py36/lib/python3.6/site-packages/anago/reader.py", line 137, in data_generator yield preprocessor.transform(X, y) File "/Users/norio.kosaka/anaconda3/envs/py36/lib/python3.6/site-packages/anago/preprocess.py", line 115, in transform sents, y = self.pad_sequence(words, chars, y) File "/Users/norio.kosaka/anaconda3/envs/py36/lib/python3.6/site-packages/anago/preprocess.py", line 148, in pad_sequence word_ids, sequence_lengths = pad_sequences(word_ids, 0) File "/Users/norio.kosaka/anaconda3/envs/py36/lib/python3.6/site-packages/anago/preprocess.py", line 197, in pad_sequences max_length = len(max(sequences, key=len)) ValueError: max() arg is an empty sequence

    import anago
    from anago.reader import load_data_and_labels
    
    x_train, y_train = load_data_and_labels('./data/train.txt')
    x_valid, y_valid = load_data_and_labels('./data/valid.txt')
    x_test, y_test = load_data_and_labels('./data/test.txt')
    
    model = anago.Sequence()
    model.train(x_train, y_train, x_valid, y_valid)
    model.eval(x_test, y_test)
    words = 'President Obama is speaking at the White House.'.split()
    model.analyze(words)
    
    opened by Rowing0914 8
  • Training is not working?

    Training is not working?

    import anago
    from anago.reader import load_data_and_labels
    
    data_path = "/tmp/anago/data/conll2003/en/ner"
    x_train, y_train = load_data_and_labels(data_path + '/train.txt')
    x_valid, y_valid = load_data_and_labels(data_path + '/valid.txt')
    model = anago.Sequence()
    model.train(x_train, y_train, x_valid, y_valid)
    

    Got error

    File "/Users/zzz/test/venv/lib/python3.6/site-packages/anago/wrapper.py", line 50, in train
        trainer.train(x_train, y_train, x_valid, y_valid)
      File "/Users/zzz/test/venv/lib/python3.6/site-packages/anago/trainer.py", line 38, in train
        optimizer=Adam(lr=self.training_config.learning_rate),
      File "/Users/zzz/test/venv/lib/python3.6/site-packages/keras/engine/training.py", line 827, in compile
        sample_weight, mask)
      File "/Users/zzz/test/venv/lib/python3.6/site-packages/keras/engine/training.py", line 426, in weighted
        score_array = fn(y_true, y_pred)
      File "/Users/zzz/test/venv/lib/python3.6/site-packages/anago/layers.py", line 321, in loss
        mask = self._fetch_mask()
      File "/Users/zzz/test/venv/lib/python3.6/site-packages/anago/layers.py", line 276, in _fetch_mask
        if self.inbound_nodes:
    AttributeError: 'ChainCRF' object has no attribute 'inbound_nodes'
    
    opened by gembin 8
  • Seems example code is outdated

    Seems example code is outdated

    System information

    • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Manjaro Linux update Sept 6, 2018
    • TensorFlow/Keras version: 1.8.0, 2.2.2
    • Python version: 3.6.5

    Describe the problem

    image

    I check the BiLSTMCRF class, I found no load function there.

    Source

    ''' Tagging example ''' import argparse import os from pprint import pprint

    from anago.tagger import Tagger from anago.models import BiLSTMCRF from anago.preprocessing import IndexTransformer

    def main(args): print("Loading objects...") model = BiLSTMCRF.load_model(args.weights_file, args.params_file) it = IndexTransformer.load(args.preprocessor_file) tagger = Tagger(model, preprocessor=it)

    print("Tagging a sentence...")
    res = tagger.analyze(args.sent)
    pprint(res)
    

    if name == 'main': SAVE_DIR = os.path.join(os.path.dirname(file), './mymodel') parser = argparse.ArgumentParser(description='Tagging a sentence.') parser.add_argument('--sent', default='Jokowi Kumpulkan Wali Kota Seluruh Indonesia, Airin Hadir') parser.add_argument('--save_dir', default=SAVE_DIR) parser.add_argument('--weights_file', default=os.path.join(SAVE_DIR, 'model_weights.h5')) parser.add_argument('--params_file', default=os.path.join(SAVE_DIR, 'params.json')) parser.add_argument('--preprocessor_file', default=os.path.join(SAVE_DIR, 'preprocessor.json')) args = parser.parse_args() main(args)

    opened by aviezab 5
  • F1 score of 0 for character level sequence labelling task

    F1 score of 0 for character level sequence labelling task

    Training data looks like: tra

    and training results look like: cmd

    Also worth adding that whenever I add a new period at the end of each character sequence, it never begins training and stops at Epoch 1/15 with no progress bar. I'll be happy to share training data with you if that will help reproduce the issue.

    opened by Timilehin 5
  • error happened at training

    error happened at training

    Thanks for sharing the code. Error happened when training is as follows, `Epoch 1/15 702/703 [============================>.] - ETA: 0s - loss: 62.9782 - f1: 84.33 703/703 [==============================] - 78s - loss: 62.8931
    Epoch 2/15 702/703 [============================>.] - ETA: 0s - loss: 60.5871 - f1: 87.10 703/703 [==============================] - 80s - loss: 60.5013
    Epoch 3/15 702/703 [============================>.] - ETA: 0s - loss: 59.9166 - f1: 89.38 703/703 [==============================] - 78s - loss: 59.8314
    Epoch 4/15 702/703 [============================>.] - ETA: 0s - loss: 59.1642 - f1: 89.96 703/703 [==============================] - 77s - loss: 59.0806
    Epoch 5/15 702/703 [============================>.] - ETA: 0s - loss: 59.6137 - f1: 90.65 703/703 [==============================] - 78s - loss: 59.5299
    Epoch 6/15 702/703 [============================>.] - ETA: 0s - loss: 59.4186 - f1: 90.61 703/703 [==============================] - 78s - loss: 59.3342
    Epoch 7/15 702/703 [============================>.] - ETA: 0s - loss: 59.5612 - f1: 91.40 703/703 [==============================] - 78s - loss: 59.4771
    Epoch 8/15 702/703 [============================>.] - ETA: 0s - loss: 59.3047 - f1: 91.13 703/703 [==============================] - 78s - loss: 59.2204
    Epoch 9/15 702/703 [============================>.] - ETA: 0s - loss: 59.5008

    UnimplementedError Traceback (most recent call last) in () 1 trainer = anago.Trainer(model_config, training_config, checkpoint_path=LOG_ROOT, save_path=SAVE_ROOT, 2 preprocessor=p, embeddings=embeddings) ----> 3 trainer.train(x_train, y_train, x_valid, y_valid)

    /home/hongzhi/wp/anago/anago/trainer.pyc in train(self, x_train, y_train, x_valid, y_valid) 52 steps_per_epoch=train_steps, 53 epochs=self.training_config.max_epoch, ---> 54 callbacks=callbacks) 55 56 # Save the model

    /home/hongzhi/anaconda2/lib/python2.7/site-packages/keras/legacy/interfaces.pyc in wrapper(*args, **kwargs) 85 warnings.warn('Update your ' + object_name + 86 ' call to the Keras 2 API: ' + signature, stacklevel=2) ---> 87 return func(*args, **kwargs) 88 wrapper._original_function = func 89 return wrapper

    /home/hongzhi/anaconda2/lib/python2.7/site-packages/keras/engine/training.pyc in fit_generator(self, generator, steps_per_epoch, epochs, verbose, callbacks, validation_data, validation_steps, class_weight, max_queue_size, workers, use_multiprocessing, shuffle, initial_epoch) 2040 outs = self.train_on_batch(x, y, 2041 sample_weight=sample_weight, -> 2042 class_weight=class_weight) 2043 2044 if not isinstance(outs, list):

    /home/hongzhi/anaconda2/lib/python2.7/site-packages/keras/engine/training.pyc in train_on_batch(self, x, y, sample_weight, class_weight) 1760 ins = x + y + sample_weights 1761 self._make_train_function() -> 1762 outputs = self.train_function(ins) 1763 if len(outputs) == 1: 1764 return outputs[0]

    /home/hongzhi/anaconda2/lib/python2.7/site-packages/keras/backend/tensorflow_backend.pyc in call(self, inputs) 2271 updated = session.run(self.outputs + [self.updates_op], 2272 feed_dict=feed_dict, -> 2273 **self.session_kwargs) 2274 return updated[:len(self.outputs)] 2275

    /home/hongzhi/anaconda2/lib/python2.7/site-packages/tensorflow/python/client/session.pyc in run(self, fetches, feed_dict, options, run_metadata) 787 try: 788 result = self._run(None, fetches, feed_dict, options_ptr, --> 789 run_metadata_ptr) 790 if run_metadata: 791 proto_data = tf_session.TF_GetBuffer(run_metadata_ptr)

    /home/hongzhi/anaconda2/lib/python2.7/site-packages/tensorflow/python/client/session.pyc in _run(self, handle, fetches, feed_dict, options, run_metadata) 995 if final_fetches or final_targets: 996 results = self._do_run(handle, final_targets, final_fetches, --> 997 feed_dict_string, options, run_metadata) 998 else: 999 results = []

    /home/hongzhi/anaconda2/lib/python2.7/site-packages/tensorflow/python/client/session.pyc in _do_run(self, handle, target_list, fetch_list, feed_dict, options, run_metadata) 1130 if handle is None: 1131 return self._do_call(_run_fn, self._session, feed_dict, fetch_list, -> 1132 target_list, options, run_metadata) 1133 else: 1134 return self._do_call(_prun_fn, self._session, handle, feed_dict,

    /home/hongzhi/anaconda2/lib/python2.7/site-packages/tensorflow/python/client/session.pyc in _do_call(self, fn, *args) 1150 except KeyError: 1151 pass -> 1152 raise type(e)(node_def, op, message) 1153 1154 def _extend_graph(self):

    UnimplementedError: TensorArray has size zero, but element shape [?,10] is not fully defined. Currently only static shapes are supported when packing zero-size TensorArrays. [[Node: chain_crf_2/TensorArrayStack/TensorArrayGatherV3 = TensorArrayGatherV3[_class=["loc:@chain_crf_2/TensorArray"], dtype=DT_FLOAT, element_shape=[?,10], _device="/job:localhost/replica:0/task:0/gpu:0"](chain_crf_2/TensorArray, chain_crf_2/TensorArrayStack/range, chain_crf_2/while/Exit_1)]] [[Node: training_1/Adam/gradients/bidirectional_2/while_1/Merge_2_grad/Switch/_887 = _Recvclient_terminated=false, recv_device="/job:localhost/replica:0/task:0/cpu:0", send_device="/job:localhost/replica:0/task:0/gpu:0", send_device_incarnation=1, tensor_name="edge_5628_training_1/Adam/gradients/bidirectional_2/while_1/Merge_2_grad/Switch", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/cpu:0"]]

    Caused by op u'chain_crf_2/TensorArrayStack/TensorArrayGatherV3', defined at: File "/home/hongzhi/anaconda2/lib/python2.7/runpy.py", line 174, in _run_module_as_main "main", fname, loader, pkg_name) File "/home/hongzhi/anaconda2/lib/python2.7/runpy.py", line 72, in _run_code exec code in run_globals File "/home/hongzhi/anaconda2/lib/python2.7/site-packages/ipykernel/main.py", line 3, in app.launch_new_instance() File "/home/hongzhi/anaconda2/lib/python2.7/site-packages/traitlets/config/application.py", line 653, in launch_instance app.start() File "/home/hongzhi/anaconda2/lib/python2.7/site-packages/ipykernel/kernelapp.py", line 474, in start ioloop.IOLoop.instance().start() File "/home/hongzhi/anaconda2/lib/python2.7/site-packages/zmq/eventloop/ioloop.py", line 162, in start super(ZMQIOLoop, self).start() File "/home/hongzhi/anaconda2/lib/python2.7/site-packages/tornado/ioloop.py", line 887, in start handler_func(fd_obj, events) File "/home/hongzhi/anaconda2/lib/python2.7/site-packages/tornado/stack_context.py", line 275, in null_wrapper return fn(*args, **kwargs) File "/home/hongzhi/anaconda2/lib/python2.7/site-packages/zmq/eventloop/zmqstream.py", line 440, in _handle_events self._handle_recv() File "/home/hongzhi/anaconda2/lib/python2.7/site-packages/zmq/eventloop/zmqstream.py", line 472, in _handle_recv self._run_callback(callback, msg) File "/home/hongzhi/anaconda2/lib/python2.7/site-packages/zmq/eventloop/zmqstream.py", line 414, in _run_callback callback(*args, **kwargs) File "/home/hongzhi/anaconda2/lib/python2.7/site-packages/tornado/stack_context.py", line 275, in null_wrapper return fn(*args, **kwargs) File "/home/hongzhi/anaconda2/lib/python2.7/site-packages/ipykernel/kernelbase.py", line 276, in dispatcher return self.dispatch_shell(stream, msg) File "/home/hongzhi/anaconda2/lib/python2.7/site-packages/ipykernel/kernelbase.py", line 228, in dispatch_shell handler(stream, idents, msg) File "/home/hongzhi/anaconda2/lib/python2.7/site-packages/ipykernel/kernelbase.py", line 390, in execute_request user_expressions, allow_stdin) File "/home/hongzhi/anaconda2/lib/python2.7/site-packages/ipykernel/ipkernel.py", line 196, in do_execute res = shell.run_cell(code, store_history=store_history, silent=silent) File "/home/hongzhi/anaconda2/lib/python2.7/site-packages/ipykernel/zmqshell.py", line 501, in run_cell return super(ZMQInteractiveShell, self).run_cell(*args, **kwargs) File "/home/hongzhi/anaconda2/lib/python2.7/site-packages/IPython/core/interactiveshell.py", line 2717, in run_cell interactivity=interactivity, compiler=compiler, result=result) File "/home/hongzhi/anaconda2/lib/python2.7/site-packages/IPython/core/interactiveshell.py", line 2827, in run_ast_nodes if self.run_code(code, result): File "/home/hongzhi/anaconda2/lib/python2.7/site-packages/IPython/core/interactiveshell.py", line 2881, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "", line 3, in trainer.train(x_train, y_train, x_valid, y_valid) File "anago/trainer.py", line 39, in train model = SeqLabeling(self.model_config, self.embeddings, len(self.preprocessor.vocab_tag)) File "anago/models.py", line 83, in init pred = self.crf(x) File "/home/hongzhi/anaconda2/lib/python2.7/site-packages/keras/engine/topology.py", line 602, in call output = self.call(inputs, **kwargs) File "anago/layers.py", line 314, in call y_pred = viterbi_decode(x, self.U, self.b_start, self.b_end, mask) File "anago/layers.py", line 106, in viterbi_decode mask) File "anago/layers.py", line 147, in _forward last, values, _ = K.rnn(_forward_step, inputs, initial_states) File "/home/hongzhi/anaconda2/lib/python2.7/site-packages/keras/backend/tensorflow_backend.py", line 2551, in rnn outputs = output_ta.stack() File "/home/hongzhi/anaconda2/lib/python2.7/site-packages/tensorflow/python/ops/tensor_array_ops.py", line 334, in stack return self.gather(math_ops.range(0, self.size()), name=name) File "/home/hongzhi/anaconda2/lib/python2.7/site-packages/tensorflow/python/ops/tensor_array_ops.py", line 360, in gather element_shape=element_shape) File "/home/hongzhi/anaconda2/lib/python2.7/site-packages/tensorflow/python/ops/gen_data_flow_ops.py", line 1814, in _tensor_array_gather_v3 element_shape=element_shape, name=name) File "/home/hongzhi/anaconda2/lib/python2.7/site-packages/tensorflow/python/framework/op_def_library.py", line 767, in apply_op op_def=op_def) File "/home/hongzhi/anaconda2/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 2506, in create_op original_op=self._default_original_op, op_def=op_def) File "/home/hongzhi/anaconda2/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 1269, in init self._traceback = _extract_stack()

    UnimplementedError (see above for traceback): TensorArray has size zero, but element shape [?,10] is not fully defined. Currently only static shapes are supported when packing zero-size TensorArrays. [[Node: chain_crf_2/TensorArrayStack/TensorArrayGatherV3 = TensorArrayGatherV3[_class=["loc:@chain_crf_2/TensorArray"], dtype=DT_FLOAT, element_shape=[?,10], _device="/job:localhost/replica:0/task:0/gpu:0"](chain_crf_2/TensorArray, chain_crf_2/TensorArrayStack/range, chain_crf_2/while/Exit_1)]] [[Node: training_1/Adam/gradients/bidirectional_2/while_1/Merge_2_grad/Switch/_887 = _Recvclient_terminated=false, recv_device="/job:localhost/replica:0/task:0/cpu:0", send_device="/job:localhost/replica:0/task:0/gpu:0", send_device_incarnation=1, tensor_name="edge_5628_training_1/Adam/gradients/bidirectional_2/while_1/Merge_2_grad/Switch", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/cpu:0"]] My environmentsanago (0.0.1) Keras (2.0.8) lazy-object-proxy (1.2.1) tensorflow-gpu (1.2.0) tensorflow-tensorboard (0.1.6) ` Any idea to fix it is appreciated, thanks.

    opened by zhhongzhi 5
  • setup error

    setup error

    setup.py line: 20 long_description = open(os.path.join(here, 'README.md')).read() --> long_description = open(os.path.join(here, 'README.md'), 'r', encoding='utf-8').read()

    else will get error: UnicodeDecodeError: 'gbk' codec can't decode byte 0x93 in position 3100: illegal multibyte sequence

    bug 
    opened by neolone 4
  • Stop trainning at epoch 4-5 although setting max epoch equals 20

    Stop trainning at epoch 4-5 although setting max epoch equals 20

    I am make custom data for my language for ner solution. But when use anago.train with our dataset, its stop at epoch 4-5 and don't show any error for fix?

    opened by trangtv57 4
  • Accuracy during epochs

    Accuracy during epochs

    Is there a way to print the accuracy during training epochs (not when an epoch is finished) ? i tried setting metrics=['sparse_categorical_accuracy'] inside trainer.py. But its giving me this message !

    AttributeError: 'ChainCRF' object has no attribute 'accuracy'

    opened by jodevak 4
  • Unable to execute the example given in the documentation

    Unable to execute the example given in the documentation

    Hi! I simply put together the code snippets to execute the example given in the README as follows:

    import os
    
    import anago
    from anago.utils import download
    from anago.reader import load_data_and_labels
    #from keras import backend as K
    
    x_train, y_train = load_data_and_labels('train.txt')
    x_valid, y_valid = load_data_and_labels('valid.txt')
    x_test, y_test = load_data_and_labels('test.txt')
    
    model = anago.Sequence()
    model.train(x_train, y_train, x_valid, y_valid)
    
    model.eval(x_test, y_test)
    #K.clear_session()
    
    words = 'President Obama is speaking at the White House.'.split()
    model.analyze(words)
    
    

    However, I am getting the following error during Epoch 10 (Apologies for the long message but I thought embedding the entire stack trace would help:: _``` Epoch 10/15 702/703 [============================>.] - ETA: 0s - loss: 59.00882018-05-30 09:42:27.923763: W tensorflow/core/framework/op_kernel.cc:1318] OP_REQUIRES failed at tensor_array_ops.cc:497 : Invalid argument: Tried to read from index -1 but array size is: 0 Traceback (most recent call last): File "/home/fussili/.local/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1322, in _do_call return fn(*args) File "/home/fussili/.local/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1307, in _run_fn options, feed_dict, fetch_list, target_list, run_metadata) File "/home/fussili/.local/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1409, in _call_tf_sessionrun run_metadata) tensorflow.python.framework.errors_impl.UnimplementedError: TensorArray has size zero, but element shape is not fully defined. Currently only static shapes are supported when packing zero-size TensorArrays. [[Node: training/Adam/gradients/loss/chain_crf_1_loss/TensorArrayUnstack/TensorArrayScatter/TensorArrayScatterV3_grad/TensorArrayGatherV3 = TensorArrayGatherV3[_class=["loc:@training/Adam/gradients/loss/chain_crf_1_loss/transpose_grad/transpose"], dtype=DT_FLOAT, element_shape=, _device="/job:localhost/replica:0/task:0/device:CPU:0"](training/Adam/gradients/loss/chain_crf_1_loss/TensorArrayUnstack/TensorArrayScatter/TensorArrayScatterV3_grad/TensorArrayGrad/TensorArrayGradV3, loss/chain_crf_1_loss/TensorArrayUnstack/range, training/Adam/gradients/loss/chain_crf_1_loss/while/TensorArrayReadV3/Enter_1_grad/b_acc_3)]]

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last): File "download_model.py", line 13, in model.train(x_train, y_train, x_valid, y_valid) File "/home/fussili/.local/lib/python3.5/site-packages/anago/wrapper.py", line 50, in train trainer.train(x_train, y_train, x_valid, y_valid) File "/home/fussili/.local/lib/python3.5/site-packages/anago/trainer.py", line 51, in train callbacks=callbacks) File "/home/fussili/.local/lib/python3.5/site-packages/keras/legacy/interfaces.py", line 91, in wrapper return func(*args, **kwargs) File "/home/fussili/.local/lib/python3.5/site-packages/keras/engine/training.py", line 2230, in fit_generator class_weight=class_weight) File "/home/fussili/.local/lib/python3.5/site-packages/keras/engine/training.py", line 1883, in train_on_batch outputs = self.train_function(ins) File "/home/fussili/.local/lib/python3.5/site-packages/keras/backend/tensorflow_backend.py", line 2482, in call **self.session_kwargs) File "/home/fussili/.local/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 900, in run run_metadata_ptr) File "/home/fussili/.local/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1135, in _run feed_dict_tensor, options, run_metadata) File "/home/fussili/.local/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1316, in _do_run run_metadata) File "/home/fussili/.local/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1335, in _do_call raise type(e)(node_def, op, message) tensorflow.python.framework.errors_impl.UnimplementedError: TensorArray has size zero, but element shape is not fully defined. Currently only static shapes are supported when packing zero-size TensorArrays. [[Node: training/Adam/gradients/loss/chain_crf_1_loss/TensorArrayUnstack/TensorArrayScatter/TensorArrayScatterV3_grad/TensorArrayGatherV3 = TensorArrayGatherV3[_class=["loc:@training/Adam/gradients/loss/chain_crf_1_loss/transpose_grad/transpose"], dtype=DT_FLOAT, element_shape=, _device="/job:localhost/replica:0/task:0/device:CPU:0"](training/Adam/gradients/loss/chain_crf_1_loss/TensorArrayUnstack/TensorArrayScatter/TensorArrayScatterV3_grad/TensorArrayGrad/TensorArrayGradV3, loss/chain_crf_1_loss/TensorArrayUnstack/range, training/Adam/gradients/loss/chain_crf_1_loss/while/TensorArrayReadV3/Enter_1_grad/b_acc_3)]]

    Caused by op 'training/Adam/gradients/loss/chain_crf_1_loss/TensorArrayUnstack/TensorArrayScatter/TensorArrayScatterV3_grad/TensorArrayGatherV3', defined at: File "download_model.py", line 13, in model.train(x_train, y_train, x_valid, y_valid) File "/home/fussili/.local/lib/python3.5/site-packages/anago/wrapper.py", line 50, in train trainer.train(x_train, y_train, x_valid, y_valid) File "/home/fussili/.local/lib/python3.5/site-packages/anago/trainer.py", line 51, in train callbacks=callbacks) File "/home/fussili/.local/lib/python3.5/site-packages/keras/legacy/interfaces.py", line 91, in wrapper return func(*args, **kwargs) File "/home/fussili/.local/lib/python3.5/site-packages/keras/engine/training.py", line 2080, in fit_generator self._make_train_function() File "/home/fussili/.local/lib/python3.5/site-packages/keras/engine/training.py", line 992, in _make_train_function loss=self.total_loss) File "/home/fussili/.local/lib/python3.5/site-packages/keras/legacy/interfaces.py", line 91, in wrapper return func(*args, **kwargs) File "/home/fussili/.local/lib/python3.5/site-packages/keras/optimizers.py", line 445, in get_updates grads = self.get_gradients(loss, params) File "/home/fussili/.local/lib/python3.5/site-packages/keras/optimizers.py", line 78, in get_gradients grads = K.gradients(loss, params) File "/home/fussili/.local/lib/python3.5/site-packages/keras/backend/tensorflow_backend.py", line 2519, in gradients return tf.gradients(loss, variables, colocate_gradients_with_ops=True) File "/home/fussili/.local/lib/python3.5/site-packages/tensorflow/python/ops/gradients_impl.py", line 494, in gradients gate_gradients, aggregation_method, stop_gradients) File "/home/fussili/.local/lib/python3.5/site-packages/tensorflow/python/ops/gradients_impl.py", line 636, in _GradientsHelper lambda: grad_fn(op, *out_grads)) File "/home/fussili/.local/lib/python3.5/site-packages/tensorflow/python/ops/gradients_impl.py", line 385, in _MaybeCompile return grad_fn() # Exit early File "/home/fussili/.local/lib/python3.5/site-packages/tensorflow/python/ops/gradients_impl.py", line 636, in lambda: grad_fn(op, *out_grads)) File "/home/fussili/.local/lib/python3.5/site-packages/tensorflow/python/ops/tensor_array_grad.py", line 186, in _TensorArrayScatterGrad grad = g.gather(indices) File "/home/fussili/.local/lib/python3.5/site-packages/tensorflow/python/ops/tensor_array_ops.py", line 910, in gather return self._implementation.gather(indices, name=name) File "/home/fussili/.local/lib/python3.5/site-packages/tensorflow/python/ops/tensor_array_ops.py", line 305, in gather element_shape=element_shape) File "/home/fussili/.local/lib/python3.5/site-packages/tensorflow/python/ops/gen_data_flow_ops.py", line 6018, in tensor_array_gather_v3 flow_in=flow_in, dtype=dtype, element_shape=element_shape, name=name) File "/home/fussili/.local/lib/python3.5/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper op_def=op_def) File "/home/fussili/.local/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 3392, in create_op op_def=op_def) File "/home/fussili/.local/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 1718, in init self._traceback = self._graph._extract_stack() # pylint: disable=protected-access

    ...which was originally created as op 'loss/chain_crf_1_loss/TensorArrayUnstack/TensorArrayScatter/TensorArrayScatterV3', defined at: File "download_model.py", line 13, in model.train(x_train, y_train, x_valid, y_valid) [elided 0 identical lines from previous traceback] File "/home/fussili/.local/lib/python3.5/site-packages/anago/wrapper.py", line 50, in train trainer.train(x_train, y_train, x_valid, y_valid) File "/home/fussili/.local/lib/python3.5/site-packages/anago/trainer.py", line 38, in train optimizer=Adam(lr=self.training_config.learning_rate), File "/home/fussili/.local/lib/python3.5/site-packages/keras/engine/training.py", line 830, in compile sample_weight, mask) File "/home/fussili/.local/lib/python3.5/site-packages/keras/engine/training.py", line 429, in weighted score_array = fn(y_true, y_pred) File "/home/fussili/.local/lib/python3.5/site-packages/anago/layers.py", line 322, in loss return chain_crf_loss(y_true, y_pred, self.U, self.b_start, self.b_end, mask) File "/home/fussili/.local/lib/python3.5/site-packages/anago/layers.py", line 66, in chain_crf_loss return sparse_chain_crf_loss(y_sparse, x, U, b_start, b_end, mask) File "/home/fussili/.local/lib/python3.5/site-packages/anago/layers.py", line 58, in sparse_chain_crf_loss energy -= free_energy0(x, U, mask) File "/home/fussili/.local/lib/python3.5/site-packages/anago/layers.py", line 124, in free_energy0 mask) File "/home/fussili/.local/lib/python3.5/site-packages/anago/layers.py", line 146, in _forward last, values, _ = K.rnn(_forward_step, inputs, initial_states) File "/home/fussili/.local/lib/python3.5/site-packages/keras/backend/tensorflow_backend.py", line 2695, in rnn input_ta = input_ta.unstack(inputs) File "/home/fussili/.local/lib/python3.5/site-packages/tensorflow/python/util/tf_should_use.py", line 118, in wrapped return _add_should_use_warning(fn(*args, **kwargs)) File "/home/fussili/.local/lib/python3.5/site-packages/tensorflow/python/ops/tensor_array_ops.py", line 944, in unstack return self._implementation.unstack(value, name=name) File "/home/fussili/.local/lib/python3.5/site-packages/tensorflow/python/util/tf_should_use.py", line 118, in wrapped return _add_should_use_warning(fn(*args, **kwargs)) File "/home/fussili/.local/lib/python3.5/site-packages/tensorflow/python/ops/tensor_array_ops.py", line 333, in unstack indices=math_ops.range(0, num_elements), value=value, name=name) File "/home/fussili/.local/lib/python3.5/site-packages/tensorflow/python/util/tf_should_use.py", line 118, in wrapped return _add_should_use_warning(fn(*args, **kwargs)) File "/home/fussili/.local/lib/python3.5/site-packages/tensorflow/python/ops/tensor_array_ops.py", line 349, in scatter name=name) File "/home/fussili/.local/lib/python3.5/site-packages/tensorflow/python/ops/gen_data_flow_ops.py", line 6590, in tensor_array_scatter_v3 flow_in=flow_in, name=name) File "/home/fussili/.local/lib/python3.5/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper op_def=op_def)

    UnimplementedError (see above for traceback): TensorArray has size zero, but element shape is not fully defined. Currently only static shapes are supported when packing zero-size TensorArrays. [[Node: training/Adam/gradients/loss/chain_crf_1_loss/TensorArrayUnstack/TensorArrayScatter/TensorArrayScatterV3_grad/TensorArrayGatherV3 = TensorArrayGatherV3[_class=["loc:@training/Adam/gradients/loss/chain_crf_1_loss/transpose_grad/transpose"], dtype=DT_FLOAT, element_shape=, _device="/job:localhost/replica:0/task:0/device:CPU:0"](training/Adam/gradients/loss/chain_crf_1_loss/TensorArrayUnstack/TensorArrayScatter/TensorArrayScatterV3_grad/TensorArrayGrad/TensorArrayGradV3, loss/chain_crf_1_loss/TensorArrayUnstack/range, training/Adam/gradients/loss/chain_crf_1_loss/while/TensorArrayReadV3/Enter_1_grad/b_acc_3)]]

    
    
    
    
    bug 
    opened by fussili 3
  • Error when predicting 1-word sentences

    Error when predicting 1-word sentences

    I try to run the download_model.py and evaluate with a 1-word sentence

    Test O
    

    However, the model gave the UnimplementedError (see above for traceback): TensorArray has size zero, but element shape [?,10] is not fully defined. Currently only static shapes are supported when packing zero-size TensorArrays.

    Would you help me fixing this error? Thank you very much

    The full trace is below

    2018-04-25 14:18:39.235184: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2
    2018-04-25 14:18:39.240128: E tensorflow/stream_executor/cuda/cuda_driver.cc:406] failed call to cuInit: CUDA_ERROR_NO_DEVICE
    2018-04-25 14:18:39.240182: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:158] retrieving CUDA diagnostic information for host: exp
    2018-04-25 14:18:39.240204: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:165] hostname: exp
    2018-04-25 14:18:39.240255: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:189] libcuda reported version is: 384.111.0
    2018-04-25 14:18:39.240314: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:193] kernel reported version is: 384.111.0
    2018-04-25 14:18:39.240336: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:300] kernel version seems to match DSO: 384.111.0
    Traceback (most recent call last):
      File "/home/phuongpham/anaconda2/envs/py3/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1327, in _do_call
        return fn(*args)
      File "/home/phuongpham/anaconda2/envs/py3/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1312, in _run_fn
        options, feed_dict, fetch_list, target_list, run_metadata)
      File "/home/phuongpham/anaconda2/envs/py3/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1420, in _call_tf_sessionrun
        status, run_metadata)
      File "/home/phuongpham/anaconda2/envs/py3/lib/python3.5/site-packages/tensorflow/python/framework/errors_impl.py", line 516, in __exit__
        c_api.TF_GetCode(self.status.status))
    tensorflow.python.framework.errors_impl.UnimplementedError: TensorArray has size zero, but element shape [?,10] is not fully defined. Currently only static shapes are supported when packing zero-size TensorArrays.
             [[Node: chain_crf_1/TensorArrayStack/TensorArrayGatherV3 = TensorArrayGatherV3[_class=["loc:@chain_crf_1/TensorArray"], dtype=DT_FLOAT, element_shape=[?,10], _device="/job:localhost/replica:0/task:0/device:CPU:0"](chain_crf_1/TensorArray, chain_crf_1/TensorArrayStack/range, chain_crf_1/while/Exit_1)]]
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "download_model.py", line 18, in <module>
        model.eval(x_test, y_test)
      File "/home/phuongpham/NER/anago/anago/wrapper.py", line 55, in eval
        evaluator.eval(x_test, y_test)
      File "/home/phuongpham/NER/anago/anago/evaluator.py", line 27, in eval
        f1score.on_epoch_end(epoch=-1)  # epoch takes any integer.
      File "/home/phuongpham/NER/anago/anago/metrics.py", line 132, in on_epoch_end
        y_pred = self.model.predict_on_batch(data)
      File "/home/phuongpham/anaconda2/envs/py3/lib/python3.5/site-packages/keras/engine/training.py", line 1945, in predict_on_batch
        outputs = self.predict_function(ins)
      File "/home/phuongpham/anaconda2/envs/py3/lib/python3.5/site-packages/keras/backend/tensorflow_backend.py", line 2478, in __call__
        **self.session_kwargs)
      File "/home/phuongpham/anaconda2/envs/py3/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 905, in run
        run_metadata_ptr)
      File "/home/phuongpham/anaconda2/envs/py3/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1140, in _run
        feed_dict_tensor, options, run_metadata)
      File "/home/phuongpham/anaconda2/envs/py3/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1321, in _do_run
        run_metadata)
      File "/home/phuongpham/anaconda2/envs/py3/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1340, in _do_call
        raise type(e)(node_def, op, message)
    tensorflow.python.framework.errors_impl.UnimplementedError: TensorArray has size zero, but element shape [?,10] is not fully defined. Currently only static shapes are supported when packing zero-size TensorArrays.
             [[Node: chain_crf_1/TensorArrayStack/TensorArrayGatherV3 = TensorArrayGatherV3[_class=["loc:@chain_crf_1/TensorArray"], dtype=DT_FLOAT, element_shape=[?,10], _device="/job:localhost/replica:0/task:0/device:CPU:0"](chain_crf_1/TensorArray, chain_crf_1/TensorArrayStack/range, chain_crf_1/while/Exit_1)]]
    
    Caused by op 'chain_crf_1/TensorArrayStack/TensorArrayGatherV3', defined at:
      File "download_model.py", line 17, in <module>
        model = Sequence.load(dir_path)
      File "/home/phuongpham/NER/anago/anago/wrapper.py", line 77, in load
        self.model = SeqLabeling(config, dummy_embeddings, ntags=len(self.p.vocab_tag))
      File "/home/phuongpham/NER/anago/anago/models.py", line 82, in __init__
        pred = self.crf(x)
      File "/home/phuongpham/anaconda2/envs/py3/lib/python3.5/site-packages/keras/engine/topology.py", line 619, in __call__
        output = self.call(inputs, **kwargs)
      File "/home/phuongpham/NER/anago/anago/layers.py", line 313, in call
        y_pred = viterbi_decode(x, self.U, self.b_start, self.b_end, mask)
      File "/home/phuongpham/NER/anago/anago/layers.py", line 105, in viterbi_decode
        mask)
      File "/home/phuongpham/NER/anago/anago/layers.py", line 146, in _forward
        last, values, _ = K.rnn(_forward_step, inputs, initial_states)
      File "/home/phuongpham/anaconda2/envs/py3/lib/python3.5/site-packages/keras/backend/tensorflow_backend.py", line 2772, in rnn
        outputs = output_ta.stack()
      File "/home/phuongpham/anaconda2/envs/py3/lib/python3.5/site-packages/tensorflow/python/ops/tensor_array_ops.py", line 893, in stack
        return self._implementation.stack(name=name)
      File "/home/phuongpham/anaconda2/envs/py3/lib/python3.5/site-packages/tensorflow/python/ops/tensor_array_ops.py", line 291, in stack
        return self.gather(math_ops.range(0, self.size()), name=name)
      File "/home/phuongpham/anaconda2/envs/py3/lib/python3.5/site-packages/tensorflow/python/ops/tensor_array_ops.py", line 305, in gather
        element_shape=element_shape)
      File "/home/phuongpham/anaconda2/envs/py3/lib/python3.5/site-packages/tensorflow/python/ops/gen_data_flow_ops.py", line 6011, in tensor_array_gather_v3
        flow_in=flow_in, dtype=dtype, element_shape=element_shape, name=name)
      File "/home/phuongpham/anaconda2/envs/py3/lib/python3.5/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
        op_def=op_def)
      File "/home/phuongpham/anaconda2/envs/py3/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 3290, in create_op
        op_def=op_def)
      File "/home/phuongpham/anaconda2/envs/py3/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 1654, in __init__
        self._traceback = self._graph._extract_stack()  # pylint: disable=protected-access
    
    UnimplementedError (see above for traceback): TensorArray has size zero, but element shape [?,10] is not fully defined. Currently only static shapes are supported when packing zero-size TensorArrays.
             [[Node: chain_crf_1/TensorArrayStack/TensorArrayGatherV3 = TensorArrayGatherV3[_class=["loc:@chain_crf_1/TensorArray"], dtype=DT_FLOAT, element_shape=[?,10], _device="/job:localhost/replica:0/task:0/device:CPU:0"](chain_crf_1/TensorArray, chain_crf_1/TensorArrayStack/range, chain_crf_1/while/Exit_1)]]
    
    opened by pnvphuong 3
  • Bump certifi from 2017.11.5 to 2022.12.7

    Bump certifi from 2017.11.5 to 2022.12.7

    Bumps certifi from 2017.11.5 to 2022.12.7.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Bump tensorflow from 1.8.0 to 2.9.3

    Bump tensorflow from 1.8.0 to 2.9.3

    Bumps tensorflow from 1.8.0 to 2.9.3.

    Release notes

    Sourced from tensorflow's releases.

    TensorFlow 2.9.3

    Release 2.9.3

    This release introduces several vulnerability fixes:

    TensorFlow 2.9.2

    Release 2.9.2

    This releases introduces several vulnerability fixes:

    ... (truncated)

    Changelog

    Sourced from tensorflow's changelog.

    Release 2.9.3

    This release introduces several vulnerability fixes:

    Release 2.8.4

    This release introduces several vulnerability fixes:

    ... (truncated)

    Commits
    • a5ed5f3 Merge pull request #58584 from tensorflow/vinila21-patch-2
    • 258f9a1 Update py_func.cc
    • cd27cfb Merge pull request #58580 from tensorflow-jenkins/version-numbers-2.9.3-24474
    • 3e75385 Update version numbers to 2.9.3
    • bc72c39 Merge pull request #58482 from tensorflow-jenkins/relnotes-2.9.3-25695
    • 3506c90 Update RELEASE.md
    • 8dcb48e Update RELEASE.md
    • 4f34ec8 Merge pull request #58576 from pak-laura/c2.99f03a9d3bafe902c1e6beb105b2f2417...
    • 6fc67e4 Replace CHECK with returning an InternalError on failing to create python tuple
    • 5dbe90a Merge pull request #58570 from tensorflow/r2.9-7b174a0f2e4
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Bump protobuf from 3.5.1 to 3.18.3

    Bump protobuf from 3.5.1 to 3.18.3

    Bumps protobuf from 3.5.1 to 3.18.3.

    Release notes

    Sourced from protobuf's releases.

    Protocol Buffers v3.18.3

    C++

    Protocol Buffers v3.16.1

    Java

    • Improve performance characteristics of UnknownFieldSet parsing (#9371)

    Protocol Buffers v3.18.2

    Java

    • Improve performance characteristics of UnknownFieldSet parsing (#9371)

    Protocol Buffers v3.18.1

    Python

    • Update setup.py to reflect that we now require at least Python 3.5 (#8989)
    • Performance fix for DynamicMessage: force GetRaw() to be inlined (#9023)

    Ruby

    • Update ruby_generator.cc to allow proto2 imports in proto3 (#9003)

    Protocol Buffers v3.18.0

    C++

    • Fix warnings raised by clang 11 (#8664)
    • Make StringPiece constructible from std::string_view (#8707)
    • Add missing capability attributes for LLVM 12 (#8714)
    • Stop using std::iterator (deprecated in C++17). (#8741)
    • Move field_access_listener from libprotobuf-lite to libprotobuf (#8775)
    • Fix #7047 Safely handle setlocale (#8735)
    • Remove deprecated version of SetTotalBytesLimit() (#8794)
    • Support arena allocation of google::protobuf::AnyMetadata (#8758)
    • Fix undefined symbol error around SharedCtor() (#8827)
    • Fix default value of enum(int) in json_util with proto2 (#8835)
    • Better Smaller ByteSizeLong
    • Introduce event filters for inject_field_listener_events
    • Reduce memory usage of DescriptorPool
    • For lazy fields copy serialized form when allowed.
    • Re-introduce the InlinedStringField class
    • v2 access listener
    • Reduce padding in the proto's ExtensionRegistry map.
    • GetExtension performance optimizations
    • Make tracker a static variable rather than call static functions
    • Support extensions in field access listener
    • Annotate MergeFrom for field access listener
    • Fix incomplete types for field access listener
    • Add map_entry/new_map_entry to SpecificField in MessageDifferencer. They record the map items which are different in MessageDifferencer's reporter.
    • Reduce binary size due to fieldless proto messages
    • TextFormat: ParseInfoTree supports getting field end location in addition to start.

    ... (truncated)

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Bump html5lib from 0.9999999 to 0.999999999

    Bump html5lib from 0.9999999 to 0.999999999

    Bumps html5lib from 0.9999999 to 0.999999999.

    Changelog

    Sourced from html5lib's changelog.

    Commits
    • 6a73efa Yes, another release, already. :(
    • e0dc25f Fix attribute order to the treebuilder to be document order
    • a3b8252 Back to -dev
    • ebf6225 0.99999999 release! Let's party!
    • a8ba43e Merge pull request #270 from gsnedders/rename_stuff
    • 8cb144b Update the docs after all the renaming and add CHANGES
    • 00977d6 Rename a bunch of serializer module variables to be underscore prefixed
    • 18a7102 Have only one set of allowed elements/attributes for the sanitizer
    • c4dd677 Move a whole bunch of private modules to be underscore prefixed
    • 8db5828 Rename treewalkers.lxmletree to .etree_lxml for consistency
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Bump numpy from 1.13.3 to 1.22.0

    Bump numpy from 1.13.3 to 1.22.0

    Bumps numpy from 1.13.3 to 1.22.0.

    Release notes

    Sourced from numpy's releases.

    v1.22.0

    NumPy 1.22.0 Release Notes

    NumPy 1.22.0 is a big release featuring the work of 153 contributors spread over 609 pull requests. There have been many improvements, highlights are:

    • Annotations of the main namespace are essentially complete. Upstream is a moving target, so there will likely be further improvements, but the major work is done. This is probably the most user visible enhancement in this release.
    • A preliminary version of the proposed Array-API is provided. This is a step in creating a standard collection of functions that can be used across application such as CuPy and JAX.
    • NumPy now has a DLPack backend. DLPack provides a common interchange format for array (tensor) data.
    • New methods for quantile, percentile, and related functions. The new methods provide a complete set of the methods commonly found in the literature.
    • A new configurable allocator for use by downstream projects.

    These are in addition to the ongoing work to provide SIMD support for commonly used functions, improvements to F2PY, and better documentation.

    The Python versions supported in this release are 3.8-3.10, Python 3.7 has been dropped. Note that 32 bit wheels are only provided for Python 3.8 and 3.9 on Windows, all other wheels are 64 bits on account of Ubuntu, Fedora, and other Linux distributions dropping 32 bit support. All 64 bit wheels are also linked with 64 bit integer OpenBLAS, which should fix the occasional problems encountered by folks using truly huge arrays.

    Expired deprecations

    Deprecated numeric style dtype strings have been removed

    Using the strings "Bytes0", "Datetime64", "Str0", "Uint32", and "Uint64" as a dtype will now raise a TypeError.

    (gh-19539)

    Expired deprecations for loads, ndfromtxt, and mafromtxt in npyio

    numpy.loads was deprecated in v1.15, with the recommendation that users use pickle.loads instead. ndfromtxt and mafromtxt were both deprecated in v1.17 - users should use numpy.genfromtxt instead with the appropriate value for the usemask parameter.

    (gh-19615)

    ... (truncated)

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • model.fit problem in google colab

    model.fit problem in google colab

    System information

    Google Colab

    • **TensorFlow version =2.5.0/Keras version=2.5.0
    • **Python version=Python 3.7.10

    Describe the problem

    When I tried to do : "%cd "/content/anago" model.fit(x_train, y_train, epochs=15)" this error accured: /content/anago/anago/layers.py in build(self, input_shape) 180 initializer=self.kernel_initializer, 181 regularizer=self.kernel_regularizer, --> 182 constraint=self.kernel_constraint) 183 self.chain_kernel = self.add_weight((self.units, self.units), 184 name='chain_kernel',

    TypeError: add_weight() got multiple values for argument 'name'

    Source code / logs

    I tried to follow the instructions given in the github repository of anago. Any help how to run this repository properly would be appreciated. Thanks

    opened by Ali-khn 0
Releases(1.0.0)
Owner
Hiroki Nakayama
OSS developer | Interested in Natural Language Processing
Hiroki Nakayama
An extension for asreview implements a version of the tf-idf feature extractor that saves the matrix and the vocabulary.

Extension - matrix and vocabulary extractor for TF-IDF and Doc2Vec An extension for ASReview that adds a tf-idf extractor that saves the matrix and th

ASReview 4 Jun 17, 2022
A complete NLP guideline for enthusiasts

NLP-NINJA A complete guide for Natural Language Processing in Python Table of Contents S.No. Topic Level Meaning 1 Tokenization 🤍 Beginner 2 Stemming

MAINAK CHAUDHURI 22 Dec 27, 2022
Product-Review-Summarizer - Created a product review summarizer which clustered thousands of product reviews and summarized them into a maximum of 500 characters, saving precious time of customers and helping them make a wise buying decision.

Product-Review-Summarizer - Created a product review summarizer which clustered thousands of product reviews and summarized them into a maximum of 500 characters, saving precious time of customers an

Parv Bhatt 1 Jan 01, 2022
PyTorch Implementation of "Non-Autoregressive Neural Machine Translation"

Non-Autoregressive Transformer Code release for Non-Autoregressive Neural Machine Translation by Jiatao Gu, James Bradbury, Caiming Xiong, Victor O.K.

Salesforce 261 Nov 12, 2022
[NeurIPS 2021] Code for Learning Signal-Agnostic Manifolds of Neural Fields

Learning Signal-Agnostic Manifolds of Neural Fields This is the uncleaned code for the paper Learning Signal-Agnostic Manifolds of Neural Fields. The

60 Dec 12, 2022
Repository for fine-tuning Transformers 🤗 based seq2seq speech models in JAX/Flax.

Seq2Seq Speech in JAX A JAX/Flax repository for combining a pre-trained speech encoder model (e.g. Wav2Vec2, HuBERT, WavLM) with a pre-trained text de

Sanchit Gandhi 21 Dec 14, 2022
AI-powered literature discovery and review engine for medical/scientific papers

AI-powered literature discovery and review engine for medical/scientific papers paperai is an AI-powered literature discovery and review engine for me

NeuML 819 Dec 30, 2022
text to speech toolkit. 好用的中文语音合成工具箱,包含语音编码器、语音合成器、声码器和可视化模块。

ttskit Text To Speech Toolkit: 语音合成工具箱。 安装 pip install -U ttskit 注意 可能需另外安装的依赖包:torch,版本要求torch=1.6.0,=1.7.1,根据自己的实际环境安装合适cuda或cpu版本的torch。 ttskit的

KDD 483 Jan 04, 2023
Mlcode - Continuous ML API Integrations

mlcode Basic APIs for ML applications. Django REST Application Contains REST API

Sujith S 1 Jan 01, 2022
SpikeX - SpaCy Pipes for Knowledge Extraction

SpikeX is a collection of pipes ready to be plugged in a spaCy pipeline. It aims to help in building knowledge extraction tools with almost-zero effort.

Erre Quadro Srl 384 Dec 12, 2022
A Practitioner's Guide to Natural Language Processing

Learn how to process, classify, cluster, summarize, understand syntax, semantics and sentiment of text data with the power of Python! This repository contains code and datasets used in my book, Text

Dipanjan (DJ) Sarkar 1.5k Jan 03, 2023
NLP-Project - Used an API to scrape 2000 reddit posts, then used NLP analysis and created a classification model to mixed succcess

Project 3: Web APIs & NLP Problem Statement How do r/Libertarian and r/Neoliberal differ on Biden post-inaguration? The goal of the project is to see

Adam Muhammad Klesc 2 Mar 29, 2022
Exploration of BERT-based models on twitter sentiment classifications

twitter-sentiment-analysis Explore the relationship between twitter sentiment of Tesla and its stock price/return. Explore the effect of different BER

Sammy Cui 2 Oct 02, 2022
Library for fast text representation and classification.

fastText fastText is a library for efficient learning of word representations and sentence classification. Table of contents Resources Models Suppleme

Facebook Research 24.1k Jan 05, 2023
Ecommerce product title recognition package

revizor This package solves task of splitting product title string into components, like type, brand, model and article (or SKU or product code or you

Bureaucratic Labs 16 Mar 03, 2022
This is the offline-training-pipeline for our project.

offline-training-pipeline This is the offline-training-pipeline for our project. We adopt the offline training and online prediction Machine Learning

0 Apr 22, 2022
A NLP program: tokenize method, PoS Tagging with deep learning

IRIS NLP SYSTEM A NLP program: tokenize method, PoS Tagging with deep learning Report Bug · Request Feature Table of Contents About The Project Built

Zakaria 7 Dec 13, 2022
Multilingual text (NLP) processing toolkit

polyglot Polyglot is a natural language pipeline that supports massive multilingual applications. Free software: GPLv3 license Documentation: http://p

RAMI ALRFOU 2.1k Jan 07, 2023
An easy-to-use Python module that helps you to extract the BERT embeddings for a large text dataset (Bengali/English) efficiently.

An easy-to-use Python module that helps you to extract the BERT embeddings for a large text dataset (Bengali/English) efficiently.

Khalid Saifullah 37 Sep 05, 2022
A crowdsourced dataset of dialogues grounded in social contexts involving utilization of commonsense.

A crowdsourced dataset of dialogues grounded in social contexts involving utilization of commonsense.

Alexa 62 Dec 20, 2022