lmcinnes / umap

Uniform Manifold Approximation and Projection
BSD 3-Clause "New" or "Revised" License
7.46k stars 808 forks source link

UMAP model load complication with joblib and numba #473

Open homaansari opened 4 years ago

homaansari commented 4 years ago

I face a problem in loading a dumped model by joblib which is not similar to the previous raised issues, as far as I understood. Here are the version of different relevant modules:

pathon version 3.7.7 umap version 0.4.4 pynndescent version 0.4.7 numba version 0.46.0 llvmlite version 0.30.0

And the snippet of error message:

Traceback (most recent call last):

File "", line 1, in umap_model = joblib.load( model_dir + umap_reducer_fname )

File "C:\Users\ansa_ho\Anaconda3\lib\site-packages\joblib\numpy_pickle.py", line 585, in load obj = _unpickle(fobj, filename, mmap_mode)

File "C:\Users\ansa_ho\Anaconda3\lib\site-packages\joblib\numpy_pickle.py", line 504, in _unpickle obj = unpickler.load()

File "C:\Users\ansa_ho\Anaconda3\lib\pickle.py", line 1088, in load dispatchkey[0]

File "C:\Users\ansa_ho\Anaconda3\lib\site-packages\joblib\numpy_pickle.py", line 329, in load_build Unpickler.load_build(self)

File "C:\Users\ansa_ho\Anaconda3\lib\pickle.py", line 1552, in load_build setstate(state)

File "C:\Users\ansaho\Anaconda3\lib\site-packages\pynndescent\pynndescent.py", line 1026, in setstate self._rp_forest = tuple([renumbaify_tree(tree) for tree in d["_rp_forest"]])

File "C:\Users\ansaho\Anaconda3\lib\site-packages\pynndescent\pynndescent.py", line 1026, in self._rp_forest = tuple([renumbaify_tree(tree) for tree in d["_rp_forest"]])

File "C:\Users\ansa_ho\Anaconda3\lib\site-packages\pynndescent\rp_trees.py", line 1178, in renumbaify_tree hyperplanes.extend(tree.hyperplanes)

File "C:\Users\ansa_ho\Anaconda3\lib\site-packages\numba\typed\typedlist.py", line 265, in extend return _extend(self, iterable)

File "C:\Users\ansa_ho\Anaconda3\lib\site-packages\numba\dispatcher.py", line 401, in _compile_for_args error_rewrite(e, 'typing')

File "C:\Users\ansa_ho\Anaconda3\lib\site-packages\numba\dispatcher.py", line 344, in error_rewrite reraise(type(e), e, None)

File "C:\Users\ansa_ho\Anaconda3\lib\site-packages\numba\six.py", line 668, in reraise raise value.with_traceback(tb)

TypingError: Failed in nopython mode pipeline (step: nopython frontend) Internal error at <numba.typeinfer.CallConstraint object at 0x0000023BCE0EA2C8>. Failed in nopython mode pipeline (step: nopython mode backend)

File "......\Anaconda3\lib\site-packages\numba\listobject.py", line 434: def impl(l, item): casteditem = _cast(item, itemty) ^

[1] During: lowering "$0.4 = call $0.1(item, $0.3, func=$0.1, args=[Var(item, C:\Users\ansa_ho\Anaconda3\lib\site-packages\numba\listobject.py (434)), Var($0.3, C:\Users\ansa_ho\Anaconda3\lib\site-packages\numba\listobject.py (434))], kws=(), vararg=None)" at C:\Users\ansa_ho\Anaconda3\lib\site-packages\numba\listobject.py (434) [2] During: resolving callee type: BoundFunction((<class 'numba.types.containers.ListType'>, 'append') for ListType[array(float64, 2d, C)]) [3] During: typing of call at C:\Users\ansa_ho\Anaconda3\lib\site-packages\numba\listobject.py (840)


I'd appreciate any support.

wise-east commented 4 years ago

I have the same issue. Did you make any progress on resolving this issue?

konradsemsch commented 4 years ago

Similar issue on my side:

Error:


