Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
combo
Manage
Activity
Members
Labels
Plan
Issues
20
Issue boards
Milestones
Wiki
Redmine
Code
Merge requests
2
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Syntactic Tools
combo
Commits
3c877323
Commit
3c877323
authored
1 year ago
by
Maja Jablonska
Browse files
Options
Downloads
Patches
Plain Diff
Add feedforward_from_vocab
parent
d616cd18
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!46
Merge COMBO 3.0 into master
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
combo/modules/feedforward_predictor.py
+6
-1
6 additions, 1 deletion
combo/modules/feedforward_predictor.py
with
6 additions
and
1 deletion
combo/modules/feedforward_predictor.py
+
6
−
1
View file @
3c877323
...
...
@@ -11,6 +11,7 @@ from combo.utils import ConfigurationError
@Registry.register
(
"
feedforward_predictor
"
)
@Registry.register
(
"
feedforward_predictor_from_vocab
"
,
constructor_method
=
"
from_vocab
"
)
class
FeedForwardPredictor
(
Predictor
):
"""
Feedforward predictor. Should be used on top of Seq2Seq encoder.
"""
...
...
@@ -56,6 +57,7 @@ class FeedForwardPredictor(Predictor):
return
loss
.
sum
()
/
valid_positions
@classmethod
@register_arguments
def
from_vocab
(
cls
,
vocabulary
:
Vocabulary
,
vocab_namespace
:
str
,
...
...
@@ -74,9 +76,12 @@ class FeedForwardPredictor(Predictor):
f
"
There is not
{
vocab_namespace
}
in created vocabs, check if this field has any values to predict!
"
hidden_dims
=
hidden_dims
+
[
vocabulary
.
get_vocab_size
(
vocab_namespace
)]
return
cls
(
FeedForward
(
ff_p
=
cls
(
FeedForward
(
input_dim
=
input_dim
,
num_layers
=
num_layers
,
hidden_dims
=
hidden_dims
,
activations
=
activations
,
dropout
=
dropout
))
ff_p
.
constructed_from
=
"
from_vocab
"
return
ff_p
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
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