Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Swarm Split Learning
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
INDA_ML
Swarm Split Learning
Commits
2c6dd633
Commit
2c6dd633
authored
9 months ago
by
Tim Tobias Bauerle
Browse files
Options
Downloads
Patches
Plain Diff
Call LR scheduler before training in case a device misses out a round
parent
d0c02fea
Branches
Branches containing commit
No related tags found
1 merge request
!22
Fix lr schedule
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
edml/core/client.py
+5
-6
5 additions, 6 deletions
edml/core/client.py
edml/core/server.py
+11
-10
11 additions, 10 deletions
edml/core/server.py
with
16 additions
and
16 deletions
edml/core/client.py
+
5
−
6
View file @
2c6dd633
...
...
@@ -258,6 +258,11 @@ class DeviceClient:
that, this approach does not require to deduce server batch processing time after a
"
traditional
"
measurement.
"""
if
self
.
_lr_scheduler
is
not
None
:
if
round_no
!=
-
1
:
self
.
_lr_scheduler
.
step
(
round_no
)
else
:
self
.
_lr_scheduler
.
step
()
client_train_start_time
=
time
.
time
()
server_train_batch_times
=
(
[]
...
...
@@ -295,12 +300,6 @@ class DeviceClient:
smashed_data
.
backward
(
server_grad
)
self
.
_optimizer
.
step
()
if
self
.
_lr_scheduler
is
not
None
:
if
round_no
!=
-
1
:
self
.
_lr_scheduler
.
step
(
round_no
)
else
:
self
.
_lr_scheduler
.
step
()
client_train_time
=
(
time
.
time
()
-
client_train_start_time
-
sum
(
server_train_batch_times
)
)
...
...
This diff is collapsed.
Click to expand it.
edml/core/server.py
+
11
−
10
View file @
2c6dd633
...
...
@@ -90,6 +90,11 @@ class DeviceServer:
if
optimizer_state
is
not
None
:
self
.
_optimizer
.
load_state_dict
(
optimizer_state
)
for
epoch
in
range
(
epochs
):
if
self
.
_lr_scheduler
is
not
None
:
if
round_no
!=
-
1
:
self
.
_lr_scheduler
.
step
(
round_no
+
epoch
)
else
:
self
.
_lr_scheduler
.
step
()
for
device_id
in
devices
:
print
(
f
"
Train epoch
{
epoch
}
on client
{
device_id
}
with server
{
self
.
node_device
.
device_id
}
"
...
...
@@ -120,11 +125,6 @@ class DeviceServer:
metrics
.
add_results
(
train_metrics
)
metrics
.
add_results
(
val_metrics
)
if
self
.
_lr_scheduler
is
not
None
:
if
round_no
!=
-
1
:
self
.
_lr_scheduler
.
step
(
round_no
+
epoch
)
else
:
self
.
_lr_scheduler
.
step
()
return
(
client_weights
,
self
.
get_weights
(),
...
...
@@ -241,6 +241,12 @@ class DeviceServer:
if
optimizer_state
is
not
None
:
self
.
_optimizer
.
load_state_dict
(
optimizer_state
)
if
self
.
_lr_scheduler
is
not
None
:
if
round_no
!=
-
1
:
self
.
_lr_scheduler
.
step
(
round_no
+
1
)
# epoch=1
else
:
self
.
_lr_scheduler
.
step
()
num_threads
=
len
(
clients
)
executor
=
create_executor_with_threads
(
num_threads
)
...
...
@@ -346,11 +352,6 @@ class DeviceServer:
model_metrics
.
add_results
(
val_metrics
)
optimizer_state
=
self
.
_optimizer
.
state_dict
()
if
self
.
_lr_scheduler
is
not
None
:
if
round_no
!=
-
1
:
self
.
_lr_scheduler
.
step
(
round_no
+
1
)
# epoch=1
else
:
self
.
_lr_scheduler
.
step
()
# delete references and free GPU memory manually
server_batch
=
None
server_labels
=
None
...
...
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