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

Usage Stats Collection #2852

Merged
merged 62 commits into from
Mar 29, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
e0e1386
Write info to local json
yhu422 Feb 8, 2024
739f4a1
Merge branch 'main' of github.com:vllm-project/vllm into usage
yhu422 Feb 8, 2024
c33b4cc
add usage context
yhu422 Feb 9, 2024
b74e3a6
removed usage_context from Engine_args
yhu422 Feb 9, 2024
c988e07
Move IO to another process
yhu422 Feb 9, 2024
88c5187
added http request
yhu422 Feb 13, 2024
85adbab
Merge branch 'main' of github.com:vllm-project/vllm into usage
yhu422 Feb 13, 2024
33c9dff
Added additional arg for from_engine_args
yhu422 Feb 13, 2024
ad609f0
comments
yhu422 Feb 13, 2024
8a2f18a
Write info to local json
yhu422 Feb 8, 2024
8e9e5be
Merge branch 'usage' of https://github.com/yhu422/vllm into usage
yhu422 Feb 13, 2024
f537692
Added Comments
yhu422 Feb 13, 2024
0f1ba7f
.
yhu422 Feb 13, 2024
abc3948
Collect usage info on engine initialization
yhu422 Feb 8, 2024
ec54145
Merge branch 'usage' of https://github.com/yhu422/vllm into usage
yhu422 Feb 13, 2024
f84ccaa
Write usage to local file for testing
yhu422 Feb 13, 2024
b08ba86
Fixed Formatting
yhu422 Feb 13, 2024
83ff459
Merge branch 'vllm-project:main' into usage
yhu422 Feb 13, 2024
73b689a
formatting changes
yhu422 Feb 13, 2024
86da72f
Merge branch 'usage' of https://github.com/yhu422/vllm into usage
yhu422 Feb 13, 2024
9c9a188
Minor bug fixed
yhu422 Feb 13, 2024
d2f84cf
tmp
yhu422 Feb 13, 2024
4e888e0
Merge branch 'main' of github.com:vllm-project/vllm into usage
yhu422 Feb 13, 2024
eb48061
Fixed Bug
yhu422 Feb 14, 2024
0684c06
Add Google Cloud Run service URL
yhu422 Feb 14, 2024
8e9890e
More GPU CPU Mem info
yhu422 Feb 16, 2024
5cf652a
Merge branch 'main' of github.com:vllm-project/vllm into usage
yhu422 Feb 27, 2024
d910b05
Added context constant
yhu422 Feb 27, 2024
8cf264b
Formatting & CPU Info
yhu422 Feb 27, 2024
93b8773
Update vllm/usage/usage_lib.py
yhu422 Feb 27, 2024
fe39b84
Added CPU info, new stat file path
yhu422 Feb 27, 2024
fc6e374
added gpu memory
yhu422 Feb 27, 2024
ab23171
added memory
yhu422 Feb 28, 2024
686c84a
Distinguish production/testing usage, added custom domain
yhu422 Mar 1, 2024
877eb78
formatting
yhu422 Mar 1, 2024
bc89a66
Merge branch 'main' of github.com:vllm-project/vllm into usage
yhu422 Mar 1, 2024
36fd304
Merge branch 'main' of github.com:vllm-project/vllm into usage
yhu422 Mar 5, 2024
e54f15b
test/prod distinction
yhu422 Mar 5, 2024
4e35b3b
Remove cpuinfo import
yhu422 Mar 5, 2024
a1597fb
ruff
yhu422 Mar 5, 2024
c580797
Merge branch 'main' of github.com:vllm-project/vllm into usage
yhu422 Mar 14, 2024
84353d4
fixed merge
yhu422 Mar 14, 2024
f2e69fc
Pass up model architecture info for GPUExecutor
yhu422 Mar 14, 2024
4e19967
formatting
yhu422 Mar 14, 2024
f327f3c
formatting
yhu422 Mar 14, 2024
d9c8a44
Get architecture directly from configs
yhu422 Mar 14, 2024
59f0f10
Merge branch 'main' of github.com:vllm-project/vllm into usage
simon-mo Mar 16, 2024
f34259a
edits round
simon-mo Mar 17, 2024
30df77c
ruff
simon-mo Mar 17, 2024
60b652b
Merge branch 'main' of github.com:vllm-project/vllm into usage
simon-mo Mar 28, 2024
be91bab
fix format
simon-mo Mar 28, 2024
4f04743
finish all code level functionality
simon-mo Mar 28, 2024
f4bf862
add wip doc
simon-mo Mar 28, 2024
6b968db
Merge branch 'main' of github.com:vllm-project/vllm into usage
simon-mo Mar 28, 2024
2006788
revert some fixes
simon-mo Mar 28, 2024
db715c8
more fixes
simon-mo Mar 28, 2024
2c1e557
finish doc, readability pass
simon-mo Mar 28, 2024
42e66b8
edit pass
simon-mo Mar 28, 2024
a4e5742
fix doc and isort
simon-mo Mar 28, 2024
9652830
Merge branch 'main' of github.com:vllm-project/vllm into usage
simon-mo Mar 29, 2024
ba63b44
bad merge
simon-mo Mar 29, 2024
58fb78d
add to amd req txt
simon-mo Mar 29, 2024
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
Prev Previous commit
Next Next commit
Added CPU info, new stat file path
  • Loading branch information
