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
620ddf58
Commit
620ddf58
authored
2 years ago
by
Sun Jin Kim
Browse files
Options
Downloads
Patches
Plain Diff
update /test
parent
f007b3f3
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
pytest.ini
+5
-0
5 additions, 0 deletions
pytest.ini
test/MetaAugment/test_gru_learner.py
+2
-1
2 additions, 1 deletion
test/MetaAugment/test_gru_learner.py
test/MetaAugment/test_main.py
+65
-0
65 additions, 0 deletions
test/MetaAugment/test_main.py
with
72 additions
and
1 deletion
pytest.ini
0 → 100644
+
5
−
0
View file @
620ddf58
[pytest]
filterwarnings
=
error
ignore::UserWarning
ignore:function
ham\(\)
is
deprecated:DeprecationWarning
\ No newline at end of file
This diff is collapsed.
Click to expand it.
test/MetaAugment/test_gru_learner.py
+
2
−
1
View file @
620ddf58
...
@@ -22,7 +22,8 @@ def test_generate_new_policy():
...
@@ -22,7 +22,8 @@ def test_generate_new_policy():
sp_num
=
sp_num
,
sp_num
=
sp_num
,
fun_num
=
fun_num
,
fun_num
=
fun_num
,
p_bins
=
p_bins
,
p_bins
=
p_bins
,
m_bins
=
m_bins
m_bins
=
m_bins
,
cont_mb_size
=
2
)
)
for
_
in
range
(
4
):
for
_
in
range
(
4
):
new_policy
=
agent
.
generate_new_policy
()
new_policy
=
agent
.
generate_new_policy
()
...
...
This diff is collapsed.
Click to expand it.
test/MetaAugment/test_main.py
0 → 100644
+
65
−
0
View file @
620ddf58
import
torch
import
torchvision
import
torchvision.datasets
as
datasets
import
MetaAugment.autoaugment_learners
as
aal
import
MetaAugment.child_networks
as
cn
import
MetaAugment.main
as
main
def
test_create_toy
():
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
())
for
_
in
range
(
20
):
train_loader
,
test_loader
=
main
.
create_toy
(
train_dataset
,
test_dataset
,
batch_size
=
32
,
n_samples
=
1
)
p
=
torch
.
rand_like
(
torch
.
tensor
([.
0
]))
train_loader
,
test_loader
=
main
.
create_toy
(
train_dataset
,
test_dataset
,
batch_size
=
32
,
n_samples
=
p
)
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
())
for
_
in
range
(
20
):
train_loader
,
test_loader
=
main
.
create_toy
(
train_dataset
,
test_dataset
,
batch_size
=
32
,
n_samples
=
1
)
p
=
torch
.
rand_like
(
torch
.
tensor
([.
0
]))
train_loader
,
test_loader
=
main
.
create_toy
(
train_dataset
,
test_dataset
,
batch_size
=
32
,
n_samples
=
p
)
def
test_train_cn
():
train_dataset
=
datasets
.
FashionMNIST
(
root
=
'
./datasets/fashionmnist/train
'
,
train
=
True
,
download
=
True
,
transform
=
torchvision
.
transforms
.
ToTensor
())
test_dataset
=
datasets
.
FashionMNIST
(
root
=
'
./datasets/fashionmnist/test
'
,
train
=
False
,
download
=
True
,
transform
=
torchvision
.
transforms
.
ToTensor
())
cn_architecture
=
cn
.
Bad_LeNet
model
=
cn_architecture
()
train_loader
,
test_loader
=
main
.
create_toy
(
train_dataset
,
test_dataset
,
batch_size
=
32
,
n_samples
=
0.01
)
main
.
train_child_network
(
model
,
train_loader
,
test_loader
,
sgd
=
torch
.
optim
.
SGD
(
model
.
parameters
(),
lr
=
0.1
),
cost
=
torch
.
nn
.
CrossEntropyLoss
(),
early_stop_flag
=
True
)
main
.
train_child_network
(
model
,
train_loader
,
test_loader
,
sgd
=
torch
.
optim
.
SGD
(
model
.
parameters
(),
lr
=
0.1
),
cost
=
torch
.
nn
.
CrossEntropyLoss
(),
early_stop_flag
=
False
)
\ No newline at end of file
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