TensorFlow crashes for NER task using large data












0















I am using the NER implementation in NER. with this configuration:



# embeddings
dim_word = 300
dim_char = 100

# training
train_embeddings = False
nepochs = 15
dropout = 0.5
batch_size = 20
lr_method = "adam"
lr = 0.001
lr_decay = 0.9
clip = -1 # if negative, no clipping
nepoch_no_imprv = 3

# model hyperparameters
hidden_size_char = 100 # lstm on chars
hidden_size_lstm = 300 # lstm on word embeddings


The size of the training data I have is 3000 sentences. When I just use ca. 2500 sentences the training is done without any issue. When I use all training sentences I got this error:



 Epoch 1 out of 15
58/115 [==============>...............] - ETA: 734s - train loss: 15.6397Traceback (most recent call last):
File "**/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1334, in _do_call
return fn(*args)
File "**/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1319, in _run_fn
options, feed_dict, fetch_list, target_list, run_metadata)
File "**/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1407, in _call_tf_sessionrun
run_metadata)
tensorflow.python.framework.errors_impl.InvalidArgumentError: indices[1,21,0] = 136 is not in [0, 136)
[[{{node chars/char_embeddings}} = GatherV2[Taxis=DT_INT32, Tindices=DT_INT32, Tparams=DT_FLOAT, _class=["loc:@train_step/Adam/update_chars/_char_embeddings/AssignSub"], _device="/job:localhost/replica:0/task:0/device:CPU:0"](chars/_char_embeddings/read, _arg_char_ids_0_0, chars/char_embeddings/axis)]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "train.py", line 26, in <module>
main()
File "train.py", line 23, in main
model.train(train, dev)
File "**/base_model.py", line 121, in train
score = self.run_epoch(train, dev, epoch)
File "**/model/ner_model.py", line 287, in run_epoch
[self.train_op, self.loss, self.merged], feed_dict=fd)
File "**/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 929, in run
run_metadata_ptr)
File "**/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1152, in _run
feed_dict_tensor, options, run_metadata)
File "/***/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1328, in _do_run
run_metadata)
File "**/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1348, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InvalidArgumentError: indices[1,21,0] = 136 is not in [0, 136)
[[node chars/char_embeddings (defined at **/model/ner_model.py:128) = GatherV2[Taxis=DT_INT32, Tindices=DT_INT32, Tparams=DT_FLOAT, _class=["loc:@train_step/Adam/update_chars/_char_embeddings/AssignSub"], _device="/job:localhost/replica:0/task:0/device:CPU:0"](chars/_char_embeddings/read, _arg_char_ids_0_0, chars/char_embeddings/axis)]]


Hardware infos:



x86_64 x86_64 x86_64 GNU/Linux
CPU MHz: 1200.671
CPU max MHz: 3500.0000
Memory 503 GB









