Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in SSA --mssa.fit(df_tr) #3910

Closed
ashi24lion opened this issue Mar 28, 2019 · 7 comments
Closed

Error in SSA --mssa.fit(df_tr) #3910

ashi24lion opened this issue Mar 28, 2019 · 7 comments
Labels
no action required No action was needed to resolve.

Comments

@ashi24lion
Copy link

Constructing trajectory matrix
Trajectory matrix shape: (1600, 801)
Decomposing trajectory covariance matrix with SVD
Constructing components

ValueError Traceback (most recent call last)
~\Anaconda3\lib\site-packages\numba\errors.py in new_error_context(fmt_, *args, **kwargs)
490 try:
--> 491 yield
492 except NumbaError as e:

~\Anaconda3\lib\site-packages\numba\lowering.py in lower_block(self, block)
215 loc=self.loc, errcls_=defaulterrcls):
--> 216 self.lower_inst(inst)
217

~\Anaconda3\lib\site-packages\numba\lowering.py in lower_inst(self, inst)
264 ty = self.typeof(inst.target.name)
--> 265 val = self.lower_assign(ty, inst)
266 self.storevar(val, inst.target.name)

~\Anaconda3\lib\site-packages\numba\lowering.py in lower_assign(self, ty, inst)
410 elif isinstance(value, ir.Expr):
--> 411 return self.lower_expr(ty, value)
412

~\Anaconda3\lib\site-packages\numba\lowering.py in lower_expr(self, resty, expr)
742 elif expr.op == 'call':
--> 743 res = self.lower_call(resty, expr)
744 return res

~\Anaconda3\lib\site-packages\numba\lowering.py in lower_call(self, resty, expr)
708
--> 709 res = impl(self.builder, argvals)
710

~\Anaconda3\lib\site-packages\numba\targets\base.py in call(self, builder, args)
1042 def call(self, builder, args):
-> 1043 return self._imp(self._context, builder, self._sig, args)
1044

~\Anaconda3\lib\site-packages\numba\targets\arrayobj.py in numpy_zeros_nd(context, builder, sig, args)
3260 arrtype, shapes = _parse_empty_args(context, builder, sig, args)
-> 3261 ary = _empty_nd_impl(context, builder, arrtype, shapes)
3262 _zero_fill_array(context, builder, ary)

~\Anaconda3\lib\site-packages\numba\targets\arrayobj.py in _empty_nd_impl(context, builder, arrtype, shapes)
3147 for s in shapes:
-> 3148 arrlen = builder.mul(arrlen, s)
3149

~\Anaconda3\lib\site-packages\llvmlite\ir\builder.py in wrapped(self, lhs, rhs, name, flags)
23 raise ValueError("Operands must be the same type, got (%s, %s)"
---> 24 % (lhs.type, rhs.type))
25 instr = cls(self.block, lhs.type, opname, (lhs, rhs), name, flags)

ValueError: Operands must be the same type, got (i64, i32)

During handling of the above exception, another exception occurred:

LoweringError Traceback (most recent call last)
in ()
----> 1 mssa.fit(df_tr)

~\python_stuff_my_module\pymssa\mssa.py in fit(self, timeseries)
546 self.P_,
547 self.N_,
--> 548 self.L_
549 )
550

~\Anaconda3\lib\site-packages\numba\dispatcher.py in _compile_for_args(self, *args, **kws)
358 e.patch_message(''.join(e.args) + help_msg)
359 # ignore the FULL_TRACEBACKS config, this needs reporting!
--> 360 raise e
361
362 def inspect_llvm(self, signature=None):

~\Anaconda3\lib\site-packages\numba\dispatcher.py in _compile_for_args(self, *args, **kws)
309 argtypes.append(self.typeof_pyval(a))
310 try:
--> 311 return self.compile(tuple(argtypes))
312 except errors.TypingError as e:
313 # Intercept typing error that may be due to an argument

