Fixed infinite recursion: Added check if hasattr(replica, '_original_forward') and replica is target_model in the worker to use the original forward method when the replica is the original model, preventing parallel_forward from calling itself recursively. Device reference safety: Converted devices_ref and weights_ref to tuples to prevent accidental modification after assignment. Explicit device comparison: Used replica is target_model to detect when we're using the original model vs a clone. Consistent fallback handling: Both the single-device fallback and the OOM fallback now check for _original_forward to use the correct method. Better logging: Added explicit print at the end showing which devices are actually being used. This ensures that when CUDA:0 is the original device and CUDA:1 is a clone, both are used correctly without the original device causing a recursive loop.
2 lines
6 B
Plaintext
2 lines
6 B
Plaintext
*.zip
|