-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Add debug setup for inference server & worker #3575
base: main
Are you sure you want to change the base?
Changes from 7 commits
1d99f38
b9f814e
b08dad6
23b5d98
a2f1235
6369f7e
c880a24
8734873
73bbce6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -231,12 +231,14 @@ services: | |
TRUSTED_CLIENT_KEYS: "6969" | ||
ALLOW_DEBUG_AUTH: "True" | ||
API_ROOT: "http://localhost:8000" | ||
DEBUG: "True" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I understand correctly, the compose file is only meant for local development, so setting this here shouldn't be a problem? |
||
volumes: | ||
- "./oasst-shared:/opt/inference/lib/oasst-shared" | ||
- "./inference/server:/opt/inference/server" | ||
restart: unless-stopped | ||
ports: | ||
- "8000:8000" | ||
- "5678:5678" # Port to attach debugger | ||
depends_on: | ||
inference-redis: | ||
condition: service_healthy | ||
|
@@ -254,9 +256,12 @@ services: | |
MODEL_CONFIG_NAME: ${MODEL_CONFIG_NAME:-distilgpt2} | ||
BACKEND_URL: "ws://inference-server:8000" | ||
PARALLELISM: 2 | ||
DEBUG: "True" | ||
volumes: | ||
- "./oasst-shared:/opt/inference/lib/oasst-shared" | ||
- "./inference/worker:/opt/inference/worker" | ||
ports: | ||
- "5679:5679" # Port to attach debugger | ||
deploy: | ||
replicas: 1 | ||
profiles: ["inference"] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -148,3 +148,19 @@ async def maybe_add_debug_api_keys(): | |
async def welcome_message(): | ||
logger.warning("Inference server started") | ||
logger.warning("To stop the server, press Ctrl+C") | ||
|
||
|
||
if __name__ == "__main__": | ||
import uvicorn | ||
import os | ||
|
||
port = int(os.getenv('PORT', "8000")) | ||
is_debug = bool(os.getenv("DEBUG", "False")) | ||
|
||
if is_debug: | ||
import debugpy | ||
debugpy.listen(("0.0.0.0", "5679")) | ||
# Uncomment to wait here until a debugger is attached | ||
# debugpy.wait_for_client() | ||
|
||
uvicorn.run("main:app", host="0.0.0.0", port=port, reload=is_debug) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This method of starting the server is only used for development - the docker image for production still invokes the |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
aiohttp | ||
debugpy | ||
hf_transfer | ||
huggingface_hub | ||
langchain==0.0.142 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note the different ports for server and worker