Files
li-lizhe bad0781a2e fix: use y.device instead of hardcoded .cuda() in data2vec compute_var (#3710)
* fix: use y.device instead of hardcoded .cuda() in data2vec compute_var

In compute_var(), zc = torch.tensor(y.size(0)).cuda() unconditionally
calls .cuda() which raises RuntimeError: Torch not compiled with CUDA
enabled on non-CUDA accelerators (Ascend NPU, XPU, HPU, MPS).

Use device=y.device to respect the input tensor's current device.

Signed-off-by: li-lizhe <[email protected]>

* test: add CPU/Gloo regression tests for data2vec compute_var

Cover both the uninitialized (no process group) branch and a real
2-rank Gloo process group with unequal local row counts, pinning the
device-agnostic contract introduced in the parent commit (PR #3710).

Signed-off-by: li-lizhe <[email protected]>

* fix(test): resolve compute_var import and f32_worker spawn pickle

* fix(test): ensure Manager and workers are cleaned up on failure paths

join(timeout) does not terminate a still-running worker, so a crashed or
hung rank could leak a subprocess on test failure. Wrap the two-rank
runner in try/finally that terminate()+join()s any alive worker and shuts
down the Manager.

Signed-off-by: li-lizhe <[email protected]>

---------

Signed-off-by: li-lizhe <[email protected]>
2026-09-21 10:28:58 +08:00
..
2023-12-15 23:46:41 +08:00