Skip to content
Snippets Groups Projects
Commit 52f401a8 authored by Sun Jin Kim's avatar Sun Jin Kim
Browse files

benchmark code

parent 5c4e5a18
No related branches found
No related tags found
No related merge requests found
import torchvision.datasets as datasets
import torchvision
import torch
import MetaAugment.child_networks as cn
import MetaAugment.autoaugment_learners as aal
from .util_04_22 import *
# aa_learner config
config = {
'sp_num' : 3,
'learning_rate' : 1e-1,
'toy_flag' : False,
# 'toy_flag' : True,
# 'toy_size' : 0.001,
'batch_size' : 32,
'max_epochs' : 100,
'early_stop_num' : 10,
}
# CIFAR10 with LeNet
train_dataset = datasets.CIFAR10(root='./datasets/cifar10/train',
train=True, download=True, transform=None)
test_dataset = datasets.CIFAR10(root='./datasets/cifar10/train',
train=False, download=True,
transform=torchvision.transforms.ToTensor())
child_network_architecture = cn.LeNet(
img_height=32,
img_width=32,
num_labels=10,
img_channels=3
)
# gru
run_benchmark(
save_file='./benchmark/pickles/04_22_cf_ln_gru',
train_dataset=train_dataset,
test_dataset=test_dataset,
child_network_architecture=child_network_architecture,
agent_arch=aal.gru_learner,
config=config,
)
\ No newline at end of file
import torchvision.datasets as datasets
import torchvision
import torch
import MetaAugment.child_networks as cn
import MetaAugment.autoaugment_learners as aal
from .util_04_22 import *
# aa_learner config
config = {
'sp_num' : 3,
'learning_rate' : 1e-1,
'toy_flag' : False,
# 'toy_flag' : True,
# 'toy_size' : 0.001,
'batch_size' : 32,
'max_epochs' : 100,
'early_stop_num' : 10,
}
# CIFAR10 with LeNet
train_dataset = datasets.CIFAR10(root='./datasets/cifar10/train',
train=True, download=True, transform=None)
test_dataset = datasets.CIFAR10(root='./datasets/cifar10/train',
train=False, download=True,
transform=torchvision.transforms.ToTensor())
child_network_architecture = cn.LeNet(
img_height=32,
img_width=32,
num_labels=10,
img_channels=3
)
# rs
run_benchmark(
save_file='./benchmark/pickles/04_22_cf_ln_rs',
train_dataset=train_dataset,
test_dataset=test_dataset,
child_network_architecture=child_network_architecture,
agent_arch=aal.randomsearch_learner,
config=config,
)
import torchvision.datasets as datasets
import torchvision
import torch
import MetaAugment.child_networks as cn
import MetaAugment.autoaugment_learners as aal
from .util_04_22 import *
# aa_learner config
config = {
'sp_num' : 3,
'learning_rate' : 1e-1,
'toy_flag' : False,
# 'toy_flag' : True,
# 'toy_size' : 0.001,
'batch_size' : 32,
'max_epochs' : 100,
'early_stop_num' : 10,
}
# FashionMNIST with SimpleNet
train_dataset = datasets.FashionMNIST(root='./datasets/fashionmnist/train',
train=True, download=True, transform=None)
test_dataset = datasets.FashionMNIST(root='./datasets/fashionmnist/test',
train=False, download=True,
transform=torchvision.transforms.ToTensor())
child_network_architecture = cn.SimpleNet
# gru
run_benchmark(
save_file='./benchmark/pickles/04_22_fm_sn_gru.pkl',
train_dataset=train_dataset,
test_dataset=test_dataset,
child_network_architecture=child_network_architecture,
agent_arch=aal.gru_learner,
config=config,
)
\ No newline at end of file
import torchvision.datasets as datasets
import torchvision
import torch
import MetaAugment.child_networks as cn
import MetaAugment.autoaugment_learners as aal
from .util_04_22 import *
# aa_learner config
config = {
'sp_num' : 3,
'learning_rate' : 1e-1,
'toy_flag' : False,
# 'toy_flag' : True,
# 'toy_size' : 0.001,
'batch_size' : 32,
'max_epochs' : 100,
'early_stop_num' : 10,
}
# FashionMNIST with SimpleNet
train_dataset = datasets.FashionMNIST(root='./datasets/fashionmnist/train',
train=True, download=True, transform=None)
test_dataset = datasets.FashionMNIST(root='./datasets/fashionmnist/test',
train=False, download=True,
transform=torchvision.transforms.ToTensor())
child_network_architecture = cn.SimpleNet
# rs
run_benchmark(
save_file='./benchmark/pickles/04_22_fm_sn_rs.pkl',
train_dataset=train_dataset,
test_dataset=test_dataset,
child_network_architecture=child_network_architecture,
agent_arch=aal.randomsearch_learner,
config=config,
)
\ No newline at end of file
......@@ -5,7 +5,7 @@ import torch
import MetaAugment.child_networks as cn
import MetaAugment.autoaugment_learners as aal
from pathlib import Path
"""
testing gru_learner and randomsearch_learner on
......@@ -25,12 +25,12 @@ else:
def run_benchmark(
save_file,
total_iter,
train_dataset,
test_dataset,
child_network_architecture,
agent_arch,
config,
total_iter=150,
):
try:
# try to load agent
......@@ -56,82 +56,4 @@ def run_benchmark(
with open(save_file, 'wb+') as f:
torch.save(agent, f)
print('run_benchmark closing')
# aa_learner config
config = {
'sp_num' : 3,
'learning_rate' : 1e-1,
'toy_flag' : False,
# 'toy_flag' : True,
# 'toy_size' : 0.001,
'batch_size' : 32,
'max_epochs' : 100,
'early_stop_num' : 10,
}
total_iter=150
# FashionMNIST with SimpleNet
train_dataset = datasets.FashionMNIST(root='./datasets/fashionmnist/train',
train=True, download=True, transform=None)
test_dataset = datasets.FashionMNIST(root='./datasets/fashionmnist/test',
train=False, download=True,
transform=torchvision.transforms.ToTensor())
child_network_architecture = cn.SimpleNet
# gru
run_benchmark(
save_file='./benchmark/pickles/04_22_fm_sn_gru.pkl',
total_iter=total_iter,
train_dataset=train_dataset,
test_dataset=test_dataset,
child_network_architecture=child_network_architecture,
agent_arch=aal.gru_learner,
config=config,
)
# rs
run_benchmark(
save_file='./benchmark/pickles/04_22_fm_sn_rs.pkl',
total_iter=total_iter,
train_dataset=train_dataset,
test_dataset=test_dataset,
child_network_architecture=child_network_architecture,
agent_arch=aal.randomsearch_learner,
config=config,
)
# CIFAR10 with LeNet
train_dataset = datasets.CIFAR10(root='./datasets/cifar10/train',
train=True, download=True, transform=None)
test_dataset = datasets.CIFAR10(root='./datasets/cifar10/train',
train=False, download=True,
transform=torchvision.transforms.ToTensor())
child_network_architecture = cn.SimpleNet
# gru
run_benchmark(
save_file='./benchmark/pickles/04_22_cf_ln_gru',
total_iter=total_iter,
train_dataset=train_dataset,
test_dataset=test_dataset,
child_network_architecture=child_network_architecture,
agent_arch=aal.gru_learner,
config=config,
)
# rs
run_benchmark(
save_file='./benchmark/pickles/04_22_cf_ln_rs',
total_iter=total_iter,
train_dataset=train_dataset,
test_dataset=test_dataset,
child_network_architecture=child_network_architecture,
agent_arch=aal.randomsearch_learner,
config=config,
)
print('run_benchmark closing')
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment