Esempio n. 1
0

if dataset == "mosei":
	log_dir = "log/gridsearch_mosei_200epochs/{}".format(mode)
else:
	log_dir = "log/gridsearch_{}/{}".format(dataset, mode)

if mode in ['PhantomD', 'PhantomDG', 'PhantomIntermD', 'PhantomIntermInputD', 'MT2']:
	log_dir += "_D" + str(modality_drop)
if mode in ['PhantomDG', 'MT2', 'MT3', 'MT3+']:
	log_dir += "_G" + str(g_loss_weight)
log_dir += "/"

if __name__=='__main__':

	grid = standard_grid.Grid(filename, log_dir)

	grid.register('mode', [mode])
	if mode in ['PhantomD', 'PhantomDG', 'PhantomIntermD', 'PhantomIntermInputD', 'MT2']:
		grid.register('modality_drop', [modality_drop])
	if mode in ['PhantomDG', 'MT2', 'MT3', 'MT3+']:
		grid.register('g_loss_weight', [g_loss_weight])
	#grid.register('hparam_iter', list(range(100)))
	grid.register('hparam_iter', [96]) #MT3+
	#grid.register('hparam_iter', [59]) #MT2

	grid.generate_grid()

	grid.generate_shell_instances(prefix="source ~/anaconda3/bin/activate ; conda activate mfn ; python ",postfix="")

import standard_grid
import time
import os

if __name__ == "__main__":

    grid = standard_grid.Grid("../../../ml_code_json.py", "./results/")

    grid.register('bs', [32, 64])
    grid.register('lr_net', [0.001, 0.01, 0.0001])
    grid.register('epochs', [5000, 6000, 100000000000])

    grid.generate_grid()
    grid.shuffle_grid()

    grid.generate_shell_instances(prefix="python ", postfix="")
    grid.create_runner(num_runners=None,
                       runners_prefix=["sbatch -p gpu_low -c 1 --gres=gpu:1"])
Esempio n. 3
0
import sys
sys.path.append(SG_PATH)
import standard_grid
from utils import *
from hp import hp
from os.path import join

if __name__=="__main__":
    hash_len = 4 # the number of characters in each hash.  if running lots of tests, may have collision if too few chars.  elif running few tests, can be nice to have smaller identifying strings
    email_args= {
        'subject': 'Hello there',
        'text': '',
        'to_addr': '*****@*****.**',
        'secrets_path': './mailgun_secrets.json',
    }
    grid = standard_grid.Grid('./model.py','./results/', hash_len=hash_len, email_args=None)

    for k,v in hp.items():
        grid.register(k,v)

    grid.generate_grid()
    grid.shuffle_grid()
    grid.generate_shell_instances(prefix='python ',postfix='')
    
    # Breaks the work across num_gpus GPUs, num_parallel jobs on each gpu
    num_gpus = 3
    num_parallel = 1
    hash_out = grid.create_runner(num_runners=num_gpus,runners_prefix=['CUDA_VISIBLE_DEVICES=%d sh'%i for i in range(num_gpus)],parallel=num_parallel)

    print(f'''