~\Anaconda3\lib\site-packages\numba\dispatcher.py in compile(self, sig)
616
617 self._cache_misses[sig] += 1
--> 618 cres = self._compiler.compile(args, return_type)
619 self.add_overload(cres)
620 self._cache.save_overload(sig, cres)

~\Anaconda3\lib\site-packages\numba\dispatcher.py in compile(self, args, return_type)
81 args=args, return_type=return_type,
82 flags=flags, locals=self.locals,
---> 83 pipeline_class=self.pipeline_class)
84 # Check typing error if object mode is used
85 if cres.typing_error is not None and not flags.enable_pyobject:

~\Anaconda3\lib\site-packages\numba\compiler.py in compile_extra(typingctx, targetctx, func, args, return_type, flags, locals, library, pipeline_class)
869 pipeline = pipeline_class(typingctx, targetctx, library,
870 args, return_type, flags, locals)
--> 871 return pipeline.compile_extra(func)
872
873

~\Anaconda3\lib\site-packages\numba\compiler.py in compile_extra(self, func)
363 self.lifted = ()
364 self.lifted_from = None
--> 365 return self._compile_bytecode()
366
367 def compile_ir(self, func_ir, lifted=(), lifted_from=None):

~\Anaconda3\lib\site-packages\numba\compiler.py in _compile_bytecode(self)
800 """
801 assert self.func_ir is None
--> 802 return self._compile_core()
803
804 def _compile_ir(self):

~\Anaconda3\lib\site-packages\numba\compiler.py in _compile_core(self)
787 self.define_pipelines(pm)
788 pm.finalize()
--> 789 res = pm.run(self.status)
790 if res is not None:
791 # Early pipeline completion

~\Anaconda3\lib\site-packages\numba\compiler.py in run(self, status)
249 # No more fallback pipelines?
250 if is_final_pipeline:
--> 251 raise patched_exception
252 # Go to next fallback pipeline
253 else:

~\Anaconda3\lib\site-packages\numba\compiler.py in run(self, status)
241 try:
242 event(stage_name)
--> 243 stage()
244 except _EarlyPipelineCompletion as e:
245 return e.result

~\Anaconda3\lib\site-packages\numba\compiler.py in stage_nopython_backend(self)
674 """
675 lowerfn = self.backend_nopython_mode
--> 676 self._backend(lowerfn, objectmode=False)
677
678 def stage_compile_interp_mode(self):

~\Anaconda3\lib\site-packages\numba\compiler.py in _backend(self, lowerfn, objectmode)
624 self.library.enable_object_caching()
625
--> 626 lowered = lowerfn()
627 signature = typing.signature(self.return_type, *self.args)
628 self.cr = compile_result(

~\Anaconda3\lib\site-packages\numba\compiler.py in backend_nopython_mode(self)
611 self.return_type,
612 self.calltypes,
--> 613 self.flags)
614
615 def _backend(self, lowerfn, objectmode):

~\Anaconda3\lib\site-packages\numba\compiler.py in native_lowering_stage(targetctx, library, interp, typemap, restype, calltypes, flags)
988
989 lower = lowering.Lower(targetctx, library, fndesc, interp)
--> 990 lower.lower()
991 if not flags.no_cpython_wrapper:
992 lower.create_cpython_wrapper(flags.release_gil)

~\Anaconda3\lib\site-packages\numba\lowering.py in lower(self)
133 if self.generator_info is None:
134 self.genlower = None
--> 135 self.lower_normal_function(self.fndesc)
136 else:
137 self.genlower = self.GeneratorLower(self)

~\Anaconda3\lib\site-packages\numba\lowering.py in lower_normal_function(self, fndesc)
174 # Init argument values
175 self.extract_function_arguments()
--> 176 entry_block_tail = self.lower_function_body()
177
178 # Close tail of entry block