model = joblib.load(path)
  | 2020-08-18T09:33:21.382+02:00 | File "/usr/local/lib/python3.8/site-packages/joblib/numpy_pickle.py", line 585, in load
  | 2020-08-18T09:33:21.382+02:00 | obj = _unpickle(fobj, filename, mmap_mode)
  | 2020-08-18T09:33:21.382+02:00 | File "/usr/local/lib/python3.8/site-packages/joblib/numpy_pickle.py", line 504, in _unpickle
  | 2020-08-18T09:33:21.382+02:00 | obj = unpickler.load()
  | 2020-08-18T09:33:21.382+02:00 | File "/usr/local/lib/python3.8/pickle.py", line 1210, in load
  | 2020-08-18T09:33:21.383+02:00 | dispatch[key[0]](self)
  | 2020-08-18T09:33:21.383+02:00 | File "/usr/local/lib/python3.8/pickle.py", line 1587, in load_reduce
  | 2020-08-18T09:33:21.384+02:00 | stack[-1] = func(*args)
  | 2020-08-18T09:33:21.384+02:00 | File "/usr/local/lib/python3.8/site-packages/numba/core/serialize.py", line 40, in _rebuild_reduction
  | 2020-08-18T09:33:21.384+02:00 | return cls._rebuild(*args)
  | 2020-08-18T09:33:21.384+02:00 | File "/usr/local/lib/python3.8/site-packages/numba/core/dispatcher.py", line 787, in _rebuild
  | 2020-08-18T09:33:21.385+02:00 | self = cls(py_func, locals, targetoptions, impl_kind)
  | 2020-08-18T09:33:21.385+02:00 | File "/usr/local/lib/python3.8/site-packages/numba/core/dispatcher.py", line 710, in __init__
  | 2020-08-18T09:33:21.385+02:00 | pysig = utils.pysignature(py_func)
  | 2020-08-18T09:33:21.385+02:00 | File "/usr/local/lib/python3.8/inspect.py", line 3093, in signature
  | 2020-08-18T09:33:21.386+02:00 | return Signature.from_callable(obj, follow_wrapped=follow_wrapped)
  | 2020-08-18T09:33:21.386+02:00 | File "/usr/local/lib/python3.8/inspect.py", line 2842, in from_callable
  | 2020-08-18T09:33:21.387+02:00 | return _signature_from_callable(obj, sigcls=cls,
  | 2020-08-18T09:33:21.387+02:00 | File "/usr/local/lib/python3.8/inspect.py", line 2216, in _signature_from_callable
  | 2020-08-18T09:33:21.387+02:00 | raise TypeError('{!r} is not a callable object'.format(obj))
  | 2020-08-18T09:33:21.387+02:00 | TypeError: ((4, b'3\r\r\n', b'\xe3\x02\x00\x00\x00\x00\x00\x00\x00\x07\x00\x00\x00\x03\x00\x00\x00C\x00\x00\x00sp\x00\x00\x00d\x01}\x02d\x01}\x03xFt\x00\|\x00j\x01d\x02\x19\x00\x83\x01D\x00]4}\x04\|\x00\|\x04\x19\x00d\x02k\x03}\x05\|\x01\|\x04\x19\x00d\x02k\x03}\x06\|\x02\|\x05p<\|\x067\x00}\x02\|\x03\|\x05oH\|\x067\x00}\x03q\x18W\x00\|\x02d\x01k\x02r\\d\x01S\x00t\x02\|\x02\|\x03\x18\x00\x83\x01\|\x02\x1b\x00S\x00d\x00S\x00)\x03N\xe7\x00\x00\x00\x00\x00\x00\x00\x00\xe9\x00\x00\x00\x00)\x03\xda\x05range\xda\x05shape\xda\x05float)\x07\xda\x01x\xda\x01y\xda\x0cnum_non_zero\xda\tnum_equal\xda\x01i\xda\x06x_true\xda\x06y_true\xa9\x00r\r\x00\x00\x00\xfay/Users/konradsemsch/.local/share/virtualenvs/pcw_signup_prediction-WNi69Rz8/lib/python3.6/site-packages/umap/distances.py\xda\x07jaccard}\x01\x00\x00s\x14\x00\x00\x00\x00\x02\x04\x01\x04\x01\x14\x01\x0c\x01\x0c\x01\x0c\x01\x10\x02\x08\x01\x04\x02'), {'range': <class 'range'>, 'float': <class 'float'>, '__name__': 'umap.distances'}, 'jaccard', None) is not a callable object

Environment

alembic==1.4.2
attrs==19.3.0
awscli==1.18.121
boto3==1.14.44
botocore==1.17.44
certifi==2020.6.20
chardet==3.0.4
click==7.1.2
cliff==3.4.0
cmaes==0.6.0
cmd2==1.3.3
colorama==0.4.3
colorlog==4.2.1
dill==0.3.2
docutils==0.15.2
idna==2.10
jmespath==0.10.0
joblib==0.16.0
lightgbm==2.3.1
llvmlite==0.34.0
Mako==1.1.3
MarkupSafe==1.1.1
numba==0.51.0
numpy==1.19.1
optuna==1.5.0
pandas==1.1.0
pbr==5.4.5
pgeocode==0.2.1
prettytable==0.7.2
pyarrow==1.0.0
pyasn1==0.4.8
pyparsing==2.4.7
pyperclip==1.8.0
python-dateutil==2.8.1
python-editor==1.0.4
pytz==2020.1
PyYAML==5.3.1
requests==2.24.0
rsa==4.5
s3transfer==0.3.3
scikit-learn==0.23.1
scipy==1.5.2
six==1.15.0
SQLAlchemy==1.3.19
stevedore==3.2.0
threadpoolctl==2.1.0
tqdm==4.48.2
umap-learn==0.4.6
urllib3==1.25.10
wcwidth==0.2.5