Download examples/OmniGen2-RL/omnigen2/utils/logging_utils.py from chibifire/EditScore-code: direct link, hf CLI and curl.
- Browser
- Download file 437 Bytes
-
https://huggingface.co/chibifire/EditScore-code/resolve/main/examples/OmniGen2-RL/omnigen2/utils/logging_utils.py
- Command line
-
hf download hf://chibifire/EditScore-code/examples/OmniGen2-RL/omnigen2/utils/logging_utils.py
-
curl -L -o logging_utils.py https://huggingface.co/chibifire/EditScore-code/resolve/main/examples/OmniGen2-RL/omnigen2/utils/logging_utils.py
437 Bytes
| import logging | |
| class TqdmToLogger(object): | |
| """File-like object to redirect tqdm output to a logger.""" | |
| def __init__(self, logger, level=logging.INFO): | |
| self.logger = logger | |
| self.level = level | |
| def write(self, buf): | |
| for line in buf.rstrip().splitlines(): | |
| self.logger.log(self.level, line) | |
| def flush(self): | |
| for handler in self.logger.logger.handlers: | |
| handler.flush() |