~\Anaconda3\lib\site-packages\numba\lowering.py in lower_function_body(self)
199 bb = self.blkmap[offset]
200 self.builder.position_at_end(bb)
--> 201 self.lower_block(block)
202
203 self.post_lower()

~\Anaconda3\lib\site-packages\numba\lowering.py in lower_block(self, block)
214 with new_error_context('lowering "{inst}" at {loc}', inst=inst,
215 loc=self.loc, errcls_=defaulterrcls):
--> 216 self.lower_inst(inst)
217
218 def create_cpython_wrapper(self, release_gil=False):

~\Anaconda3\lib\contextlib.py in exit(self, type, value, traceback)
97 value = type()
98 try:
---> 99 self.gen.throw(type, value, traceback)
100 except StopIteration as exc:
101 # Suppress StopIteration unless it's the same exception that

~\Anaconda3\lib\site-packages\numba\errors.py in new_error_context(fmt_, *args, **kwargs)
497 from numba import config
498 tb = sys.exc_info()[2] if config.FULL_TRACEBACKS else None
--> 499 six.reraise(type(newerr), newerr, tb)
500
501

~\Anaconda3\lib\site-packages\numba\six.py in reraise(tp, value, tb)
657 if value.traceback is not tb:
658 raise value.with_traceback(tb)
--> 659 raise value
660
661 else:

LoweringError: Failed at nopython (nopython mode backend)
Operands must be the same type, got (i64, i32)

