Spaces:
Runtime error
Runtime error
Download utils.py from recky101/mango_clfd: direct link, hf CLI and curl.
- Browser
- Download file 387 Bytes
-
https://huggingface.co/spaces/recky101/mango_clfd/resolve/main/utils.py
- Command line
-
hf download hf://spaces/recky101/mango_clfd/utils.py
-
curl -L -o utils.py https://huggingface.co/spaces/recky101/mango_clfd/resolve/main/utils.py
387 Bytes
| """ | |
| @author: Yanzuo Lu | |
| @author: oliveryanzuolu@gmail.com | |
| """ | |
| import logging | |
| logger = logging.getLogger() | |
| class AverageMeter: | |
| def __init__(self): | |
| self.val = 0 | |
| self.avg = 0 | |
| self.sum = 0 | |
| self.count = 0 | |
| def update(self, val, n=1): | |
| self.val = val | |
| self.sum += val * n | |
| self.count += n | |
| self.avg = self.sum / self.count |