Skip to content

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.

Parameters:

  • srcs

    (str | Any, default: () ) –

    strings or objects to add to the hash. Objects and functions have their source inspected.

weak_cache(user_function)

Simple weak equivalent to functools.cache.

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