yhu422 committed Feb 27, 2024
commit fe39b8410ca962d986994f9babecc484e378e494
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ numpy
torch == 2.1.2
requests
psutil
py-cpuinfo
transformers >= 4.38.0 # Required for Gemma.
xformers == 0.0.23.post1 # Required for CUDA 12.1.
fastapi
Expand Down
3 changes: 1 addition & 2 deletions vllm/engine/llm_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ def __init__(
lora_config: Optional[LoRAConfig],
placement_group: Optional["PlacementGroup"],
log_stats: bool,
usage_context: UsageContext = UsageContext.ENGINE_CONTEXT
) -> None:
usage_context: UsageContext = UsageContext.ENGINE_CONTEXT) -> None:
logger.info(
"Initializing an LLM engine with config: "
f"model={model_config.model!r}, "
Expand Down
20 changes: 13 additions & 7 deletions vllm/usage/usage_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,22 @@
import requests
import datetime
import psutil
import cpuinfo
from threading import Thread
from pathlib import Path
from typing import Optional
from enum import Enum

_xdg_config_home = os.getenv('XDG_CONFIG_HOME',
os.path.expanduser('~/.config'))
_vllm_internal_path = 'vllm/usage_stats.json'

_USAGE_STATS_FILE = os.path.join(
os.path.dirname(os.path.abspath(__file__)),
'usage_stats.json') #File path to store usage data locally
_xdg_config_home,
_vllm_internal_path) #File path to store usage data locally
_USAGE_STATS_ENABLED = None
_USAGE_STATS_SEVER = os.environ.get('VLLM_USAGE_STATS_SERVER',
'https://stats.vllm.ai')
_USAGE_STATS_SERVER = os.environ.get('VLLM_USAGE_STATS_SERVER',
'https://stats.vllm.ai')
_USAGE_STATS_URL = "https://vector-dev-server-uzyrqjjayq-uc.a.run.app" #Placeholder for sending usage data to vector.dev http server


Expand Down Expand Up @@ -60,7 +65,7 @@ def _detect_cloud_provider() -> str:
'google': "GCP",
'oraclecloud': "OCI",
}

for vendor_file in vendor_files:
path = Path(vendor_file)
if path.is_file():
Expand Down Expand Up @@ -115,7 +120,7 @@ def _report_usage(self, model: str, context: UsageContext) -> None:
self.model = model
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if it makes more sense to get the model architecture vs the model name?

E.g. its probably more useful to know its the Llama architecture with size X over the name of the string for tracking purposes. Otherwise youll have to do this on the backend + it may not be recoverable for local models

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+100

self.log_time = _get_current_timestamp_ns()
self.num_cpu = os.cpu_count()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to get the type of CPU as well, such as it's product name so you can be aware of what ISA extensions are available for performance

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1!

self.cpu_type = platform.processor()
self.cpu_type = cpuinfo.get_cpu_info()['brand_raw']
self.total_memory = psutil.virtual_memory().total
self._write_to_file()
headers = {'Content-type': 'application/json'}
Expand All @@ -126,7 +131,8 @@ def _report_usage(self, model: str, context: UsageContext) -> None:
print("Usage Log Request Failed")

def _write_to_file(self):
with open(_USAGE_STATS_FILE, "w") as outfile:
os.makedirs(os.path.dirname(_USAGE_STATS_FILE), exist_ok=True)
with open(_USAGE_STATS_FILE, "w+") as outfile:
json.dump(vars(self), outfile)


Expand Down
Loading