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
bde85811
Commit
bde85811
authored
10 months ago
by
Tim Tobias Bauerle
Browse files
Options
Downloads
Patches
Plain Diff
Fixed loading serialized model
parent
b23927ad
Branches
Branches containing commit
No related tags found
2 merge requests
!18
Merge in main
,
!14
Experiment configs
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
edml/models/provider/path.py
+4
-0
4 additions, 0 deletions
edml/models/provider/path.py
edml/tests/core/start_device_test.py
+66
-0
66 additions, 0 deletions
edml/tests/core/start_device_test.py
with
70 additions
and
0 deletions
edml/models/provider/path.py
+
4
−
0
View file @
bde85811
...
...
@@ -6,3 +6,7 @@ class SerializedModel(nn.Module):
def
__init__
(
self
,
model
:
nn
.
Module
,
path
:
str
):
super
().
__init__
()
model
.
load_state_dict
(
torch
.
load
(
path
))
self
.
model
=
model
def
forward
(
self
,
x
):
return
self
.
model
(
x
)
This diff is collapsed.
Click to expand it.
edml/tests/core/start_device_test.py
0 → 100644
+
66
−
0
View file @
bde85811
import
os
import
unittest
import
torch
from
omegaconf
import
OmegaConf
from
edml.core.start_device
import
_get_models
from
edml.helpers.model_splitting
import
Part
from
edml.models.autoencoder
import
ClientWithAutoencoder
,
ServerWithAutoencoder
class
GetModelsTest
(
unittest
.
TestCase
):
def
setUp
(
self
):
os
.
chdir
(
"
../../../
"
)
self
.
cfg
=
OmegaConf
.
create
({
"
some_key
"
:
"
some_value
"
})
self
.
cfg
.
seed
=
OmegaConf
.
load
(
os
.
path
.
join
(
os
.
getcwd
(),
"
edml/config/seed/default.yaml
"
,
)
)
def
_get_model_from_model_provider_config
(
self
,
config_name
):
self
.
cfg
.
model_provider
=
OmegaConf
.
load
(
os
.
path
.
join
(
os
.
getcwd
(),
f
"
edml/config/model_provider/
{
config_name
}
.yaml
"
,
)
)
return
_get_models
(
self
.
cfg
)
def
test_load_resnet20
(
self
):
client
,
server
=
self
.
_get_model_from_model_provider_config
(
"
resnet20
"
)
self
.
assertIsInstance
(
client
,
Part
)
self
.
assertIsInstance
(
server
,
Part
)
self
.
assertEqual
(
len
(
client
.
layers
),
4
)
self
.
assertEqual
(
len
(
server
.
layers
),
5
)
self
.
assertEqual
(
server
(
client
(
torch
.
zeros
(
1
,
3
,
32
,
32
))).
shape
,
(
1
,
100
))
def
test_load_resnet20_with_ae
(
self
):
client
,
server
=
self
.
_get_model_from_model_provider_config
(
"
resnet20-with-autoencoder
"
)
self
.
assertIsInstance
(
client
,
ClientWithAutoencoder
)
self
.
assertIsInstance
(
server
,
ServerWithAutoencoder
)
self
.
assertEqual
(
len
(
client
.
model
.
layers
),
4
)
self
.
assertEqual
(
len
(
server
.
model
.
layers
),
5
)
self
.
assertEqual
(
server
(
client
(
torch
.
zeros
(
1
,
3
,
32
,
32
))).
shape
,
(
1
,
100
))
def
test_load_resnet110
(
self
):
client
,
server
=
self
.
_get_model_from_model_provider_config
(
"
resnet110
"
)
self
.
assertIsInstance
(
client
,
Part
)
self
.
assertIsInstance
(
server
,
Part
)
self
.
assertEqual
(
len
(
client
.
layers
),
4
)
self
.
assertEqual
(
len
(
server
.
layers
),
5
)
self
.
assertEqual
(
server
(
client
(
torch
.
zeros
(
1
,
3
,
32
,
32
))).
shape
,
(
1
,
100
))
def
test_load_resnet110_with_ae
(
self
):
client
,
server
=
self
.
_get_model_from_model_provider_config
(
"
resnet110-with-autoencoder
"
)
self
.
assertIsInstance
(
client
,
ClientWithAutoencoder
)
self
.
assertIsInstance
(
server
,
ServerWithAutoencoder
)
self
.
assertEqual
(
len
(
client
.
model
.
layers
),
4
)
self
.
assertEqual
(
len
(
server
.
model
.
layers
),
5
)
self
.
assertEqual
(
server
(
client
(
torch
.
zeros
(
1
,
3
,
32
,
32
))).
shape
,
(
1
,
100
))
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