Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
vllm_cscc
Commits
01bea115
Unverified
Commit
01bea115
authored
Nov 14, 2025
by
Cyrus Leung
Committed by
GitHub
Nov 14, 2025
Browse files
[Misc] Remove `warn_for_unimplemented_methods` (#28613)
Signed-off-by:
DarkLight1337
<
tlleungac@connect.ust.hk
>
parent
b39a5026
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
47 deletions
+0
-47
vllm/utils/__init__.py
vllm/utils/__init__.py
+0
-45
vllm/v1/worker/worker_base.py
vllm/v1/worker/worker_base.py
+0
-2
No files found.
vllm/utils/__init__.py
View file @
01bea115
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
import
inspect
import
uuid
import
warnings
from
functools
import
wraps
from
typing
import
Any
,
TypeVar
import
torch
...
...
@@ -69,49 +67,6 @@ def random_uuid() -> str:
return
str
(
uuid
.
uuid4
().
hex
)
def
warn_for_unimplemented_methods
(
cls
:
type
[
T
])
->
type
[
T
]:
"""
A replacement for `abc.ABC`.
When we use `abc.ABC`, subclasses will fail to instantiate
if they do not implement all abstract methods.
Here, we only require `raise NotImplementedError` in the
base class, and log a warning if the method is not implemented
in the subclass.
"""
original_init
=
cls
.
__init__
def
find_unimplemented_methods
(
self
:
object
):
unimplemented_methods
=
[]
for
attr_name
in
dir
(
self
):
# bypass inner method
if
attr_name
.
startswith
(
"_"
):
continue
try
:
attr
=
getattr
(
self
,
attr_name
)
# get the func of callable method
if
callable
(
attr
):
attr_func
=
attr
.
__func__
except
AttributeError
:
continue
src
=
inspect
.
getsource
(
attr_func
)
if
"NotImplementedError"
in
src
:
unimplemented_methods
.
append
(
attr_name
)
if
unimplemented_methods
:
method_names
=
","
.
join
(
unimplemented_methods
)
msg
=
f
"Methods
{
method_names
}
not implemented in
{
self
}
"
logger
.
debug
(
msg
)
@
wraps
(
original_init
)
def
wrapped_init
(
self
,
*
args
,
**
kwargs
)
->
None
:
original_init
(
self
,
*
args
,
**
kwargs
)
find_unimplemented_methods
(
self
)
type
.
__setattr__
(
cls
,
"__init__"
,
wrapped_init
)
return
cls
def
length_from_prompt_token_ids_or_embeds
(
prompt_token_ids
:
list
[
int
]
|
None
,
prompt_embeds
:
torch
.
Tensor
|
None
,
...
...
vllm/v1/worker/worker_base.py
View file @
01bea115
...
...
@@ -13,7 +13,6 @@ from vllm.logger import init_logger
from
vllm.lora.request
import
LoRARequest
from
vllm.multimodal
import
MULTIMODAL_REGISTRY
from
vllm.multimodal.cache
import
worker_receiver_cache_from_config
from
vllm.utils
import
warn_for_unimplemented_methods
from
vllm.utils.import_utils
import
resolve_obj_by_qualname
from
vllm.utils.system_utils
import
update_environment_variables
from
vllm.v1.kv_cache_interface
import
KVCacheSpec
...
...
@@ -33,7 +32,6 @@ logger = init_logger(__name__)
_R
=
TypeVar
(
"_R"
)
@
warn_for_unimplemented_methods
class
WorkerBase
:
"""Worker interface that allows vLLM to cleanly separate implementations for
different hardware. Also abstracts control plane communication, e.g., to
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment