Update Optional[x] -> x | None and Union[x, y] to x | y (#26633)
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
This commit is contained in:
@@ -10,7 +10,7 @@ import time
|
||||
from enum import Enum
|
||||
from pathlib import Path
|
||||
from threading import Thread
|
||||
from typing import Any, Optional, Union
|
||||
from typing import Any
|
||||
from uuid import uuid4
|
||||
|
||||
import cpuinfo
|
||||
@@ -32,7 +32,7 @@ _USAGE_STATS_DO_NOT_TRACK_PATH = os.path.join(_config_home, "do_not_track")
|
||||
_USAGE_STATS_ENABLED = None
|
||||
_USAGE_STATS_SERVER = envs.VLLM_USAGE_STATS_SERVER
|
||||
|
||||
_GLOBAL_RUNTIME_DATA = dict[str, Union[str, int, bool]]()
|
||||
_GLOBAL_RUNTIME_DATA = dict[str, str | int | bool]()
|
||||
|
||||
_USAGE_ENV_VARS_TO_COLLECT = [
|
||||
"VLLM_USE_MODELSCOPE",
|
||||
@@ -46,7 +46,7 @@ _USAGE_ENV_VARS_TO_COLLECT = [
|
||||
]
|
||||
|
||||
|
||||
def set_runtime_usage_data(key: str, value: Union[str, int, bool]) -> None:
|
||||
def set_runtime_usage_data(key: str, value: str | int | bool) -> None:
|
||||
"""Set global usage data that will be sent with every usage heartbeat."""
|
||||
_GLOBAL_RUNTIME_DATA[key] = value
|
||||
|
||||
@@ -131,33 +131,33 @@ class UsageMessage:
|
||||
self.uuid = str(uuid4())
|
||||
|
||||
# Environment Information
|
||||
self.provider: Optional[str] = None
|
||||
self.num_cpu: Optional[int] = None
|
||||
self.cpu_type: Optional[str] = None
|
||||
self.cpu_family_model_stepping: Optional[str] = None
|
||||
self.total_memory: Optional[int] = None
|
||||
self.architecture: Optional[str] = None
|
||||
self.platform: Optional[str] = None
|
||||
self.cuda_runtime: Optional[str] = None
|
||||
self.gpu_count: Optional[int] = None
|
||||
self.gpu_type: Optional[str] = None
|
||||
self.gpu_memory_per_device: Optional[int] = None
|
||||
self.env_var_json: Optional[str] = None
|
||||
self.provider: str | None = None
|
||||
self.num_cpu: int | None = None
|
||||
self.cpu_type: str | None = None
|
||||
self.cpu_family_model_stepping: str | None = None
|
||||
self.total_memory: int | None = None
|
||||
self.architecture: str | None = None
|
||||
self.platform: str | None = None
|
||||
self.cuda_runtime: str | None = None
|
||||
self.gpu_count: int | None = None
|
||||
self.gpu_type: str | None = None
|
||||
self.gpu_memory_per_device: int | None = None
|
||||
self.env_var_json: str | None = None
|
||||
|
||||
# vLLM Information
|
||||
self.model_architecture: Optional[str] = None
|
||||
self.vllm_version: Optional[str] = None
|
||||
self.context: Optional[str] = None
|
||||
self.model_architecture: str | None = None
|
||||
self.vllm_version: str | None = None
|
||||
self.context: str | None = None
|
||||
|
||||
# Metadata
|
||||
self.log_time: Optional[int] = None
|
||||
self.source: Optional[str] = None
|
||||
self.log_time: int | None = None
|
||||
self.source: str | None = None
|
||||
|
||||
def report_usage(
|
||||
self,
|
||||
model_architecture: str,
|
||||
usage_context: UsageContext,
|
||||
extra_kvs: Optional[dict[str, Any]] = None,
|
||||
extra_kvs: dict[str, Any] | None = None,
|
||||
) -> None:
|
||||
t = Thread(
|
||||
target=self._report_usage_worker,
|
||||
|
||||
Reference in New Issue
Block a user