OpenLLMAI / OpenRLHF

An Easy-to-use, Scalable and High-performance RLHF Framework (70B+ PPO Full Tuning & Iterative DPO & LoRA & Mixtral)
https://openrlhf.readthedocs.io/
Apache License 2.0
1.73k stars 164 forks source link

Use existing wandb login if available. #231

Closed mgerstgrasser closed 4 months ago

mgerstgrasser commented 4 months ago

Currently wandb logging is enabled by passing a wandb API key as a CLI argument. However, that makes it easy to accidentally commit an API key as part of a shell script. It is also not necessary, as wandb stores API keys systemwide after running wandb login on the command line.

This PR makes a minimal change to only run wandb.login() in Python if the user is not already logged in. The effect is that you can just pass --use_wandb True (or any value) instead of --use_wandb ....api_key... if you're already logged in. However, if you are not already logged in, this PR does not break things, and will still accept an API key through the CLI argument.

(The only thing I can see that this could possibly break is if you are logged in into one wandb account, and tried to pass an API key for a different wandb account. I don't know if this is a concern?)

hijkzzz commented 4 months ago

Great MR