Skip to content

Simplify cpu_to_gpu and gpu_to_cpu#6395

Merged
rapids-bot[bot] merged 2 commits intorapidsai:branch-25.04from
jcrist:cleanup-cpu-gpu
Mar 5, 2025
Merged

Simplify cpu_to_gpu and gpu_to_cpu#6395
rapids-bot[bot] merged 2 commits intorapidsai:branch-25.04from
jcrist:cleanup-cpu-gpu

Conversation

@jcrist
Copy link
Copy Markdown
Member

@jcrist jcrist commented Mar 4, 2025

This is fixing a few warts I noticed when fixing a bug in some related code a while ago. In particular, there's no reason to store the desired order as an attribute on the cls as {name}_order (added here) - you can just pull it off the descriptor directly when needed. The rest is some pythonic improvements, but logic-wise everything should be the same as it was before.

This is fixing a few warts I noticed when fixing a bug in some related
code a while ago. In particular, there's no reason to store the desired
order as an attribute on the cls as `{name}_order` - you can just pull
it off the descriptor directly when needed. The rest is some pythonic
improvements, but logically everything should be the same as it was
before.
@jcrist jcrist requested a review from a team as a code owner March 4, 2025 23:14
@jcrist jcrist requested review from cjnolet and vyasr March 4, 2025 23:14
@github-actions github-actions Bot added the Cython / Python Cython or Python issue label Mar 4, 2025
@jcrist jcrist added improvement Improvement / enhancement to an existing function non-breaking Non-breaking change Cython / Python Cython or Python issue and removed Cython / Python Cython or Python issue labels Mar 4, 2025
Copy link
Copy Markdown
Member

@betatim betatim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM


A more general comment/thought related to this area:

One thing I've not liked about get_attr_names is that we rely on the attribute names in scikit-learn and cuml matching (and not changing/this list being up to date). We could solve the problem of keeping the list up to date by using vars(estimator) (maybe with a conditional), but it seems sometimes get_attr_names only contains fitted attributes (ending in _) but sometimes it also contains private attributes. So it seems hopeless to try and automatically discover this list. It seems quite fragile to transfer private attributes, unless we are just transferring them to store them "for later" when we want to transfer back?

@jcrist
Copy link
Copy Markdown
Member Author

jcrist commented Mar 5, 2025

/merge

@rapids-bot rapids-bot Bot merged commit 2dd67cc into rapidsai:branch-25.04 Mar 5, 2025
@jcrist jcrist deleted the cleanup-cpu-gpu branch March 5, 2025 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Cython / Python Cython or Python issue improvement Improvement / enhancement to an existing function non-breaking Non-breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants