Skip to content

Commit

Permalink
Remove get_vllm_instance_id dependency (#52)
Browse files Browse the repository at this point in the history
* Remove get_vllm_instance_id dependency

get_vllm_instance_id was removed in vllm-project/vllm#10976. This PR removes the dependency on that function.

* Update profiler.py
  • Loading branch information
kzawora-intel authored Dec 9, 2024
1 parent 48d0303 commit e096d6f
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions vllm_hpu_extension/profiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
from typing import Any, List
import psutil
import torch
import uuid
from habana_frameworks.torch import torch

from vllm_hpu_extension.utils import is_fake_hpu
from vllm.logger import init_logger
from vllm.utils import get_vllm_instance_id

logger = init_logger(__name__)

Expand Down Expand Up @@ -55,17 +55,18 @@ def run(self):
class HabanaHighLevelProfiler:
profiling_trace_events: queue.Queue = queue.Queue()
event_tid = {'counter': 1, 'external': 2, 'internal': 3}
vllm_instance_id = get_vllm_instance_id()
filename = f'server_events_{vllm_instance_id}.json'
event_cache: List[Any] = []

def __init__(self):
def __init__(self, vllm_instance_id = None):
self.enabled = os.getenv('VLLM_PROFILER_ENABLED',
'false').lower() == 'true' and int(
os.getenv('RANK', '0')) == 0
msg = f'Profiler enabled for: {self.vllm_instance_id}'
logger.info(msg)
if self.enabled:
self.vllm_instance_id = vllm_instance_id if vllm_instance_id is not None \
else f"vllm-instance-{str(uuid.uuid4().hex)}"
msg = f'Profiler enabled for: {self.vllm_instance_id}'
logger.info(msg)
self.filename = f'server_events_{vllm_instance_id}.json'

This comment has been minimized.

Copy link
@tianmu-li

tianmu-li Dec 23, 2024

If vllm_instance_id is not provided as an argument, filename will be set to server_events_None.json.

# initialize the trace file (JSON Array Format)
with open(self.filename, 'w') as outfile:
outfile.write('[')
Expand Down

0 comments on commit e096d6f

Please sign in to comment.