Skip to content

Bert server not running in jupyter hub (did run in colab) #2

Description

@mrubash1

command

bert_vectorizer(64*['sample text']).shape

output

From /Users/mrubash1/.pyenv/versions/miniconda3-4.7.12/envs/cord19/lib/python3.6/site-packages/tensorflow_core/python/ops/array_ops.py:1475: where (from tensorflow.python.ops.array_ops) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.where in 2.0, which has the same broadcast rule as np.where
---------------------------------------------------------------------------
InvalidArgumentError                      Traceback (most recent call last)
~/.pyenv/versions/miniconda3-4.7.12/envs/cord19/lib/python3.6/site-packages/tensorflow_core/python/client/session.py in _do_call(self, fn, *args)
   1364     try:
-> 1365       return fn(*args)
   1366     except errors.OpError as e:

~/.pyenv/versions/miniconda3-4.7.12/envs/cord19/lib/python3.6/site-packages/tensorflow_core/python/client/session.py in _run_fn(feed_dict, fetch_list, target_list, options, run_metadata)
   1349       return self._call_tf_sessionrun(options, feed_dict, fetch_list,
-> 1350                                       target_list, run_metadata)
   1351 

~/.pyenv/versions/miniconda3-4.7.12/envs/cord19/lib/python3.6/site-packages/tensorflow_core/python/client/session.py in _call_tf_sessionrun(self, options, feed_dict, fetch_list, target_list, run_metadata)
   1442                                             fetch_list, target_list,
-> 1443                                             run_metadata)
   1444 

InvalidArgumentError: TypeError: unsupported operand type(s) for -: 'str' and 'int'
Traceback (most recent call last):

  File "<ipython-input-9-e82631258094>", line 6, in gen
    yield build_feed_dict(container.get())

  File "<ipython-input-8-ea0e83af88b7>", line 8, in build_feed_dict
    bert_tokenizer, log, False, False))

  File "/Users/mrubash1/.pyenv/versions/miniconda3-4.7.12/envs/cord19/lib/python3.6/site-packages/bert_serving/server/bert/extract_features.py", line 73, in convert_lst_to_features
    if len(tokens_a) > max_seq_length - 2 and not no_special_token:

TypeError: unsupported operand type(s) for -: 'str' and 'int'


During handling of the above exception, another exception occurred:


Traceback (most recent call last):

  File "/Users/mrubash1/.pyenv/versions/miniconda3-4.7.12/envs/cord19/lib/python3.6/site-packages/tensorflow_core/python/ops/script_ops.py", line 235, in __call__
    ret = func(*args)

  File "/Users/mrubash1/.pyenv/versions/miniconda3-4.7.12/envs/cord19/lib/python3.6/site-packages/tensorflow_core/python/data/ops/dataset_ops.py", line 594, in generator_py_func
    values = next(generator_state.get_iterator(iterator_id))

  File "<ipython-input-9-e82631258094>", line 8, in gen
    yield build_feed_dict(container.get())

  File "<ipython-input-8-ea0e83af88b7>", line 8, in build_feed_dict
    bert_tokenizer, log, False, False))

  File "/Users/mrubash1/.pyenv/versions/miniconda3-4.7.12/envs/cord19/lib/python3.6/site-packages/bert_serving/server/bert/extract_features.py", line 73, in convert_lst_to_features
    if len(tokens_a) > max_seq_length - 2 and not no_special_token:

TypeError: unsupported operand type(s) for -: 'str' and 'int'


	 [[{{node PyFunc}}]]
	 [[IteratorGetNext]]

During handling of the above exception, another exception occurred:

InvalidArgumentError                      Traceback (most recent call last)
<ipython-input-13-00af28c4146c> in <module>
----> 1 bert_vectorizer(64*['sample text']).shape

<ipython-input-11-a8e83bcb5ca1> in vectorize(text, verbose)
     13     for text_batch in batch(text, batch_size):
     14       container.set(text_batch)
---> 15       x.append(next(predict_fn)['output'])
     16       if verbose:
     17         bar.add(len(text_batch))

~/.pyenv/versions/miniconda3-4.7.12/envs/cord19/lib/python3.6/site-packages/tensorflow_estimator/python/estimator/estimator.py in predict(self, input_fn, predict_keys, hooks, checkpoint_path, yield_single_examples)
    638             hooks=all_hooks) as mon_sess:
    639           while not mon_sess.should_stop():
--> 640             preds_evaluated = mon_sess.run(predictions)
    641             if not yield_single_examples:
    642               yield preds_evaluated

~/.pyenv/versions/miniconda3-4.7.12/envs/cord19/lib/python3.6/site-packages/tensorflow_core/python/training/monitored_session.py in run(self, fetches, feed_dict, options, run_metadata)
    752         feed_dict=feed_dict,
    753         options=options,
--> 754         run_metadata=run_metadata)
    755 
    756   def run_step_fn(self, step_fn):

~/.pyenv/versions/miniconda3-4.7.12/envs/cord19/lib/python3.6/site-packages/tensorflow_core/python/training/monitored_session.py in run(self, fetches, feed_dict, options, run_metadata)
   1257             feed_dict=feed_dict,
   1258             options=options,
