chainyo's picture
add timeit function
27ba426
raw
history blame
451 Bytes
"""⭐ Text Classification with Optimum and ONNXRuntime
Utils functions.
Author:
- @ChainYo - https://github.com/ChainYo
"""
from time import time
def timeit(func):
"""Timeit decorator."""
def wrapper(*args, **kwargs):
"""Wrapper."""
start = time()
result = func(*args, **kwargs)
end = time()
print(f"{func.__name__} took {end - start:.2f} seconds.")
return result
return wrapper