MCPcopy
hub / github.com/karpathy/minGPT / setup_logging

Function setup_logging

mingpt/utils.py:19–29  ·  view source on GitHub ↗

monotonous bookkeeping

(config)

Source from the content-addressed store, hash-verified

17 torch.cuda.manual_seed_all(seed)
18
19def setup_logging(config):
20 """ monotonous bookkeeping """
21 work_dir = config.system.work_dir
22 # create the work directory if it doesn't already exist
23 os.makedirs(work_dir, exist_ok=True)
24 # log the args (if any)
25 with open(os.path.join(work_dir, 'args.txt'), 'w') as f:
26 f.write(' '.join(sys.argv))
27 # log the config itself
28 with open(os.path.join(work_dir, 'config.json'), 'w') as f:
29 f.write(json.dumps(config.to_dict(), indent=4))
30
31class CfgNode:
32 """ a lightweight configuration class inspired by yacs """

Callers 2

chargpt.pyFile · 0.90
adder.pyFile · 0.90

Calls 1

to_dictMethod · 0.80

Tested by

no test coverage detected