-> 1259             run_metadata=run_metadata)
   1260       except _PREEMPTION_ERRORS as e:
   1261         logging.info(

~/.pyenv/versions/miniconda3-4.7.12/envs/cord19/lib/python3.6/site-packages/tensorflow_core/python/training/monitored_session.py in run(self, *args, **kwargs)
   1358         raise six.reraise(*original_exc_info)
   1359       else:
-> 1360         raise six.reraise(*original_exc_info)
   1361 
   1362 

~/.pyenv/versions/miniconda3-4.7.12/envs/cord19/lib/python3.6/site-packages/six.py in reraise(tp, value, tb)
    701             if value.__traceback__ is not tb:
    702                 raise value.with_traceback(tb)
--> 703             raise value
    704         finally:
    705             value = None

~/.pyenv/versions/miniconda3-4.7.12/envs/cord19/lib/python3.6/site-packages/tensorflow_core/python/training/monitored_session.py in run(self, *args, **kwargs)
   1343   def run(self, *args, **kwargs):
   1344     try:
-> 1345       return self._sess.run(*args, **kwargs)
   1346     except _PREEMPTION_ERRORS:
   1347       raise

~/.pyenv/versions/miniconda3-4.7.12/envs/cord19/lib/python3.6/site-packages/tensorflow_core/python/training/monitored_session.py in run(self, fetches, feed_dict, options, run_metadata)
   1416         feed_dict=feed_dict,
   1417         options=options,
-> 1418         run_metadata=run_metadata)
   1419 
   1420     for hook in self._hooks:

~/.pyenv/versions/miniconda3-4.7.12/envs/cord19/lib/python3.6/site-packages/tensorflow_core/python/training/monitored_session.py in run(self, *args, **kwargs)
   1174 
   1175   def run(self, *args, **kwargs):
-> 1176     return self._sess.run(*args, **kwargs)
   1177 
   1178   def run_step_fn(self, step_fn, raw_session, run_with_hooks):

~/.pyenv/versions/miniconda3-4.7.12/envs/cord19/lib/python3.6/site-packages/tensorflow_core/python/client/session.py in run(self, fetches, feed_dict, options, run_metadata)
    954     try:
    955       result = self._run(None, fetches, feed_dict, options_ptr,
--> 956                          run_metadata_ptr)
    957       if run_metadata:
    958         proto_data = tf_session.TF_GetBuffer(run_metadata_ptr)

~/.pyenv/versions/miniconda3-4.7.12/envs/cord19/lib/python3.6/site-packages/tensorflow_core/python/client/session.py in _run(self, handle, fetches, feed_dict, options, run_metadata)
   1178     if final_fetches or final_targets or (handle and feed_dict_tensor):
   1179       results = self._do_run(handle, final_targets, final_fetches,
-> 1180                              feed_dict_tensor, options, run_metadata)
   1181     else:
   1182       results = []

~/.pyenv/versions/miniconda3-4.7.12/envs/cord19/lib/python3.6/site-packages/tensorflow_core/python/client/session.py in _do_run(self, handle, target_list, fetch_list, feed_dict, options, run_metadata)
   1357     if handle is None:
   1358       return self._do_call(_run_fn, feeds, fetches, targets, options,
-> 1359                            run_metadata)
   1360     else:
   1361       return self._do_call(_prun_fn, handle, feeds, fetches)

~/.pyenv/versions/miniconda3-4.7.12/envs/cord19/lib/python3.6/site-packages/tensorflow_core/python/client/session.py in _do_call(self, fn, *args)
   1382                     '\nsession_config.graph_options.rewrite_options.'
   1383                     'disable_meta_optimizer = True')
-> 1384       raise type(e)(node_def, op, message)
   1385 
   1386   def _extend_graph(self):

InvalidArgumentError: TypeError: unsupported operand type(s) for -: 'str' and 'int'
Traceback (most recent call last):

  File "<ipython-input-9-e82631258094>", line 6, in gen
    yield build_feed_dict(container.get())

  File "<ipython-input-8-ea0e83af88b7>", line 8, in build_feed_dict
    bert_tokenizer, log, False, False))

  File "/Users/mrubash1/.pyenv/versions/miniconda3-4.7.12/envs/cord19/lib/python3.6/site-packages/bert_serving/server/bert/extract_features.py", line 73, in convert_lst_to_features
    if len(tokens_a) > max_seq_length - 2 and not no_special_token:

TypeError: unsupported operand type(s) for -: 'str' and 'int'


During handling of the above exception, another exception occurred:


Traceback (most recent call last):

  File "/Users/mrubash1/.pyenv/versions/miniconda3-4.7.12/envs/cord19/lib/python3.6/site-packages/tensorflow_core/python/ops/script_ops.py", line 235, in __call__
    ret = func(*args)

  File "/Users/mrubash1/.pyenv/versions/miniconda3-4.7.12/envs/cord19/lib/python3.6/site-packages/tensorflow_core/python/data/ops/dataset_ops.py", line 594, in generator_py_func
    values = next(generator_state.get_iterator(iterator_id))

  File "<ipython-input-9-e82631258094>", line 8, in gen
    yield build_feed_dict(container.get())

  File "<ipython-input-8-ea0e83af88b7>", line 8, in build_feed_dict
    bert_tokenizer, log, False, False))

  File "/Users/mrubash1/.pyenv/versions/miniconda3-4.7.12/envs/cord19/lib/python3.6/site-packages/bert_serving/server/bert/extract_features.py", line 73, in convert_lst_to_features
    if len(tokens_a) > max_seq_length - 2 and not no_special_token:

TypeError: unsupported operand type(s) for -: 'str' and 'int'


	 [[{{node PyFunc}}]]
	 [[IteratorGetNext]]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions