question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ValueError: setting an array element with a sequence.

See original GitHub issue

I pre-processed all the data as indicated and I got this:

Exception in thread Thread-107:
Traceback (most recent call last):
  File "C:\Users\nicol\anaconda3\envs\invoicenet\lib\threading.py", line 926, in _bootstrap_inner
    self.run()
  File "C:\Users\nicol\anaconda3\envs\invoicenet\lib\threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\nicol\Documents\InvoiceNet\invoicenet\gui\trainer.py", line 253, in _train
    train_loss = model.train_step(next(train_iter))
  File "C:\Users\nicol\anaconda3\envs\invoicenet\lib\site-packages\tensorflow\python\eager\def_function.py", line 780, in __call__
    result = self._call(*args, **kwds)
  File "C:\Users\nicol\anaconda3\envs\invoicenet\lib\site-packages\tensorflow\python\eager\def_function.py", line 823, in _call
    self._initialize(args, kwds, add_initializers_to=initializers)
  File "C:\Users\nicol\anaconda3\envs\invoicenet\lib\site-packages\tensorflow\python\eager\def_function.py", line 697, in _initialize
    *args, **kwds))
  File "C:\Users\nicol\anaconda3\envs\invoicenet\lib\site-packages\tensorflow\python\eager\function.py", line 2855, in _get_concrete_function_internal_garbage_collected
    graph_function, _, _ = self._maybe_define_function(args, kwargs)
  File "C:\Users\nicol\anaconda3\envs\invoicenet\lib\site-packages\tensorflow\python\eager\function.py", line 3213, in _maybe_define_function
    graph_function = self._create_graph_function(args, kwargs)
  File "C:\Users\nicol\anaconda3\envs\invoicenet\lib\site-packages\tensorflow\python\eager\function.py", line 3075, in _create_graph_function
    capture_by_value=self._capture_by_value),
  File "C:\Users\nicol\anaconda3\envs\invoicenet\lib\site-packages\tensorflow\python\framework\func_graph.py", line 986, in func_graph_from_py_func
    func_outputs = python_func(*func_args, **func_kwargs)
  File "C:\Users\nicol\anaconda3\envs\invoicenet\lib\site-packages\tensorflow\python\eager\def_function.py", line 600, in wrapped_fn
    return weak_wrapped_fn().__wrapped__(*args, **kwds)
  File "C:\Users\nicol\anaconda3\envs\invoicenet\lib\site-packages\tensorflow\python\eager\function.py", line 3735, in bound_method_wrapper
    return wrapped_fn(*args, **kwargs)
  File "C:\Users\nicol\anaconda3\envs\invoicenet\lib\site-packages\tensorflow\python\framework\func_graph.py", line 973, in wrapper
    raise e.ag_error_metadata.to_exception(e)
ValueError: in user code:

    C:\Users\nicol\Documents\InvoiceNet\invoicenet\acp\acp.py:85 train_step  *
        predictions = self.model(inputs, training=True)
    C:\Users\nicol\Documents\InvoiceNet\invoicenet\acp\model.py:176 call  *
        parsed = self.parser(inputs=(x, context), training=training)
    C:\Users\nicol\Documents\InvoiceNet\invoicenet\parsing\parsers.py:65 call  *
        empty_answer = tf.constant(InvoiceData.eos_idx, tf.int32, shape=(tf.shape(x)[0], self.seq_out))
    C:\Users\nicol\anaconda3\envs\invoicenet\lib\site-packages\tensorflow\python\framework\constant_op.py:264 constant  **
        allow_broadcast=True)
    C:\Users\nicol\anaconda3\envs\invoicenet\lib\site-packages\tensorflow\python\framework\constant_op.py:282 _constant_impl
        allow_broadcast=allow_broadcast))
    C:\Users\nicol\anaconda3\envs\invoicenet\lib\site-packages\tensorflow\python\framework\tensor_util.py:453 make_tensor_proto
        if shape is not None and np.prod(shape, dtype=np.int64) == 0:
    <__array_function__ internals>:6 prod

    C:\Users\nicol\anaconda3\envs\invoicenet\lib\site-packages\numpy\core\fromnumeric.py:2962 prod
        keepdims=keepdims, initial=initial, where=where)
    C:\Users\nicol\anaconda3\envs\invoicenet\lib\site-packages\numpy\core\fromnumeric.py:90 _wrapreduction
        return ufunc.reduce(obj, axis, dtype, out, **passkwargs)

    ValueError: setting an array element with a sequence.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
naiveHobocommented, Aug 25, 2020

I don’t think that’s the issue, if the training field is not available in any label, it is automatically assumed to be null. This actually turned out to be an error in the optional parser (sorry about that). Should be fixed in fe6ad79d53b5cae08dd6383c912543f5b5fb9950.

0reactions
brandomrcommented, Aug 25, 2020

@naiveHobo awesome, I’ll give it a shot asap and let you know if that resolves things.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ValueError: setting an array element with a sequence
Means exactly what it says, you're trying to cram a sequence of numbers into a single number slot. It can be thrown under...
Read more >
How to Fix: ValueError: setting an array element with a ...
Easiest way to fix this problem is to use the data-type which support all type of data-type. · Second way to fix this...
Read more >
ValueError: setting an array element with a sequence - STechies
While programming in Python, especially Numpy a library in Python, programmers encounter an error called ValueError: setting an array element with a sequence....
Read more >
Valueerror: Setting an Array Element with a Sequence ( Solved )
In python Valueerror: Setting an Array Element with a Sequence means you are creating a NumPy array of different types of elements in...
Read more >
ValueError: setting an array element with a sequence - Statology
One error you may encounter when using Python is: ValueError: setting an array element with a sequence. This error typically occurs when you ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found