File "....\python_stuff_my_module\pymssa\optimized.py", line 226:
def incremental_component_reconstruction(trajectory_matrix,

components = np.zeros((P, N, rank))
^

[1] During: lowering "$0.7 = call $0.2($0.6, func=$0.2, args=[Var($0.6, C:\Users\devendra\python_stuff_my_module\pymssa\optimized.py (226))], kws=(), vararg=None)" at C:\Users\devendra\python_stuff_my_module\pymssa\optimized.py (226)

This should not have happened, a problem has occurred in Numba's internals.

Please report the error message and traceback, along with a minimal reproducer
at: https://github.com/numba/numba/issues/new

If you need help writing a minimal reproducer please see:
http://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports

If more help is needed please feel free to speak to the Numba core developers
directly at: https://gitter.im/numba/numba

Thanks in advance for your help in improving Numba!

@stuartarchibald
Copy link
Contributor

Thanks for the report. Please could you provide more information about what caused this problem:

  1. The code that you were running (as a minimal working reproducer, if you are unsure how to write one see http://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports).
  2. Any data needed to run the code.
  3. The full trace back of the exception.

Thanks.

@stuartarchibald
Copy link
Contributor

I've built the referenced https://github.com/kieferk/pymssa and run this:

import numpy as np

from pymssa import MSSA

mssa = MSSA(n_components=None,
            window_size=None,
            verbose=True)

mssa.fit(np.arange(100.))

with Numba 0.43.1, worked as expected.

Closing this issue due to lack of information. If more information becomes available please add it and reopen the issue. Thanks.

@stuartarchibald stuartarchibald added no action required No action was needed to resolve. and removed needtriage labels Apr 11, 2019
@veager
Copy link

veager commented Jun 13, 2019

I've run the same code with Numba 0.44.0, but also raised a error.

import numpy as np
from pymssa import MSSA
mssa = MSSA(n_components=None,
            window_size=None,
            verbose=True)
mssa.fit(np.arange(100.))
  File "D:\Anaconda\lib\site-packages\pymssa\mssa.py", line 548, in fit
    self.L_

  File "D:\Anaconda\lib\site-packages\numba\dispatcher.py", line 370, in _compile_for_args
    raise e

  File "D:\Anaconda\lib\site-packages\numba\dispatcher.py", line 327, in _compile_for_args
    return self.compile(tuple(argtypes))

  File "D:\Anaconda\lib\site-packages\numba\compiler_lock.py", line 32, in _acquire_compile_lock
    return func(*args, **kwargs)

  File "D:\Anaconda\lib\site-packages\numba\dispatcher.py", line 659, in compile
    cres = self._compiler.compile(args, return_type)

  File "D:\Anaconda\lib\site-packages\numba\dispatcher.py", line 83, in compile
    pipeline_class=self.pipeline_class)

  File "D:\Anaconda\lib\site-packages\numba\compiler.py", line 955, in compile_extra
    return pipeline.compile_extra(func)

  File "D:\Anaconda\lib\site-packages\numba\compiler.py", line 377, in compile_extra
    return self._compile_bytecode()

  File "D:\Anaconda\lib\site-packages\numba\compiler.py", line 886, in _compile_bytecode
    return self._compile_core()

  File "D:\Anaconda\lib\site-packages\numba\compiler.py", line 873, in _compile_core
    res = pm.run(self.status)

  File "D:\Anaconda\lib\site-packages\numba\compiler_lock.py", line 32, in _acquire_compile_lock
    return func(*args, **kwargs)

  File "D:\Anaconda\lib\site-packages\numba\compiler.py", line 254, in run
    raise patched_exception

  File "D:\Anaconda\lib\site-packages\numba\compiler.py", line 245, in run
    stage()

  File "D:\Anaconda\lib\site-packages\numba\compiler.py", line 747, in stage_nopython_backend
    self._backend(lowerfn, objectmode=False)

  File "D:\Anaconda\lib\site-packages\numba\compiler.py", line 687, in _backend
    lowered = lowerfn()

  File "D:\Anaconda\lib\site-packages\numba\compiler.py", line 674, in backend_nopython_mode
    self.metadata)

  File "D:\Anaconda\lib\site-packages\numba\compiler.py", line 1124, in native_lowering_stage
    lower.lower()

  File "D:\Anaconda\lib\site-packages\numba\lowering.py", line 177, in lower
    self.lower_normal_function(self.fndesc)

  File "D:\Anaconda\lib\site-packages\numba\lowering.py", line 218, in lower_normal_function
    entry_block_tail = self.lower_function_body()

  File "D:\Anaconda\lib\site-packages\numba\lowering.py", line 243, in lower_function_body
    self.lower_block(block)

  File "D:\Anaconda\lib\site-packages\numba\lowering.py", line 258, in lower_block
    self.lower_inst(inst)

  File "D:\Anaconda\lib\contextlib.py", line 130, in __exit__
    self.gen.throw(type, value, traceback)

  File "D:\Anaconda\lib\site-packages\numba\errors.py", line 669, in new_error_context
    six.reraise(type(newerr), newerr, tb)

  File "D:\Anaconda\lib\site-packages\numba\six.py", line 659, in reraise
    raise value

LoweringError: Operands must be the same type, got (i64, i32)

@emanuel-raad
Copy link

emanuel-raad commented Jun 17, 2019

I've run into the same issue as @veager .

I'm running Windows 10 64bit and I've downloaded the latest 64bit Anaconda distribution (version 2019.03). Then I installed pymssa with this command:
pip install git+https://github.com/kieferk/pymssa

I noticed that the code that @stuartarchibald posted works in a Google colab environment, so for the meanwhile, I've been working there.

