nanoGPT icon indicating copy to clipboard operation
nanoGPT copied to clipboard

Log the config params to wandb

Open tcapelle opened this issue 2 years ago • 2 comments

This PR logs the parameters living on the global scope as a config to W&B. This is a greedy solution, as the parameters live on the global scope. I do that by checking which params are JSON serializable and filtering out the stuff that starts with dunder:

def guess_config(d):
    "Grab config from globals"
    f = dict(filter(lambda e: not str(e[0]).startswith("__") and is_jsonable(e[1]), d.items()))
    return f 

I put everything into a utils.py file, but you can bring them in. You can see the logged config on the overview tab now.

  • Another small change, I defaulted the wandb_entity to None, this way, runs will go to the current logged user.

globals

tcapelle avatar Jan 04 '23 11:01 tcapelle

Thank you for the entity None tip. I do want to do this but I think I have to first figure out what config solution I'm happy with. I think a lot of people are understandably bothered by the config in globals(), haha. Will think on it today. This would then eliminate need for a new utils file too, and get rid of my poor man's configurator lines of code.

karpathy avatar Jan 04 '23 17:01 karpathy

Thanks! We can log everything tidily to W&B if you put any configuration manager.

tcapelle avatar Jan 04 '23 17:01 tcapelle

This is now supported and implemented by guessing the args using something similar:

config_keys = [k for k,v in globals().items() if not k.startswith('_') and isinstance(v, (int, float, bool, str))]

not proud of it but it works for now. closing this one.

karpathy avatar Jan 12 '23 06:01 karpathy