MAHOUT-725: [QDP] PyTorch Tensor Detection and CPU Path#763
MAHOUT-725: [QDP] PyTorch Tensor Detection and CPU Path#763rich7420 merged 5 commits intoapache:dev-qdpfrom
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.
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.
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.
This is modified by ruff format
There was a problem hiding this comment.
I think this is a unrelated format error. It should be reverted.
cc @ryankert01
There was a problem hiding this comment.
I have reverted the code PTAL
Signed-off-by: Cheyu Wu <cheyu1220@gmail.com>
|
@400Ping do you want to take another look? |
|
@CheyuWu thanks for the update! |
* feat: [QDP] PyTorch Tensor Detection and CPU Path Signed-off-by: Cheyu Wu <cheyu1220@gmail.com> * style: fix linter issue Signed-off-by: Cheyu Wu <cheyu1220@gmail.com> * style: linter err Signed-off-by: Cheyu Wu <cheyu1220@gmail.com> * doc: add comment for followup pr Signed-off-by: Cheyu Wu <cheyu1220@gmail.com> * revert: ipynb linter fix Signed-off-by: Cheyu Wu <cheyu1220@gmail.com> --------- Signed-off-by: Cheyu Wu <cheyu1220@gmail.com>
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