Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
FreeForestML
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CERN
fsauerbu
FreeForestML
Commits
590e33bb
Commit
590e33bb
authored
2 years ago
by
Ahmed Markhoos
Browse files
Options
Downloads
Patches
Plain Diff
path-token-fix
parent
0bd99ca6
Branches
44-data-content-interface
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!70
path-token-fix
Pipeline
#12724
failed
2 years ago
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
freeforestml/model.py
+23
-9
23 additions, 9 deletions
freeforestml/model.py
with
23 additions
and
9 deletions
freeforestml/model.py
+
23
−
9
View file @
590e33bb
...
...
@@ -727,14 +727,21 @@ class HepNet:
# save model architecture and weights (only if already trained)
if
len
(
self
.
models
)
==
self
.
cv
.
k
:
for
fold_i
in
range
(
self
.
cv
.
k
):
path_token
=
path
.
rsplit
(
"
.
"
,
1
)
path_token
=
path
.
rsplit
(
"
/
"
,
1
)
file_token
=
path_token
[
-
1
].
rsplit
(
"
.
"
,
1
)
if
len
(
file_token
)
==
1
:
file_token
.
append
(
f
"
fold_
{
fold_i
}
"
)
else
:
file_token
.
insert
(
-
1
,
f
"
fold_
{
fold_i
}
"
)
if
len
(
path_token
)
==
1
:
path_token
.
append
(
f
"
fold_
{
fold_i
}
"
)
path_token
=
[
"
.
"
.
join
(
file_token
)]
else
:
path_token
.
insert
(
-
1
,
f
"
fold_
{
fold_i
}
"
)
path_token
=
[
path_token
[
0
]]
+
[
"
.
"
.
join
(
file_token
)]
# this is the built-in save function from keras
self
.
models
[
fold_i
].
save
(
"
.
"
.
join
(
path_token
))
self
.
models
[
fold_i
].
save
(
"
/
"
.
join
(
path_token
))
with
h5py
.
File
(
path
,
"
w
"
)
as
output_file
:
# save default model class
...
...
@@ -790,13 +797,20 @@ class HepNet:
# load trained models (if existing)
with
h5py
.
File
(
path
,
"
r
"
)
as
input_file
:
for
fold_i
in
range
(
cv
.
k
):
path_token
=
path
.
rsplit
(
"
.
"
,
1
)
path_token
=
path
.
rsplit
(
"
/
"
,
1
)
file_token
=
path_token
[
-
1
].
rsplit
(
"
.
"
,
1
)
if
len
(
file_token
)
==
1
:
file_token
.
append
(
f
"
fold_
{
fold_i
}
"
)
else
:
file_token
.
insert
(
-
1
,
f
"
fold_
{
fold_i
}
"
)
if
len
(
path_token
)
==
1
:
path_token
.
append
(
f
"
fold_
{
fold_i
}
"
)
path_token
=
[
"
.
"
.
join
(
file_token
)]
else
:
path_token
.
insert
(
-
1
,
f
"
fold_
{
fold_i
}
"
)
path_token
=
[
path_token
[
0
]]
+
[
"
.
"
.
join
(
file_token
)]
model
=
tensorflow
.
keras
.
models
.
load_model
(
"
.
"
.
join
(
path_token
))
model
=
tensorflow
.
keras
.
models
.
load_model
(
"
/
"
.
join
(
path_token
))
instance
.
models
.
append
(
model
)
# load normalizer
...
...
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