Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[LLM] Support disable distributed launch #2275

Open
wants to merge 2 commits into
base: llm
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions llm/fastdeploy_llm/utils/launch_infer.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,19 @@ def launch(device_ids, **kwargs: dict):

pd_cmd = "python3 -m paddle.distributed.launch --devices {} {} {}".format(
device_ids, infer_script_path, ' '.join(args))

multicard = True
try:
ids = eval(device_ids)
if isinstance(ids, int):
multicard = False
except:
pass

if os.getenv("DISABLE_DISTRIBUTED_LAUNCH", "OFF") == "ON" and not multicard:
logger.info("Since DISABLE_DISTRIBUTED_LAUNCH=ON and the model is running with single card, will disable paddle.distributed.launch.")
pd_cmd = "python3 {} {}".format(infer_script_path, ' '.join(args))

logger.info("Launch model with command: {}".format(pd_cmd))
logger.info("Model is initializing...")
p = subprocess.Popen(
Expand Down