daily pastebin goal
68%
SHARE
TWEET

Untitled

a guest Jan 21st, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from multiprocessing import Pool
  2. import sys, subprocess
  3. from sklearn.model_selection import ParameterSampler
  4.  
  5. N_DEVICES = 9
  6.  
  7.  
  8. def spawn(params):
  9.     args_str = ' '.join('--{} {}'.format(key, params[key]) for key in params)
  10.     return subprocess.run([sys.executable, 'train.personal.py'] + args_str.split(), env=None)
  11.  
  12.  
  13. param_grid = dict(
  14.     vnet_choice=[1, 4],
  15.     td_num_steps=[10, 20, 50, 100],
  16.     v_num_updates_per_step=[2, 5, 10, 20],
  17.     v_batch_size=[8, 16, 32, 64],
  18.     drop_rate=[0.3, 0.5, 0.7],
  19.     v_lr=[5e-4, 1e-3, 2e-3],
  20.     grad_clip=[10, 100]
  21. )
  22.  
  23. param_grid = list(ParameterSampler(param_grid, 100))
  24. for i, params in enumerate(param_grid):
  25.     params['gpu'] = i % N_DEVICES - 1
  26.  
  27. pool = Pool((N_DEVICES * 2))
  28. ret_codes = pool.map(spawn, param_grid)
  29. print(ret_codes)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top