cuml icon indicating copy to clipboard operation
cuml copied to clipboard

common: check for dask_cudf before check its instance

Open jcfaracco opened this issue 2 years ago • 5 comments

Fixes: #4748

If there is no dask_cudf packages installed, this verification is still being executed. Then, it causes an exception because dask_cudf does not exists. It is important to use has_dask_cudf() to avoid that exception and bypass the instance check.

Signed-off-by: Julio Faracco [email protected]

jcfaracco avatar May 22 '22 18:05 jcfaracco

Can one of the admins verify this patch?

GPUtester avatar May 22 '22 18:05 GPUtester

I'm able to reproduce this error using a singularity container which does not have a dask_cudf installed. This instance is a single GPU only.

I'm using the StandardScaler example (see CuML API documentation) and I'm getting this:

Traceback (most recent call last):
  File "scaler_test.py", line 22, in <module>
    print(scaler.fit_transform(data))
  File "/opt/conda/envs/rapids/lib/python3.8/site-packages/cuml/_thirdparty/sklearn/utils/skl_dependencies.py", line 162, in fit_transform
    return self.fit(X, **fit_params).transform(X)
  File "/opt/conda/envs/rapids/lib/python3.8/site-packages/cuml/internals/api_decorators.py", line 409, in inner_with_setters
    return func(*args, **kwargs)
  File "/opt/conda/envs/rapids/lib/python3.8/site-packages/cuml/_thirdparty/sklearn/preprocessing/_data.py", line 658, in fit
    return self.partial_fit(X, y)
  File "/opt/conda/envs/rapids/lib/python3.8/site-packages/cuml/internals/api_decorators.py", line 409, in inner_with_setters
    return func(*args, **kwargs)
  File "/opt/conda/envs/rapids/lib/python3.8/site-packages/cuml/_thirdparty/sklearn/preprocessing/_data.py", line 687, in partial_fit
    X = self._validate_data(X, accept_sparse=('csr', 'csc'),
  File "/opt/conda/envs/rapids/lib/python3.8/site-packages/cuml/_thirdparty/sklearn/utils/skl_dependencies.py", line 111, in _validate_data
    X = check_array(X, **check_params)
  File "/opt/conda/envs/rapids/lib/python3.8/site-packages/cuml/thirdparty_adapters/adapters.py", line 273, in check_array
    X, n_rows, n_cols, dtype = input_to_cupy_array(array,
  File "/opt/conda/envs/rapids/lib/python3.8/contextlib.py", line 75, in inner
    return func(*args, **kwds)
  File "/opt/conda/envs/rapids/lib/python3.8/site-packages/cuml/common/input_utils.py", line 451, in input_to_cupy_array
    out_data = input_to_cuml_array(X,
  File "/opt/conda/envs/rapids/lib/python3.8/contextlib.py", line 75, in inner
    return func(*args, **kwds)
  File "/opt/conda/envs/rapids/lib/python3.8/site-packages/cuml/internals/api_decorators.py", line 360, in inner
    return func(*args, **kwargs)
  File "/opt/conda/envs/rapids/lib/python3.8/site-packages/cuml/common/input_utils.py", line 318, in input_to_cuml_array
    if isinstance(X, (dask_cudf.core.Series, dask_cudf.core.DataFrame)):
NameError: name 'dask_cudf' is not defined

jcfaracco avatar May 22 '22 18:05 jcfaracco

ok to test

cjnolet avatar May 23 '22 15:05 cjnolet

This PR has been labeled inactive-30d due to no recent activity in the past 30 days. Please close this PR if it is no longer required. Otherwise, please respond with a comment indicating any updates. This PR will be labeled inactive-90d if there is no activity in the next 60 days.

github-actions[bot] avatar Jun 22 '22 16:06 github-actions[bot]

This PR has been labeled inactive-90d due to no recent activity in the past 90 days. Please close this PR if it is no longer required. Otherwise, please respond with a comment indicating any updates.

github-actions[bot] avatar Sep 20 '22 16:09 github-actions[bot]