share|improve this question





























    0















    I am using the NER implementation in NER. with this configuration:



    # embeddings
    dim_word = 300
    dim_char = 100

    # training
    train_embeddings = False
    nepochs = 15
    dropout = 0.5
    batch_size = 20
    lr_method = "adam"
    lr = 0.001
    lr_decay = 0.9
    clip = -1 # if negative, no clipping
    nepoch_no_imprv = 3

    # model hyperparameters
    hidden_size_char = 100 # lstm on chars
    hidden_size_lstm = 300 # lstm on word embeddings


    The size of the training data I have is 3000 sentences. When I just use ca. 2500 sentences the training is done without any issue. When I use all training sentences I got this error:



     Epoch 1 out of 15
    58/115 [==============>...............] - ETA: 734s - train loss: 15.6397Traceback (most recent call last):
    File "**/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1334, in _do_call
    return fn(*args)
    File "**/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1319, in _run_fn
    options, feed_dict, fetch_list, target_list, run_metadata)
    File "**/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1407, in _call_tf_sessionrun
    run_metadata)
    tensorflow.python.framework.errors_impl.InvalidArgumentError: indices[1,21,0] = 136 is not in [0, 136)
    [[{{node chars/char_embeddings}} = GatherV2[Taxis=DT_INT32, Tindices=DT_INT32, Tparams=DT_FLOAT, _class=["loc:@train_step/Adam/update_chars/_char_embeddings/AssignSub"], _device="/job:localhost/replica:0/task:0/device:CPU:0"](chars/_char_embeddings/read, _arg_char_ids_0_0, chars/char_embeddings/axis)]]

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
    File "train.py", line 26, in <module>
    main()
    File "train.py", line 23, in main
    model.train(train, dev)
    File "**/base_model.py", line 121, in train
    score = self.run_epoch(train, dev, epoch)
    File "**/model/ner_model.py", line 287, in run_epoch
    [self.train_op, self.loss, self.merged], feed_dict=fd)
    File "**/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 929, in run
    run_metadata_ptr)
    File "**/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1152, in _run
    feed_dict_tensor, options, run_metadata)
    File "/***/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1328, in _do_run
    run_metadata)
    File "**/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1348, in _do_call
    raise type(e)(node_def, op, message)
    tensorflow.python.framework.errors_impl.InvalidArgumentError: indices[1,21,0] = 136 is not in [0, 136)
    [[node chars/char_embeddings (defined at **/model/ner_model.py:128) = GatherV2[Taxis=DT_INT32, Tindices=DT_INT32, Tparams=DT_FLOAT, _class=["loc:@train_step/Adam/update_chars/_char_embeddings/AssignSub"], _device="/job:localhost/replica:0/task:0/device:CPU:0"](chars/_char_embeddings/read, _arg_char_ids_0_0, chars/char_embeddings/axis)]]


    Hardware infos:



    x86_64 x86_64 x86_64 GNU/Linux
    CPU MHz: 1200.671
    CPU max MHz: 3500.0000
    Memory 503 GB









    share|improve this question



























      0












      0








      0








      I am using the NER implementation in NER. with this configuration:



      # embeddings
      dim_word = 300
      dim_char = 100

      # training
      train_embeddings = False
      nepochs = 15
      dropout = 0.5
      batch_size = 20
      lr_method = "adam"
      lr = 0.001
      lr_decay = 0.9
      clip = -1 # if negative, no clipping
      nepoch_no_imprv = 3

      # model hyperparameters
      hidden_size_char = 100 # lstm on chars
      hidden_size_lstm = 300 # lstm on word embeddings


      The size of the training data I have is 3000 sentences. When I just use ca. 2500 sentences the training is done without any issue. When I use all training sentences I got this error:



       Epoch 1 out of 15
      58/115 [==============>...............] - ETA: 734s - train loss: 15.6397Traceback (most recent call last):
      File "**/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1334, in _do_call
      return fn(*args)
      File "**/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1319, in _run_fn
      options, feed_dict, fetch_list, target_list, run_metadata)
      File "**/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1407, in _call_tf_sessionrun
      run_metadata)
      tensorflow.python.framework.errors_impl.InvalidArgumentError: indices[1,21,0] = 136 is not in [0, 136)
      [[{{node chars/char_embeddings}} = GatherV2[Taxis=DT_INT32, Tindices=DT_INT32, Tparams=DT_FLOAT, _class=["loc:@train_step/Adam/update_chars/_char_embeddings/AssignSub"], _device="/job:localhost/replica:0/task:0/device:CPU:0"](chars/_char_embeddings/read, _arg_char_ids_0_0, chars/char_embeddings/axis)]]

      During handling of the above exception, another exception occurred:

      Traceback (most recent call last):
      File "train.py", line 26, in <module>
      main()
      File "train.py", line 23, in main
      model.train(train, dev)
      File "**/base_model.py", line 121, in train
      score = self.run_epoch(train, dev, epoch)
      File "**/model/ner_model.py", line 287, in run_epoch
      [self.train_op, self.loss, self.merged], feed_dict=fd)
      File "**/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 929, in run
      run_metadata_ptr)
      File "**/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1152, in _run
      feed_dict_tensor, options, run_metadata)
      File "/***/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1328, in _do_run
      run_metadata)
      File "**/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1348, in _do_call
      raise type(e)(node_def, op, message)
      tensorflow.python.framework.errors_impl.InvalidArgumentError: indices[1,21,0] = 136 is not in [0, 136)
      [[node chars/char_embeddings (defined at **/model/ner_model.py:128) = GatherV2[Taxis=DT_INT32, Tindices=DT_INT32, Tparams=DT_FLOAT, _class=["loc:@train_step/Adam/update_chars/_char_embeddings/AssignSub"], _device="/job:localhost/replica:0/task:0/device:CPU:0"](chars/_char_embeddings/read, _arg_char_ids_0_0, chars/char_embeddings/axis)]]


      Hardware infos:



      x86_64 x86_64 x86_64 GNU/Linux
      CPU MHz: 1200.671
      CPU max MHz: 3500.0000
      Memory 503 GB









      share|improve this question
















      I am using the NER implementation in NER. with this configuration:



      # embeddings
      dim_word = 300
      dim_char = 100

      # training
      train_embeddings = False
      nepochs = 15
      dropout = 0.5
      batch_size = 20
      lr_method = "adam"
      lr = 0.001
      lr_decay = 0.9
      clip = -1 # if negative, no clipping
      nepoch_no_imprv = 3

      # model hyperparameters
      hidden_size_char = 100 # lstm on chars
      hidden_size_lstm = 300 # lstm on word embeddings


      The size of the training data I have is 3000 sentences. When I just use ca. 2500 sentences the training is done without any issue. When I use all training sentences I got this error:



       Epoch 1 out of 15
      58/115 [==============>...............] - ETA: 734s - train loss: 15.6397Traceback (most recent call last):
      File "**/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1334, in _do_call
      return fn(*args)
      File "**/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1319, in _run_fn
      options, feed_dict, fetch_list, target_list, run_metadata)
      File "**/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1407, in _call_tf_sessionrun
      run_metadata)
      tensorflow.python.framework.errors_impl.InvalidArgumentError: indices[1,21,0] = 136 is not in [0, 136)
      [[{{node chars/char_embeddings}} = GatherV2[Taxis=DT_INT32, Tindices=DT_INT32, Tparams=DT_FLOAT, _class=["loc:@train_step/Adam/update_chars/_char_embeddings/AssignSub"], _device="/job:localhost/replica:0/task:0/device:CPU:0"](chars/_char_embeddings/read, _arg_char_ids_0_0, chars/char_embeddings/axis)]]

      During handling of the above exception, another exception occurred:

      Traceback (most recent call last):
      File "train.py", line 26, in <module>
      main()
      File "train.py", line 23, in main
      model.train(train, dev)
      File "**/base_model.py", line 121, in train
      score = self.run_epoch(train, dev, epoch)
      File "**/model/ner_model.py", line 287, in run_epoch
      [self.train_op, self.loss, self.merged], feed_dict=fd)
      File "**/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 929, in run
      run_metadata_ptr)
      File "**/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1152, in _run
      feed_dict_tensor, options, run_metadata)
      File "/***/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1328, in _do_run
      run_metadata)
      File "**/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1348, in _do_call
      raise type(e)(node_def, op, message)
      tensorflow.python.framework.errors_impl.InvalidArgumentError: indices[1,21,0] = 136 is not in [0, 136)
      [[node chars/char_embeddings (defined at **/model/ner_model.py:128) = GatherV2[Taxis=DT_INT32, Tindices=DT_INT32, Tparams=DT_FLOAT, _class=["loc:@train_step/Adam/update_chars/_char_embeddings/AssignSub"], _device="/job:localhost/replica:0/task:0/device:CPU:0"](chars/_char_embeddings/read, _arg_char_ids_0_0, chars/char_embeddings/axis)]]


      Hardware infos:



      x86_64 x86_64 x86_64 GNU/Linux
      CPU MHz: 1200.671
      CPU max MHz: 3500.0000
      Memory 503 GB






      python python-3.x tensorflow ner






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 14 '18 at 8:47









      Vadim Kotov

      4,54563447




      4,54563447










      asked Nov 14 '18 at 8:43









      StaOverStaOver

      298




      298
























          0






          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53296072%2ftensorflow-crashes-for-ner-task-using-large-data%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53296072%2ftensorflow-crashes-for-ner-task-using-large-data%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Florida Star v. B. J. F.

          Error while running script in elastic search , gateway timeout

          Adding quotations to stringified JSON object values