Skip to content

Commit

Permalink
Do not raise error if _Backend is not found
Browse files Browse the repository at this point in the history
Signed-off-by: wangxiyuan <[email protected]>
  • Loading branch information
wangxiyuan committed Jan 14, 2025
1 parent f35ec46 commit 9e5a540
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions vllm/attention/selector.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@
logger = init_logger(__name__)


def backend_name_to_enum(backend_name: str) -> _Backend:
def backend_name_to_enum(backend_name: str) -> Optional[_Backend]:
assert backend_name is not None

backend_members = _Backend.__members__
if backend_name not in backend_members:
raise ValueError(f"Invalid attention backend '{backend_name}'. "
f"Available backends: {', '.join(backend_members)} "
"(case-sensitive).")
logger.warning(f"Invalid attention backend '{backend_name}'. "
f"Available backends: {', '.join(backend_members)} "
"(case-sensitive).")

Check failure on line 24 in vllm/attention/selector.py

View workflow job for this annotation

GitHub Actions / ruff (3.12)

Ruff (G004)

vllm/attention/selector.py:22:24: G004 Logging statement uses f-string
return None

return _Backend[backend_name]

Expand Down

0 comments on commit 9e5a540

Please sign in to comment.