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

[BUG] **_process_generic defined in base_helpers but needed in base_return_types, circular import restricted** #5694

Open
dcolinmorgan opened this issue Dec 11, 2023 · 2 comments
Labels
? - Needs Triage Need team to review and classify bug Something isn't working

Comments

@dcolinmorgan
Copy link
Contributor

_process_generic is defined in base_helpers but needed in base_return_types

Since base_helpers imports base_return_types, circular import restrict base_return_types from importing _process_generic from base_helpers... so why not just define it where it is called?**

leads to error: AttributeError: type object 'list' has no attribute 'replace'

moving _process_generic to base_return_types solves both initial and knock-on effect errors


NameError                                 Traceback (most recent call last)
[/usr/local/lib/python3.10/dist-packages/cuml/internals/base_return_types.py](https://localhost:8080/#) in _get_base_return_type(class_name, attr)
     80             if is_generic:
---> 81                 return _process_generic(ret_type)
     82             elif issubclass(ret_type, CumlArray):

NameError: name '_process_generic' is not defined

During handling of the above exception, another exception occurred:

AttributeError                            Traceback (most recent call last)

[/usr/local/lib/python3.10/dist-packages/cuml/internals/base_helpers.py](https://localhost:8080/#) in __new__(cls, classname, bases, classDict)
    155             if callable(attribute):
    156 
--> 157                 classDict[attributeName] = _wrap_attribute(
    158                     classname, attributeName, attribute
    159                 )

[/usr/local/lib/python3.10/dist-packages/cuml/internals/base_helpers.py](https://localhost:8080/#) in _wrap_attribute(class_name, attribute_name, attribute, **kwargs)
     77         return attribute
     78 
---> 79     return_type = _get_base_return_type(class_name, attribute)
     80 
     81     if return_type == "generic":

[/usr/local/lib/python3.10/dist-packages/cuml/internals/base_return_types.py](https://localhost:8080/#) in _get_base_return_type(class_name, attr)
     95         # annotations. Strings end up wrapped in an extra layer of quotes,
     96         # which we have to replace here.
---> 97         if attr.__annotations__["return"].replace("'", "") == class_name:
     98             return "base"
     99         # try:

[/usr/lib/python3.10/typing.py](https://localhost:8080/#) in __getattr__(self, attr)
    981         # Also for simplicity we don't relay any dunder names
    982         if '__origin__' in self.__dict__ and not _is_dunder(attr):
--> 983             return getattr(self.__origin__, attr)
    984         raise AttributeError(attr)
    985 


AttributeError: type object 'list' has no attribute 'replace'

Steps/Code to reproduce bug

 !pip install --extra-index-url=https://pypi.nvidia.com cuml-cu11==23.10.00 cudf-cu11==23.10.00 
import cuml,cudf,os
cuml.__version__

!pip install cu-cat
import cu_cat

Expected behavior
imported fine under 23.06

Environment details (please complete the following information):

  • google colab
  • Linux Distro/Architecture: [Ubuntu 22.04]
  • GPU Model/Driver: [T4 and driver 525.105.17]
  • CUDA: [12.0]
  • Method of cuDF & cuML install: [conda, Docker, or from source]
    • !pip install --extra-index-url=https://pypi.nvidia.com cuml-cu11==23.10.00 cudf-cu11==23.10.00
@dcolinmorgan dcolinmorgan added ? - Needs Triage Need team to review and classify bug Something isn't working labels Dec 11, 2023
@dcolinmorgan
Copy link
Contributor Author

#5695

@dantegd
Copy link
Member

dantegd commented Dec 13, 2023

Thanks for the issue and PR @dcolinmorgan! This is tech debt we have from some code re-organizations we have done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
? - Needs Triage Need team to review and classify bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants