Download pool/shard011/Python/0096523_benchmark.py from Variable-role/sajaniemi_variable_dataset_large: direct link, hf CLI and curl.
- Browser
- Download file 481 Bytes
-
https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/pool/shard011/Python/0096523_benchmark.py
- Command line
-
hf download hf://datasets/Variable-role/sajaniemi_variable_dataset_large/pool/shard011/Python/0096523_benchmark.py
-
curl -L -o 0096523_benchmark.py https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/pool/shard011/Python/0096523_benchmark.py
481 Bytes
| from timeit import default_timer as timer | |
| class benchmark(object): | |
| def __init__(self, msg, fmt="%0.9g", times=1): | |
| self.msg = msg | |
| self.fmt = fmt | |
| self.count = 0 | |
| self.end = times | |
| self.measured = np.zeros(times) | |
| def __enter__(self): | |
| self.start = timer() | |
| return self | |
| def __exit__(self, *args): | |
| t = timer() - self.start | |
| print(("%s : " + self.fmt + " seconds") % (self.msg, t)) | |
| self.time = t | |