Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
combo
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Redmine
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Syntactic Tools
combo
Commits
a28a2670
Commit
a28a2670
authored
Oct 10, 2023
by
Maja Jablonska
Browse files
Options
Downloads
Patches
Plain Diff
Remove weights path from parameters
parent
53dd3bd7
No related branches found
No related tags found
1 merge request
!46
Merge COMBO 3.0 into master
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
combo/main.py
+1
-1
1 addition, 1 deletion
combo/main.py
combo/modules/model.py
+0
-20
0 additions, 20 deletions
combo/modules/model.py
with
1 addition
and
21 deletions
combo/main.py
+
1
−
1
View file @
a28a2670
...
...
@@ -12,7 +12,7 @@ from combo.predictors import Predictor
from
combo.training.trainable_combo
import
TrainableCombo
from
combo.utils
import
checks
from
config
import
Registry
,
resolve
from
config
import
resolve
from
models
import
ComboModel
from
predict
import
COMBO
...
...
This diff is collapsed.
Click to expand it.
combo/modules/model.py
+
0
−
20
View file @
a28a2670
...
...
@@ -478,26 +478,6 @@ class Model(Module, FromParameters):
model
.
extend_embedder_vocab
()
return
model
@classmethod
@overrides
def
from_parameters
(
cls
,
parameters
:
Dict
[
str
,
Any
]
=
None
,
constructor_method_name
:
str
=
None
,
pass_down_parameters
:
Dict
[
str
,
Any
]
=
None
):
constructed_model
=
super
().
from_parameters
(
parameters
)
constructed_model
.
load_state_dict
(
torch
.
load
(
parameters
[
'
weights
'
]))
return
constructed_model
@overrides
def
serialize
(
self
,
pass_down_parameter_names
:
List
[
str
]
=
None
)
->
Dict
[
str
,
Any
]:
vocabulary_dir
=
os
.
path
.
join
(
self
.
serialization_dir
,
'
vocabulary
'
)
self
.
vocab
.
_serialization_dir
=
vocabulary_dir
weights_path
=
os
.
path
.
join
(
self
.
serialization_dir
,
'
weights.pth
'
)
torch
.
save
(
self
.
state_dict
(),
weights_path
)
serialized_model
=
super
().
serialize
()
serialized_model
[
'
parameters
'
][
'
weights
'
]
=
weights_path
return
serialized_model
def
remove_weights_related_keys_from_params
(
params
:
Params
,
keys
:
List
[
str
]
=
[
"
pretrained_file
"
,
"
initializer
"
]
...
...
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