fix abort in webui DDP mode
Former-commit-id: b90ac72d753b13a3eed9cb8b898fac2f2fe5153f
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
import json
|
||||
import os
|
||||
import signal
|
||||
from datetime import datetime
|
||||
from typing import Any, Dict, List, Optional, Tuple
|
||||
|
||||
import psutil
|
||||
from transformers.trainer_utils import get_last_checkpoint
|
||||
from yaml import safe_dump, safe_load
|
||||
|
||||
@@ -17,6 +19,18 @@ if is_gradio_available():
|
||||
import gradio as gr
|
||||
|
||||
|
||||
def abort_leaf_process(pid: int) -> None:
|
||||
r"""
|
||||
Aborts the leaf processes.
|
||||
"""
|
||||
children = psutil.Process(pid).children()
|
||||
if children:
|
||||
for child in children:
|
||||
abort_leaf_process(child.pid)
|
||||
else:
|
||||
os.kill(pid, signal.SIGABRT)
|
||||
|
||||
|
||||
def can_quantize(finetuning_type: str) -> "gr.Dropdown":
|
||||
r"""
|
||||
Judges if the quantization is available in this finetuning type.
|
||||
|
||||
Reference in New Issue
Block a user