MCPcopy Create free account
hub / github.com/OpenSparseLLMs/MoM / decorator

Function decorator

lm-eval-harness/lm_eval/models/utils.py:335–350  ·  view source on GitHub ↗
(func: Callable)

Source from the content-addressed store, hash-verified

333 """
334
335 def decorator(func: Callable):
336 @wraps(func)
337 def wrapper(*args, **kwargs):
338 sleep_time = backoff_time
339 attempt = 0
340 while max_retries is None or attempt < max_retries:
341 try:
342 return func(*args, **kwargs)
343 except tuple(on_exceptions) as e:
344 if on_exception_callback is not None:
345 on_exception_callback(e, sleep_time)
346 time.sleep(sleep_time)
347 sleep_time *= backoff_multiplier
348 attempt += 1
349
350 return wrapper
351
352 return decorator
353

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected