You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add multi-process logger utility for status monitoring (#254)
* Add logger utility for detailed status monitoring
* Fix `flake8` errors
* Clean up info messages
* Leave PPO rollout progress bar
* Update logging doc and add tip
* Clarify `README.md` logging docs
* Adopt Hugging Face logging API
* Run pre-commit
* Remove redundant verbosity setters
* Toggle rollout bar positioning for suppressed verbosity levels
trlX uses the standard Python `logging` library to log training information to the console. The default logger is set to the `INFO` level, which means that `INFO`, `WARNING`, `ERROR`, and `CRITICAL` level messages will be printed to standard output.
79
+
80
+
To change the log level directly, you can use the verbosity setter. For example, to set the log level to `WARNING` use:
81
+
82
+
```python
83
+
import trlx
84
+
85
+
trlx.logging.set_verbosity(trlx.logging.WARNING)
86
+
```
87
+
88
+
This will suppress `INFO` level messages, but still print `WARNING`, `ERROR`, and `CRITICAL` level messages.
89
+
90
+
You can also control logging verbosity by setting the `TRLX_VERBOSITY` environment variable to one of the standard logging [level names](https://docs.python.org/3/library/logging.html#logging-levels):
91
+
92
+
*`CRITICAL` (`trlx.logging.CRITICAL`)
93
+
*`ERROR` (`trlx.logging.ERROR`)
94
+
*`WARNING` (`trlx.logging.WARNING`)
95
+
*`INFO` (`trlx.logging.INFO`)
96
+
*`DEBUG` (`trlx.logging.DEBUG`)
97
+
98
+
```sh
99
+
export TRLX_VERBOSITY=WARNING
100
+
```
101
+
102
+
By default, [`tqdm`](https://tqdm.github.io/docs/tqdm/) progress bars are used to display training progress. You can disable them by calling `trlx.logging.disable_progress_bar()`, otherwise `trlx.logging.enable_progress_bar()` to enable.
103
+
104
+
Messages can be formatted with greater detail by setting `trlx.logging.enable_explicit_format()`. This will inject call-site information into each log which may be helpful for debugging.
> 💡 Tip: To reduce the amount of logging output, you might find it helpful to change log levels of third-party libraries used by trlX. For example, try adding `transformers.logging.set_verbosity_error()` to the top of your trlX scripts to silence verbose messages from the `transformers` library (see their [logging docs](https://huggingface.co/docs/transformers/main_classes/logging#logging) for more details).
0 commit comments