File size: 451 Bytes
27ba426
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
"""⭐ 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