lm-sys / lm-sys/FastChat

[model_worker] should `worker-address` argument need to be changed when `host` or `port` arguments are changed?

Open
#2,467 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
39.5k
Forks
4.8k
PR merge metrics
No merged PRs in 30d

Description

Hello! I'm a student interested in this repo.
I found that if `model_worker`'s `host` or `port` is changed, `worker_address` should be changed accordingly.
(Because the `controller` will access `worker` via `worker_address`.)

If what I found is correct thing, I want to add some logic or helper messages for proper match of `host`, `port` and `worker_address`.

Followings are options what I'm going to add.
1. Automatically Construct worker_address. (`args.worker_address = f"http://{host}:{port}"`)
2. Add Help Message. (`parser.add_argument("--worker-address", help=~~~, ...)`)
3. Add assertions about matching of `host`, `port` and `worker_address` under the argument parser code, and if it doesn't match each other, return error message.

Could my team work on this Issue? (And sorry for the uneven English expression.)

---
---

``` python
# model_worker.py
def create_model_worker():
parser = argparse.ArgumentParser()
parser.add_argument("--host", type=str, default="localhost")
parser.add_argument("--port", type=int, default=21002)
parser.add_argument("--worker-address", type=str, default="http://localhost:21002")
...
```

``` python
# model_worker.py
if __name__ == "__main__":
args, worker = create_model_worker()
uvicorn.run(app, host=args.host, port=args.port, log_level="info")
```
uvicorn is run on `args.host:args.port`

---

``` python
# model_worker.py
def register_to_controller(self):
logger.info("Register to controller")

url = self.controller_addr + "/register_worker"
data = {
"worker_name": self.worker_addr,
"check_heart_beat": True,
"worker_status": self.get_status(),
}
r = requests.post(url, json=data)
assert r.status_code == 200
```
register to controller with `worker_addr` argument.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read model_worker.py, starting with the argument parser, the uvicorn startup call, and register_to_controller. Confirm how host, port, and worker-address are used, then establish the expected behavior for mismatched values and verify that the worker listens at the address registered with the controller.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.