mirror of
https://github.com/hiyouga/LLaMA-Factory.git
synced 2025-08-02 03:32:50 +08:00
[3rdparty] fix redundant process group destroy for ray (#7395)
* fix redundant process group destroy for ray * Update tuner.py --------- Co-authored-by: hoshi-hiyouga <hiyouga@buaa.edu.cn>
This commit is contained in:
parent
555b71a1cb
commit
d8a5571be7
@ -38,6 +38,7 @@ from .trainer_utils import get_ray_trainer, get_swanlab_callback
|
||||
|
||||
|
||||
if is_ray_available():
|
||||
import ray
|
||||
from ray.train.huggingface.transformers import RayTrainReportCallback
|
||||
|
||||
|
||||
@ -77,6 +78,9 @@ def _training_function(config: dict[str, Any]) -> None:
|
||||
else:
|
||||
raise ValueError(f"Unknown task: {finetuning_args.stage}.")
|
||||
|
||||
if is_ray_available() and ray.is_initialized():
|
||||
return # if ray is intialized it will destroy the process group on return
|
||||
|
||||
try:
|
||||
if dist.is_initialized():
|
||||
dist.destroy_process_group()
|
||||
|
Loading…
x
Reference in New Issue
Block a user