vllm.ir.util ¶
Functions:
-
hash_source–Utility method to hash the sources of functions or objects.
-
weak_cache–Simple weak equivalent to functools.cache
-
weak_lru_cache–LRU Cache decorator that keeps a weak reference to 'self'.
hash_source(*srcs) ¶
Utility method to hash the sources of functions or objects. Args: srcs: strings or objects to add to the hash. Objects and functions have their source inspected.
Source code in vllm/ir/util.py
weak_cache(user_function) ¶
weak_lru_cache(maxsize=128, typed=False) ¶
LRU Cache decorator that keeps a weak reference to 'self'. This avoids memory leakage, which happens when functools.lru_cache stores a reference to self in the global cache.
Taken from: https://stackoverflow.com/a/68052994/5082708