In [1]:
from os import environ
environ['optimizer'] = 'Adam'
environ['num_workers']= '2'
environ['batch_size']= str(512)
environ['batch_norm']= 'True'
environ['loss_func']='MAPE'
environ['layers'] = '500 300 120 80 30'
environ['dropouts'] = '0.3 '*5
environ['log'] = 'False'
environ['weight_decay'] = '0.01'
environ['cuda_device'] ='cuda:1'
environ['dataset'] = 'data/conv.pkl'
%run utils.ipynb
plt.rcParams['figure.figsize'] = [40, 30]
In [2]:
ds = DatasetFromPkl(dataset, maxsize=None, log=log)
dl = DataLoader(ds, batch_size=batch_size,
sampler=SubsetRandomSampler(range(len(ds))),
num_workers=num_workers)
db = fai.basic_data.DataBunch(dl, dl, device=device)
train_dl = dl
In [3]:
input_size = train_dl.dataset.X.shape[1]
output_size = train_dl.dataset.Y.shape[1]
model = Model_BN(input_size, output_size, hidden_sizes=layers_sizes, drops=drops)
criterion = mape_criterion
l = fai.Learner(db, model, loss_func=criterion)
In [4]:
alpha = 1e-03
epochs = 50
In [5]:
l.fit_one_cycle(epochs, alpha)
In [6]:
l.recorder.plot_losses()
In [7]:
l.recorder.plot_lr()
In [8]:
l = l.load(f"training_tuning")
In [9]:
train_df = get_results_df(train_dl, l.model)
df = train_df
df = df[1:]
In [11]:
df[:][['index', 'prediction']].sort_values(by='prediction', ascending=False)
Out[11]:
In [12]:
ds.schedules[58].schedule_list
Out[12]:
Real speedup of schedule 7 : s = 1.29
In [ ]:
In [ ]:
Real speedup of schedule 19 : s = 1.73
In [26]:
ds.programs[0].dict_repr
Out[26]:
In [ ]:
conv_dataloader = dl
In [20]:
df = get_results_df(conv_dataloader, l.model)
In [24]:
df[:][['index', 'prediction']].sort_values(by='prediction', ascending=False)
Out[24]:
In [27]:
ds.schedules[54].schedule_list
Out[27]:
Real speedup of schedule 58 : s = 1.87
In [ ]:
Real speedup of schedule 54 : s = 1.89