-
Notifications
You must be signed in to change notification settings - Fork 972
MAHOUT-725: [QDP] PyTorch Tensor Detection and CPU Path #763
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
base: dev-qdp
Are you sure you want to change the base?
Conversation
Manual Testing(mahout) user@DESKTOP-UDTSV2K:~/code/mahout$ cd ./qdp/qdp-python/
(mahout) user@DESKTOP-UDTSV2K:~/code/mahout/qdp/qdp-python$ cp ../target/debug/libmahout_qdp.so mahout_qdp.so && PYTHONPATH=. pytest .
========================================================================== test session starts ==========================================================================
platform linux -- Python 3.11.13, pytest-9.0.2, pluggy-1.6.0
rootdir: /home/user/code/mahout/qdp/qdp-python
configfile: pyproject.toml
collected 21 items
tests/test_bindings.py ...s..... [ 42%]
tests/test_high_fidelity.py ............ [100%]
===================================================================== 20 passed, 1 skipped in 3.30s ===================================================================== |
|
please fix the ci error |
|
Hi @400Ping, I have fixed the problem PTAL |
|
I think overall is good but we are going to merge #753 into dev-qdp, I think it is best to wait for it to merge and fix the conflicts for this pr. |
|
Its merged, please taken account how other inputs are written and refactor this pr. |
OK, I will address this tomorrow |
|
plz fix precommit errors |
|
Hi @rich7420 @400Ping , I’ve addressed the issue. Manual Testing(qdp-python) user@DESKTOP-UDTSV2K:~/code/mahout/qdp/qdp-python$ PYTHONPATH=. python -m pytest .
========================================================================== test session starts ==========================================================================
platform linux -- Python 3.11.13, pytest-9.0.1, pluggy-1.6.0
rootdir: /home/user/code/mahout/qdp/qdp-python
configfile: pyproject.toml
collected 21 items
tests/test_bindings.py ...s..... [ 42%]
tests/test_high_fidelity.py ............ [100%]
===================================================================== 20 passed, 1 skipped in 2.63s ===================================================================== |
|
@CheyuWu see this #752 (comment) |
Signed-off-by: Cheyu Wu <cheyu1220@gmail.com>
|
cc @guan404ming @rich7420 @ryankert01 to review |
|
@CheyuWu plz fix this pre-commit error |
Signed-off-by: Cheyu Wu <cheyu1220@gmail.com>
|
Let me check what is going on |
| let data: Vec<f64> = tensor | ||
| .call_method0("flatten")? | ||
| .call_method0("tolist")? | ||
| .extract()?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems here do twice copy.
PyTorch tensor → Python list
Python list → Rust Vec<f64>
We should improve this in follow-up PR use like numpy() or PinnedHostBuffer way to decrease memory copy time.
Please comments in this part.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK no problem
I have added the comment PTAL
|
I think overall LGTM |
Signed-off-by: Cheyu Wu <cheyu1220@gmail.com>
Signed-off-by: Cheyu Wu <cheyu1220@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is modified by ruff format
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a unrelated format error. It should be reverted.
cc @ryankert01
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have reverted the code PTAL
Signed-off-by: Cheyu Wu <cheyu1220@gmail.com>
|
@400Ping do you want to take another look? |
Purpose of PR
This issue asks the ability to detect and handle PyTorch tensors, focusing on cpu tensors.
Related Issues or PRs
Closes #725
Changes Made
Breaking Changes
Checklist