Constructing trajectory matrix
Trajectory matrix shape: (50, 51)
Decomposing trajectory covariance matrix with SVD
Constructing components
Traceback (most recent call last):
  File "C:\Users\Emanuel\Anaconda3\lib\site-packages\numba\errors.py", line 627, in new_error_context
    yield
  File "C:\Users\Emanuel\Anaconda3\lib\site-packages\numba\lowering.py", line 258, in lower_block
    self.lower_inst(inst)
  File "C:\Users\Emanuel\Anaconda3\lib\site-packages\numba\lowering.py", line 301, in lower_inst
    val = self.lower_assign(ty, inst)
  File "C:\Users\Emanuel\Anaconda3\lib\site-packages\numba\lowering.py", line 454, in lower_assign
    return self.lower_expr(ty, value)
  File "C:\Users\Emanuel\Anaconda3\lib\site-packages\numba\lowering.py", line 913, in lower_expr
    res = self.lower_call(resty, expr)
  File "C:\Users\Emanuel\Anaconda3\lib\site-packages\numba\lowering.py", line 706, in lower_call
    res = self._lower_call_normal(fnty, expr, signature)
  File "C:\Users\Emanuel\Anaconda3\lib\site-packages\numba\lowering.py", line 885, in _lower_call_normal
    res = impl(self.builder, argvals, self.loc)
  File "C:\Users\Emanuel\Anaconda3\lib\site-packages\numba\targets\base.py", line 1132, in __call__
    res = self._imp(self._context, builder, self._sig, args, loc=loc)
  File "C:\Users\Emanuel\Anaconda3\lib\site-packages\numba\targets\base.py", line 1157, in wrapper
    return fn(*args, **kwargs)
  File "C:\Users\Emanuel\Anaconda3\lib\site-packages\numba\targets\arrayobj.py", line 3280, in numpy_zeros_nd
    ary = _empty_nd_impl(context, builder, arrtype, shapes)
  File "C:\Users\Emanuel\Anaconda3\lib\site-packages\numba\targets\arrayobj.py", line 3167, in _empty_nd_impl
    arrlen = builder.mul(arrlen, s)
  File "C:\Users\Emanuel\Anaconda3\lib\site-packages\llvmlite\ir\builder.py", line 24, in wrapped
    % (lhs.type, rhs.type))
ValueError: Operands must be the same type, got (i64, i32)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:/Users/Emanuel/Google Drive/mssa.py", line 9, in <module>
    mssa.fit(np.arange(100.))
  File "C:\Users\Emanuel\Anaconda3\lib\site-packages\pymssa\mssa.py", line 548, in fit
    self.L_
  File "C:\Users\Emanuel\Anaconda3\lib\site-packages\numba\dispatcher.py", line 369, in _compile_for_args
    raise e
  File "C:\Users\Emanuel\Anaconda3\lib\site-packages\numba\dispatcher.py", line 326, in _compile_for_args
    return self.compile(tuple(argtypes))
  File "C:\Users\Emanuel\Anaconda3\lib\site-packages\numba\compiler_lock.py", line 32, in _acquire_compile_lock
    return func(*args, **kwargs)
  File "C:\Users\Emanuel\Anaconda3\lib\site-packages\numba\dispatcher.py", line 658, in compile
    cres = self._compiler.compile(args, return_type)
  File "C:\Users\Emanuel\Anaconda3\lib\site-packages\numba\dispatcher.py", line 82, in compile
    pipeline_class=self.pipeline_class)
  File "C:\Users\Emanuel\Anaconda3\lib\site-packages\numba\compiler.py", line 941, in compile_extra
    return pipeline.compile_extra(func)
  File "C:\Users\Emanuel\Anaconda3\lib\site-packages\numba\compiler.py", line 372, in compile_extra
    return self._compile_bytecode()
  File "C:\Users\Emanuel\Anaconda3\lib\site-packages\numba\compiler.py", line 872, in _compile_bytecode
    return self._compile_core()
  File "C:\Users\Emanuel\Anaconda3\lib\site-packages\numba\compiler.py", line 859, in _compile_core
    res = pm.run(self.status)
  File "C:\Users\Emanuel\Anaconda3\lib\site-packages\numba\compiler_lock.py", line 32, in _acquire_compile_lock
    return func(*args, **kwargs)
  File "C:\Users\Emanuel\Anaconda3\lib\site-packages\numba\compiler.py", line 253, in run
    raise patched_exception
  File "C:\Users\Emanuel\Anaconda3\lib\site-packages\numba\compiler.py", line 244, in run
    stage()
  File "C:\Users\Emanuel\Anaconda3\lib\site-packages\numba\compiler.py", line 731, in stage_nopython_backend
    self._backend(lowerfn, objectmode=False)
  File "C:\Users\Emanuel\Anaconda3\lib\site-packages\numba\compiler.py", line 681, in _backend
    lowered = lowerfn()
  File "C:\Users\Emanuel\Anaconda3\lib\site-packages\numba\compiler.py", line 668, in backend_nopython_mode
    self.metadata)
  File "C:\Users\Emanuel\Anaconda3\lib\site-packages\numba\compiler.py", line 1063, in native_lowering_stage
    lower.lower()
  File "C:\Users\Emanuel\Anaconda3\lib\site-packages\numba\lowering.py", line 177, in lower
    self.lower_normal_function(self.fndesc)
  File "C:\Users\Emanuel\Anaconda3\lib\site-packages\numba\lowering.py", line 218, in lower_normal_function
    entry_block_tail = self.lower_function_body()
  File "C:\Users\Emanuel\Anaconda3\lib\site-packages\numba\lowering.py", line 243, in lower_function_body
    self.lower_block(block)
  File "C:\Users\Emanuel\Anaconda3\lib\site-packages\numba\lowering.py", line 258, in lower_block
    self.lower_inst(inst)
  File "C:\Users\Emanuel\Anaconda3\lib\contextlib.py", line 130, in __exit__
    self.gen.throw(type, value, traceback)
  File "C:\Users\Emanuel\Anaconda3\lib\site-packages\numba\errors.py", line 635, in new_error_context
    six.reraise(type(newerr), newerr, tb)
  File "C:\Users\Emanuel\Anaconda3\lib\site-packages\numba\six.py", line 659, in reraise
    raise value
numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend)
Operands must be the same type, got (i64, i32)

File "..\..\..\..\..\Anaconda3\lib\site-packages\pymssa\optimized.py", line 226:
def incremental_component_reconstruction(trajectory_matrix,
    <source elided>

    components = np.zeros((P, N, rank))
    ^

[1] During: lowering "$0.7 = call $0.2($0.6, func=$0.2, args=[Var($0.6, C:\Users\Emanuel\Anaconda3\lib\site-packages\pymssa\optimized.py (226))], kws=(), vararg=None)" at C:\Users\Emanuel\Anaconda3\lib\site-packages\pymssa\optimized.py (226)
-------------------------------------------------------------------------------
This should not have happened, a problem has occurred in Numba's internals.

Please report the error message and traceback, along with a minimal reproducer
at: https://github.com/numba/numba/issues/new

If more help is needed please feel free to speak to the Numba core developers
directly at: https://gitter.im/numba/numba

Thanks in advance for your help in improving Numba!

@rafidou
Copy link

rafidou commented Jul 1, 2019

I have got the same issue, also working with 64bit Anaconda distribution.
Did anyone among you: @ashi24lion, @veager or @emanuel-raad manage to fix the issue ?
Thanks !

@stuartarchibald
Copy link
Contributor

I suspect the problem is to do with integer sizes on windows.

@rafael-glima
Copy link

I have got the same issue, also working with 64bit Anaconda distribution.
Did anyone among you: @ashi24lion, @veager or @emanuel-raad manage to fix the issue ?
Thanks !

Hi, I managed to get the code to work by commenting the @jit decorator above the function in the line 217 of the optimized.py file, as below:

#@jit(nopython=True, fastmath=True) --> Comment this line
def incremental_component_reconstruction(trajectory_matrix,
left_singular_vectors,
singular_values,
rank,
P,
N,
L):

components = np.zeros((P, N, rank))

components = _incremental_component_reconstruction_inner(
    trajectory_matrix,
    components,
    left_singular_vectors,
    P,
    L
)

return components

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no action required No action was needed to resolve.
Projects
None yet
Development

No branches or pull requests

6 participants