Skip to content

Commit

Permalink
Fix class inspection
Browse files Browse the repository at this point in the history
Signed-off-by: Luka Govedic <[email protected]>
  • Loading branch information
ProExpertProg committed Nov 20, 2024
1 parent 894c63d commit ee289bc
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion vllm/compilation/inductor_pass.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import hashlib
import inspect
import types
from abc import ABC, abstractmethod
from typing import Any, Callable, Optional, Union

Expand Down Expand Up @@ -39,7 +40,12 @@ def hash_source(*srcs: Union[str, Any]):
"""
hasher = hashlib.sha256()
for src in srcs:
src_str = src if isinstance(src, str) else inspect.getsource(src)
if isinstance(src, str):
src_str = src
elif isinstance(src, types.FunctionType):
src_str = inspect.getsource(src)
else:
src_str = inspect.getsource(src.__class__)
hasher.update(src_str.encode("utf-8"))
return hasher.digest()

Expand Down

0 comments on commit ee289bc

Please sign in to comment.