You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When cudf.pandas is enabled then passing a Numpy array to ExponentialSmoothing from statsmodels.tsa.holtwinters involves the pandas accelerator (odd no?) and leads to an exception.
File /nvme/1/thead/miniconda/envs/cuml-dev-24.06/lib/python3.11/site-packages/cudf/pandas/fast_slow_proxy.py:934, in _transform_arg(arg, attribute_name, seen)
932 if type(arg) is tuple:
933 # Must come first to avoid infinite recursion
--> 934 return tuple(_transform_arg(a, attribute_name, seen) for a in arg)
935 elif hasattr(arg, "getnewargs_ex"):
936 # Partial implementation of to reconstruct with
937 # transformed pieces
938 # This handles scipy._lib._bunch._make_tuple_bunch
File /nvme/1/thead/miniconda/envs/cuml-dev-24.06/lib/python3.11/site-packages/cudf/pandas/fast_slow_proxy.py:934, in (.0)
932 if type(arg) is tuple:
933 # Must come first to avoid infinite recursion
--> 934 return tuple(_transform_arg(a, attribute_name, seen) for a in arg)
935 elif hasattr(arg, "getnewargs_ex"):
936 # Partial implementation of to reconstruct with
937 # transformed pieces
938 # This handles scipy._lib._bunch._make_tuple_bunch
File /nvme/1/thead/miniconda/envs/cuml-dev-24.06/lib/python3.11/site-packages/cudf/pandas/fast_slow_proxy.py:917, in _transform_arg(arg, attribute_name, seen)
916 if isinstance(arg, (_FastSlowProxy, _FastSlowProxyMeta, _FunctionProxy)):
--> 917 typ = getattr(arg, attribute_name)
918 if typ is _Unusable:
File /nvme/1/thead/miniconda/envs/cuml-dev-24.06/lib/python3.11/site-packages/cudf/pandas/fast_slow_proxy.py:528, in _FastSlowProxy._fsproxy_fast(self)
523 """
524 Returns the wrapped object. If the wrapped object is of "slow"
525 type, replaces it with the corresponding "fast" object before
526 returning it.
527 """
--> 528 self._fsproxy_wrapped = self._fsproxy_slow_to_fast()
529 return self._fsproxy_wrapped
File /nvme/1/thead/miniconda/envs/cuml-dev-24.06/lib/python3.11/site-packages/nvtx/nvtx.py:116, in annotate.call..inner(*args, **kwargs)
115 libnvtx_push_range(self.attributes, self.domain.handle)
--> 116 result = func(*args, **kwargs)
117 libnvtx_pop_range(self.domain.handle)
File /nvme/1/thead/miniconda/envs/cuml-dev-24.06/lib/python3.11/site-packages/cudf/pandas/fast_slow_proxy.py:934, in _transform_arg(arg, attribute_name, seen)
932 if type(arg) is tuple:
933 # Must come first to avoid infinite recursion
--> 934 return tuple(_transform_arg(a, attribute_name, seen) for a in arg)
935 elif hasattr(arg, "getnewargs_ex"):
936 # Partial implementation of to reconstruct with
937 # transformed pieces
938 # This handles scipy._lib._bunch._make_tuple_bunch
File /nvme/1/thead/miniconda/envs/cuml-dev-24.06/lib/python3.11/site-packages/cudf/pandas/fast_slow_proxy.py:934, in (.0)
932 if type(arg) is tuple:
933 # Must come first to avoid infinite recursion
--> 934 return tuple(_transform_arg(a, attribute_name, seen) for a in arg)
935 elif hasattr(arg, "getnewargs_ex"):
936 # Partial implementation of to reconstruct with
937 # transformed pieces
938 # This handles scipy._lib._bunch._make_tuple_bunch
File /nvme/1/thead/miniconda/envs/cuml-dev-24.06/lib/python3.11/site-packages/cudf/pandas/fast_slow_proxy.py:917, in _transform_arg(arg, attribute_name, seen)
916 if isinstance(arg, (_FastSlowProxy, _FastSlowProxyMeta, _FunctionProxy)):
--> 917 typ = getattr(arg, attribute_name)
918 if typ is _Unusable:
File /nvme/1/thead/miniconda/envs/cuml-dev-24.06/lib/python3.11/site-packages/cudf/pandas/fast_slow_proxy.py:528, in _FastSlowProxy._fsproxy_fast(self)
523 """
524 Returns the wrapped object. If the wrapped object is of "slow"
525 type, replaces it with the corresponding "fast" object before
526 returning it.
527 """
--> 528 self._fsproxy_wrapped = self._fsproxy_slow_to_fast()
529 return self._fsproxy_wrapped
File /nvme/1/thead/miniconda/envs/cuml-dev-24.06/lib/python3.11/site-packages/nvtx/nvtx.py:116, in annotate.call..inner(*args, **kwargs)
115 libnvtx_push_range(self.attributes, self.domain.handle)
--> 116 result = func(*args, **kwargs)
117 libnvtx_pop_range(self.domain.handle)
File /nvme/1/thead/miniconda/envs/cuml-dev-24.06/lib/python3.11/site-packages/cudf/pandas/fast_slow_proxy.py:76, in _Unusable.call(self, *args, **kwds)
75 def call(self, *args: Any, **kwds: Any) -> Any:
---> 76 raise NotImplementedError(
77 "Fast implementation not available. "
78 "Falling back to the slow implementation"
79 )
NotImplementedError: Fast implementation not available. Falling back to the slow implementation
During handling of the above exception, another exception occurred:
TypeError Traceback (most recent call last)
Cell In[1], line 130
127 airpassengers = np.asarray(airpassengers, dtype=np.float64)
129 # this line leads to the traceback
--> 130 ExponentialSmoothing(airpassengers, initialization_method='heuristic', seasonal='additive', seasonal_periods=12)
File /nvme/1/thead/miniconda/envs/cuml-dev-24.06/lib/python3.11/site-packages/cudf/pandas/fast_slow_proxy.py:837, in _CallableProxyMixin.call(self, *args, **kwargs)
836 def call(self, *args, **kwargs) -> Any:
--> 837 result, _ = _fast_slow_function_call(
838 # We cannot directly call self here because we need it to be
839 # converted into either the fast or slow object (by
840 # _fast_slow_function_call) to avoid infinite recursion.
841 # TODO: When Python 3.11 is the minimum supported Python version
842 # this can use operator.call
843 call_operator,
844 self,
845 args,
846 kwargs,
847 )
848 return result
File /nvme/1/thead/miniconda/envs/cuml-dev-24.06/lib/python3.11/site-packages/cudf/pandas/fast_slow_proxy.py:902, in _fast_slow_function_call(func, *args, **kwargs)
900 slow_args, slow_kwargs = _slow_arg(args), _slow_arg(kwargs)
901 with disable_module_accelerator():
--> 902 result = func(*slow_args, **slow_kwargs)
903 return _maybe_wrap_result(result, func, *args, **kwargs), fast
Leaving some notes after a first pass investigation:
ExponentialSmoothing.__init__ is quietly a pandas function since it uses the pandas.util._decorators.deprecate_kwarg decorator. Seems like self as an arg to __init__ isn't being proxied correctly when falling back to a "slow" path.
Removing the @deprecate_kwarg allows ExponentialSmoothing to construct correctly
Describe the bug
When
cudf.pandas
is enabled then passing a Numpy array toExponentialSmoothing
fromstatsmodels.tsa.holtwinters
involves the pandas accelerator (odd no?) and leads to an exception.Steps/Code to reproduce bug
Full traceback
NotImplementedError Traceback (most recent call last)
File /nvme/1/thead/miniconda/envs/cuml-dev-24.06/lib/python3.11/site-packages/cudf/pandas/fast_slow_proxy.py:888, in _fast_slow_function_call(func, *args, **kwargs)
883 with nvtx.annotate(
884 "EXECUTE_FAST",
885 color=_CUDF_PANDAS_NVTX_COLORS["EXECUTE_FAST"],
886 domain="cudf_pandas",
887 ):
--> 888 fast_args, fast_kwargs = _fast_arg(args), _fast_arg(kwargs)
889 result = func(*fast_args, **fast_kwargs)
File /nvme/1/thead/miniconda/envs/cuml-dev-24.06/lib/python3.11/site-packages/cudf/pandas/fast_slow_proxy.py:1007, in _fast_arg(arg)
1006 seen: Set[int] = set()
-> 1007 return _transform_arg(arg, "_fsproxy_fast", seen)
File /nvme/1/thead/miniconda/envs/cuml-dev-24.06/lib/python3.11/site-packages/cudf/pandas/fast_slow_proxy.py:934, in _transform_arg(arg, attribute_name, seen)
932 if type(arg) is tuple:
933 # Must come first to avoid infinite recursion
--> 934 return tuple(_transform_arg(a, attribute_name, seen) for a in arg)
935 elif hasattr(arg, "getnewargs_ex"):
936 # Partial implementation of to reconstruct with
937 # transformed pieces
938 # This handles scipy._lib._bunch._make_tuple_bunch
File /nvme/1/thead/miniconda/envs/cuml-dev-24.06/lib/python3.11/site-packages/cudf/pandas/fast_slow_proxy.py:934, in (.0)
932 if type(arg) is tuple:
933 # Must come first to avoid infinite recursion
--> 934 return tuple(_transform_arg(a, attribute_name, seen) for a in arg)
935 elif hasattr(arg, "getnewargs_ex"):
936 # Partial implementation of to reconstruct with
937 # transformed pieces
938 # This handles scipy._lib._bunch._make_tuple_bunch
File /nvme/1/thead/miniconda/envs/cuml-dev-24.06/lib/python3.11/site-packages/cudf/pandas/fast_slow_proxy.py:917, in _transform_arg(arg, attribute_name, seen)
916 if isinstance(arg, (_FastSlowProxy, _FastSlowProxyMeta, _FunctionProxy)):
--> 917 typ = getattr(arg, attribute_name)
918 if typ is _Unusable:
File /nvme/1/thead/miniconda/envs/cuml-dev-24.06/lib/python3.11/site-packages/cudf/pandas/fast_slow_proxy.py:528, in _FastSlowProxy._fsproxy_fast(self)
523 """
524 Returns the wrapped object. If the wrapped object is of "slow"
525 type, replaces it with the corresponding "fast" object before
526 returning it.
527 """
--> 528 self._fsproxy_wrapped = self._fsproxy_slow_to_fast()
529 return self._fsproxy_wrapped
File /nvme/1/thead/miniconda/envs/cuml-dev-24.06/lib/python3.11/site-packages/nvtx/nvtx.py:116, in annotate.call..inner(*args, **kwargs)
115 libnvtx_push_range(self.attributes, self.domain.handle)
--> 116 result = func(*args, **kwargs)
117 libnvtx_pop_range(self.domain.handle)
File /nvme/1/thead/miniconda/envs/cuml-dev-24.06/lib/python3.11/site-packages/cudf/pandas/fast_slow_proxy.py:786, in _IntermediateProxy._fsproxy_slow_to_fast(self)
785 func, args, kwargs = self._method_chain
--> 786 args, kwargs = _fast_arg(args), _fast_arg(kwargs)
787 return func(*args, **kwargs)
File /nvme/1/thead/miniconda/envs/cuml-dev-24.06/lib/python3.11/site-packages/cudf/pandas/fast_slow_proxy.py:1007, in _fast_arg(arg)
1006 seen: Set[int] = set()
-> 1007 return _transform_arg(arg, "_fsproxy_fast", seen)
File /nvme/1/thead/miniconda/envs/cuml-dev-24.06/lib/python3.11/site-packages/cudf/pandas/fast_slow_proxy.py:934, in _transform_arg(arg, attribute_name, seen)
932 if type(arg) is tuple:
933 # Must come first to avoid infinite recursion
--> 934 return tuple(_transform_arg(a, attribute_name, seen) for a in arg)
935 elif hasattr(arg, "getnewargs_ex"):
936 # Partial implementation of to reconstruct with
937 # transformed pieces
938 # This handles scipy._lib._bunch._make_tuple_bunch
File /nvme/1/thead/miniconda/envs/cuml-dev-24.06/lib/python3.11/site-packages/cudf/pandas/fast_slow_proxy.py:934, in (.0)
932 if type(arg) is tuple:
933 # Must come first to avoid infinite recursion
--> 934 return tuple(_transform_arg(a, attribute_name, seen) for a in arg)
935 elif hasattr(arg, "getnewargs_ex"):
936 # Partial implementation of to reconstruct with
937 # transformed pieces
938 # This handles scipy._lib._bunch._make_tuple_bunch
File /nvme/1/thead/miniconda/envs/cuml-dev-24.06/lib/python3.11/site-packages/cudf/pandas/fast_slow_proxy.py:917, in _transform_arg(arg, attribute_name, seen)
916 if isinstance(arg, (_FastSlowProxy, _FastSlowProxyMeta, _FunctionProxy)):
--> 917 typ = getattr(arg, attribute_name)
918 if typ is _Unusable:
File /nvme/1/thead/miniconda/envs/cuml-dev-24.06/lib/python3.11/site-packages/cudf/pandas/fast_slow_proxy.py:528, in _FastSlowProxy._fsproxy_fast(self)
523 """
524 Returns the wrapped object. If the wrapped object is of "slow"
525 type, replaces it with the corresponding "fast" object before
526 returning it.
527 """
--> 528 self._fsproxy_wrapped = self._fsproxy_slow_to_fast()
529 return self._fsproxy_wrapped
File /nvme/1/thead/miniconda/envs/cuml-dev-24.06/lib/python3.11/site-packages/nvtx/nvtx.py:116, in annotate.call..inner(*args, **kwargs)
115 libnvtx_push_range(self.attributes, self.domain.handle)
--> 116 result = func(*args, **kwargs)
117 libnvtx_pop_range(self.domain.handle)
File /nvme/1/thead/miniconda/envs/cuml-dev-24.06/lib/python3.11/site-packages/cudf/pandas/fast_slow_proxy.py:787, in _IntermediateProxy._fsproxy_slow_to_fast(self)
786 args, kwargs = _fast_arg(args), _fast_arg(kwargs)
--> 787 return func(*args, **kwargs)
File /nvme/1/thead/miniconda/envs/cuml-dev-24.06/lib/python3.11/site-packages/cudf/pandas/fast_slow_proxy.py:30, in call_operator(fn, args, kwargs)
29 def call_operator(fn, args, kwargs):
---> 30 return fn(*args, **kwargs)
File /nvme/1/thead/miniconda/envs/cuml-dev-24.06/lib/python3.11/site-packages/cudf/pandas/fast_slow_proxy.py:76, in _Unusable.call(self, *args, **kwds)
75 def call(self, *args: Any, **kwds: Any) -> Any:
---> 76 raise NotImplementedError(
77 "Fast implementation not available. "
78 "Falling back to the slow implementation"
79 )
NotImplementedError: Fast implementation not available. Falling back to the slow implementation
During handling of the above exception, another exception occurred:
TypeError Traceback (most recent call last)
Cell In[1], line 130
127 airpassengers = np.asarray(airpassengers, dtype=np.float64)
129 # this line leads to the traceback
--> 130 ExponentialSmoothing(airpassengers, initialization_method='heuristic', seasonal='additive', seasonal_periods=12)
File /nvme/1/thead/miniconda/envs/cuml-dev-24.06/lib/python3.11/site-packages/cudf/pandas/fast_slow_proxy.py:837, in _CallableProxyMixin.call(self, *args, **kwargs)
836 def call(self, *args, **kwargs) -> Any:
--> 837 result, _ = _fast_slow_function_call(
838 # We cannot directly call self here because we need it to be
839 # converted into either the fast or slow object (by
840 # _fast_slow_function_call) to avoid infinite recursion.
841 # TODO: When Python 3.11 is the minimum supported Python version
842 # this can use operator.call
843 call_operator,
844 self,
845 args,
846 kwargs,
847 )
848 return result
File /nvme/1/thead/miniconda/envs/cuml-dev-24.06/lib/python3.11/site-packages/cudf/pandas/fast_slow_proxy.py:902, in _fast_slow_function_call(func, *args, **kwargs)
900 slow_args, slow_kwargs = _slow_arg(args), _slow_arg(kwargs)
901 with disable_module_accelerator():
--> 902 result = func(*slow_args, **slow_kwargs)
903 return _maybe_wrap_result(result, func, *args, **kwargs), fast
File /nvme/1/thead/miniconda/envs/cuml-dev-24.06/lib/python3.11/site-packages/cudf/pandas/fast_slow_proxy.py:30, in call_operator(fn, args, kwargs)
29 def call_operator(fn, args, kwargs):
---> 30 return fn(*args, **kwargs)
File /nvme/1/thead/miniconda/envs/cuml-dev-24.06/lib/python3.11/site-packages/pandas/util/_decorators.py:213, in deprecate_kwarg.._deprecate_kwarg..wrapper(*args, **kwargs)
211 raise TypeError(msg)
212 kwargs[new_arg_name] = new_arg_value
--> 213 return func(*args, **kwargs)
TypeError: ExponentialSmoothing.init() missing 1 required positional argument: 'endog'
Expected behavior
No error
Environment overview (please complete the following information)
Setup cuml dev environment using a conda env
Environment details
Please run and paste the output of the
cudf/print_env.sh
script here, to gather any other relevant environment detailsClick here to see environment details
The text was updated successfully, but these errors were encountered: