Key Error in wandb.config when using wandb.sweep in pytorch

I am trying to run this codebase GitHub - devzhk/LMCTS. To run hyperparameter sweep, I ran the following:

wandb sweep sweep/simulation/linear-lmcts.yaml
wandb agent [agent id]

The config file seems to have the same style as the sweep tutorial in W&B website has. However, when I run sweep command as above, I get the following error

2022-08-10 02:12:55,113 - wandb.wandb_agent - INFO - Running runs: []
2022-08-10 02:12:55,352 - wandb.wandb_agent - INFO - Agent received command: run
2022-08-10 02:12:55,362 - wandb.wandb_agent - INFO - Agent starting run with config:
	T: 10000
	algo: LMCTS
	beta_inv: 0.0001
	datapath: data/gaussian50-20-1-1.pt
	dim_context: 20
	func: linear
	lr: 0.1
	model: linear
	num_arm: 50
	num_iter: 70
	sigma: 0.5
2022-08-10 02:12:55,372 - wandb.wandb_agent - INFO - About to run command: /usr/bin/env python3 run_simulation.py
2022-08-10 02:13:00,385 - wandb.wandb_agent - INFO - Running runs: ['ngxmksza']
/home/mila/i/ishfaqha/code/LMCTS/LCMTS/lib/python3.7/site-packages/sklearn/feature_extraction/image.py:167: DeprecationWarning: `np.int` is a deprecated alias for the builtin `int`. To silence this warning, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
  dtype=np.int):
Random seed: 720
Traceback (most recent call last):
  File "run_simulation.py", line 107, in <module>
    run(config, args)
  File "run_simulation.py", line 41, in run
    data = torch.load(config['datapath'])
KeyError: 'datapath'

Shouldn’t it automatically parse the config?

Hi @hmishfaq , followed up on this in the git thread as well. You are correct that wandb will automatically parse the config. In line 27 of run_simulation.py ,the condition if args.log and wandb isn’t satisfied as the default fixed-linear-lmcts.yaml file doesn’t include the command - log , thus wandb init is never called. See the LMCTS README.md for more info

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.