Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
declearn2
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
Container registry
Model registry
Operate
Terraform modules
Monitor
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
Admin message
GitLab upgrade completed. Current version is 17.11.3.
Show more breadcrumbs
Magnet
DecLearn
declearn2
Commits
29b30d48
Verified
Commit
29b30d48
authored
1 year ago
by
ANDREY Paul
Browse files
Options
Downloads
Patches
Plain Diff
Use a (complex) scheduler in 'test_main.py'.
parent
521affb4
No related branches found
No related tags found
1 merge request
!66
Add a Scheduler API to enable time-based learning rate (and weight decay) adjustements
Pipeline
#982202
passed
1 year ago
Stage: clean
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/functional/test_main.py
+12
-2
12 additions, 2 deletions
test/functional/test_main.py
with
12 additions
and
2 deletions
test/functional/test_main.py
+
12
−
2
View file @
29b30d48
...
...
@@ -106,7 +106,12 @@ class DeclearnTestCase:
"""
Return a TensorflowModel suitable for the learning task.
"""
if
self
.
kind
==
"
Reg
"
:
output_layer
=
tf_keras
.
layers
.
Dense
(
1
)
loss
=
"
mse
"
if
hasattr
(
tf_keras
,
"
version
"
)
and
tf_keras
.
version
().
startswith
(
"
3
"
):
loss
=
"
MeanSquaredError
"
else
:
loss
=
"
mse
"
elif
self
.
kind
==
"
Bin
"
:
output_layer
=
tf_keras
.
layers
.
Dense
(
1
,
activation
=
"
sigmoid
"
)
loss
=
"
binary_crossentropy
"
...
...
@@ -204,14 +209,19 @@ class DeclearnTestCase:
"""
Return parameters to instantiate a FLOptimConfig.
"""
client_modules
=
[]
server_modules
=
[]
# Optionally use Scaffold and/or sever-side momentum.
if
self
.
strategy
==
"
Scaffold
"
:
client_modules
.
append
(
"
scaffold-client
"
)
server_modules
.
append
(
"
scaffold-server
"
)
if
self
.
strategy
in
(
"
FedAvgM
"
,
"
ScaffoldM
"
):
server_modules
.
append
(
"
momentum
"
)
# Use a warmup over 100 steps followed by exponential decay.
exp_decay
=
(
"
exponential-decay
"
,
{
"
base
"
:
0.01
,
"
rate
"
:
0.8
})
cli_lrate
=
(
"
warmup
"
,
{
"
base
"
:
exp_decay
,
"
warmup
"
:
10
})
# Return the federated optimization configuration.
return
{
"
aggregator
"
:
"
averaging
"
,
"
client_opt
"
:
{
"
lrate
"
:
0.01
,
"
modules
"
:
client_modules
},
"
client_opt
"
:
{
"
lrate
"
:
cli_lrate
,
"
modules
"
:
client_modules
},
"
server_opt
"
:
{
"
lrate
"
:
1.0
,
"
modules
"
:
server_modules
},
}
...
...
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