Skip to content
This repository was archived by the owner on Sep 10, 2025. It is now read-only.

Commit e07b03d

Browse files
committed
Rename setup_env in server + fix condition
1 parent 3ad31e8 commit e07b03d

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

torchchat/usages/server.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
from flask import Flask, request, Response
2525

2626
from torchchat.cli.builder import BuilderArgs, TokenizerArgs
27-
from torchchat.distributed.utils import setup_env
27+
from torchchat.distributed.utils import run_in_dist_env
2828
from torchchat.generate import GeneratorArgs
2929

3030
from torchchat.usages.openai_api import (
@@ -73,11 +73,10 @@ def create_app(args): # noqa: C901
7373
mp_context = mp.get_context('spawn')
7474
queue = mp_context.Queue()
7575

76-
if builder_args.distributed:
7776
for i in range(1, world_size):
7877
fn = partial(run_worker, args, i, queue)
7978
mp_context = mp.get_context('spawn')
80-
procs.append(mp_context.Process(target=setup_env, args=(world_size, i, fn)))
79+
procs.append(mp_context.Process(target=run_in_dist_env, args=(world_size, i, fn)))
8180
procs[-1].start()
8281

8382
environ["MASTER_ADDR"] = "localhost"

0 commit comments

Comments
 (0)