Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MetaRL
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Wang, Mia
MetaRL
Commits
86e0fc89
Commit
86e0fc89
authored
2 years ago
by
Mia Wang
Browse files
Options
Downloads
Patches
Plain Diff
connect ds and childnetwork selection to flask
parent
c0d18959
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app.py
+2
-5
2 additions, 5 deletions
app.py
auto_augmentation/progress.py
+43
-1
43 additions, 1 deletion
auto_augmentation/progress.py
auto_augmentation/templates/home.html
+20
-12
20 additions, 12 deletions
auto_augmentation/templates/home.html
with
65 additions
and
18 deletions
app.py
+
2
−
5
View file @
86e0fc89
from
flask
import
Flask
from
auto_augmentation
import
create_app
import
os
app
=
create_app
()
port
=
int
(
os
.
environ
.
get
(
"
PORT
"
,
5000
))
# if __name__ == '__main__':
# app.run(host='0.0.0.0',port=port)
if
__name__
==
'
__main__
'
:
app
.
run
(
debug
=
True
)
\ No newline at end of file
app
.
run
(
host
=
'
0.0.0.0
'
,
port
=
port
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
auto_augmentation/progress.py
+
43
−
1
View file @
86e0fc89
from
flask
import
Blueprint
,
request
,
render_template
,
flash
,
send_file
import
subprocess
import
numpy
as
np
import
torch
import
torch.nn
as
nn
import
torch.nn.functional
as
F
import
torch.optim
as
optim
import
torch.utils.data
as
data_utils
import
torchvision
import
torchvision.datasets
as
datasets
from
matplotlib
import
pyplot
as
plt
from
numpy
import
save
,
load
from
tqdm
import
trange
torch
.
manual_seed
(
0
)
# import agents and its functions
from
MetaAugment
import
UCB1_JC
bp
=
Blueprint
(
"
progress
"
,
__name__
)
@bp.route
(
"
/user_input
"
,
methods
=
[
"
GET
"
,
"
POST
"
])
def
response
():
# hyperparameters to change
batch_size
=
32
# size of batch the inner NN is trained with
learning_rate
=
1e-1
# fix learning rate
ds
=
request
.
args
[
"
dataset_selection
"
]
# pick dataset (MNIST, KMNIST, FashionMNIST, CIFAR10, CIFAR100)
toy_size
=
0.02
# total propeortion of training and test set we use
max_epochs
=
100
# max number of epochs that is run if early stopping is not hit
early_stop_num
=
10
# max number of worse validation scores before early stopping is triggered
num_policies
=
5
# fix number of policies
num_sub_policies
=
5
# fix number of sub-policies in a policy
iterations
=
100
# total iterations, should be more than the number of policies
IsLeNet
=
request
.
args
[
"
network_selection
"
]
# using LeNet or EasyNet or SimpleNet ->> default
print
(
f
'
@@@@@ dataset is:
{
ds
}
, network is :
{
IsLeNet
}
'
)
# generate random policies at start
policies
=
UCB1_JC
.
generate_policies
(
num_policies
,
num_sub_policies
)
q_values
,
best_q_values
=
UCB1_JC
.
run_UCB1
(
policies
,
batch_size
,
learning_rate
,
ds
,
toy_size
,
max_epochs
,
early_stop_num
,
iterations
,
IsLeNet
)
plt
.
plot
(
best_q_values
)
best_q_values
=
np
.
array
(
best_q_values
)
save
(
'
best_q_values_{}_{}percent_{}.npy
'
.
format
(
IsLeNet
,
int
(
toy_size
*
100
),
ds
),
best_q_values
)
#best_q_values = load('best_q_values_{}_{}percent_{}.npy'.format(IsLeNet, int(toy_size*100), ds), allow_pickle=True)
return
render_template
(
"
progress.html
"
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
auto_augmentation/templates/home.html
+
20
−
12
View file @
86e0fc89
...
...
@@ -12,16 +12,24 @@
<!-- dataset radio button -->
Or you can select a dataset from our database:
<br>
<input
type=
"radio"
id=
"dataset1"
name=
"dataset_selection"
value=
"M
I
NIST"
>
<label
for=
"dataset1"
>
M
I
NIST dataset
</label><br>
name=
"dataset_selection"
value=
"MNIST"
>
<label
for=
"dataset1"
>
MNIST dataset
</label><br>
<input
type=
"radio"
id=
"dataset2"
name=
"dataset_selection"
value=
"
IMGNE
T"
>
<label
for=
"dataset2"
>
IMGNE
T dataset
</label><br>
name=
"dataset_selection"
value=
"
KMNIS
T"
>
<label
for=
"dataset2"
>
KMNIS
T dataset
</label><br>
<input
type=
"radio"
id=
"dataset3"
name=
"dataset_selection"
value=
"dataset3"
>
<label
for=
"dataset3"
>
dataset3
</label><br><br>
name=
"dataset_selection"
value=
"FashionMNIST"
>
<label
for=
"dataset3"
>
FashionMNIST dataset
</label><br>
<input
type=
"radio"
id=
"dataset4"
name=
"dataset_selection"
value=
"CIFAR10"
>
<label
for=
"dataset4"
>
CIFAR10 dataset
</label><br>
<input
type=
"radio"
id=
"dataset5"
name=
"dataset_selection"
value=
"CIFAR100"
>
<label
for=
"dataset5"
>
CIFAR100 dataset
</label><br><br>
<!-- --------------------------------------------------------------- -->
...
...
@@ -35,16 +43,16 @@
<!-- network selection -->
Or you can select a dataset from our database:
<br>
<input
type=
"radio"
id=
"network1"
name=
"network_selection"
value=
"
Easy
Net"
>
<label
for=
"
dataset1"
>
Easy
Net
</label><br>
name=
"network_selection"
value=
"
Le
Net"
>
<label
for=
"
network1"
>
Le
Net
</label><br>
<input
type=
"radio"
id=
"network2"
name=
"network_selection"
value=
"
Le
Net"
>
<label
for=
"
dataset2"
>
Le
Net
</label><br>
name=
"network_selection"
value=
"
Easy
Net"
>
<label
for=
"
network2"
>
Easy
Net
</label><br>
<input
type=
"radio"
id=
"network3"
name=
"network_selection"
value=
"
A
le
x
Net"
>
<label
for=
"
dataset3"
>
A
le
x
Net
</label><br><br>
name=
"network_selection"
value=
"
Simp
leNet"
>
<label
for=
"
network3"
>
Simp
leNet
</label><br><br>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment