Skip to content

Commit

Permalink
fix doc build
Browse files Browse the repository at this point in the history
Signed-off-by: youkaichao <[email protected]>
  • Loading branch information
youkaichao committed Nov 1, 2024
1 parent d515d61 commit 012533a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions vllm/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1515,6 +1515,14 @@ def weak_ref_tensors(
raise ValueError("Invalid type for tensors")


def is_in_doc_build() -> bool:
try:
from sphinx.ext.autodoc.mock import _MockModule
return isinstance(torch, _MockModule)
except ModuleNotFoundError:
return False


vllm_lib = Library("vllm", "FRAGMENT")


Expand All @@ -1532,6 +1540,8 @@ def direct_register_custom_op(
See https://gist.github.com/youkaichao/ecbea9ec9fc79a45d2adce1784d7a9a5
for more details.
"""
if is_in_doc_build():
return
schema_str = torch.library.infer_schema(op_func, mutates_args=mutates_args)
# FIXME after https://github.com/pytorch/pytorch/issues/139444 is resolved
assert library_name == "vllm"
Expand Down

0 comments on commit 012533a

Please sign in to comment.