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
2e2525de
Commit
2e2525de
authored
3 years ago
by
Mateusz Klimaszewski
Browse files
Options
Downloads
Patches
Plain Diff
Enable weighted average of LM embeddings.
parent
1982161f
Branches
Branches containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
combo/config.graph.template.jsonnet
+2
-1
2 additions, 1 deletion
combo/config.graph.template.jsonnet
combo/models/embeddings.py
+2
-0
2 additions, 0 deletions
combo/models/embeddings.py
with
4 additions
and
1 deletion
combo/config.graph.template.jsonnet
+
2
−
1
View file @
2e2525de
...
@@ -49,7 +49,7 @@ local lemma_char_dim = 64;
...
@@ -49,7 +49,7 @@ local lemma_char_dim = 64;
# Character embedding dim, int
# Character embedding dim, int
local
char_dim
=
64
;
local
char_dim
=
64
;
# Word embedding projection dim, int
# Word embedding projection dim, int
local
projected_embedding_dim
=
100
;
local
projected_embedding_dim
=
768
;
# Loss weights, dict[str, int]
# Loss weights, dict[str, int]
local
loss_weights
=
{
local
loss_weights
=
{
xpostag
:
0.05
,
xpostag
:
0.05
,
...
@@ -202,6 +202,7 @@ assert pretrained_tokens == null || pretrained_transformer_name == null: "Can't
...
@@ -202,6 +202,7 @@ assert pretrained_tokens == null || pretrained_transformer_name == null: "Can't
},
},
token
:
if
use_transformer
then
{
token
:
if
use_transformer
then
{
type
:
"transformers_word_embeddings"
,
type
:
"transformers_word_embeddings"
,
last_layer_only
:
false
,
model_name
:
pretrained_transformer_name
,
model_name
:
pretrained_transformer_name
,
projection_dim
:
projected_embedding_dim
,
projection_dim
:
projected_embedding_dim
,
tokenizer_kwargs
:
if
std
.
startsWith
(
pretrained_transformer_name
,
"allegro/herbert"
)
tokenizer_kwargs
:
if
std
.
startsWith
(
pretrained_transformer_name
,
"allegro/herbert"
)
...
...
This diff is collapsed.
Click to expand it.
combo/models/embeddings.py
+
2
−
0
View file @
2e2525de
...
@@ -111,10 +111,12 @@ class TransformersWordEmbedder(token_embedders.PretrainedTransformerMismatchedEm
...
@@ -111,10 +111,12 @@ class TransformersWordEmbedder(token_embedders.PretrainedTransformerMismatchedEm
projection_activation
:
Optional
[
allen_nn
.
Activation
]
=
lambda
x
:
x
,
projection_activation
:
Optional
[
allen_nn
.
Activation
]
=
lambda
x
:
x
,
projection_dropout_rate
:
Optional
[
float
]
=
0.0
,
projection_dropout_rate
:
Optional
[
float
]
=
0.0
,
freeze_transformer
:
bool
=
True
,
freeze_transformer
:
bool
=
True
,
last_layer_only
:
bool
=
True
,
tokenizer_kwargs
:
Optional
[
Dict
[
str
,
Any
]]
=
None
,
tokenizer_kwargs
:
Optional
[
Dict
[
str
,
Any
]]
=
None
,
transformer_kwargs
:
Optional
[
Dict
[
str
,
Any
]]
=
None
):
transformer_kwargs
:
Optional
[
Dict
[
str
,
Any
]]
=
None
):
super
().
__init__
(
model_name
,
super
().
__init__
(
model_name
,
train_parameters
=
not
freeze_transformer
,
train_parameters
=
not
freeze_transformer
,
last_layer_only
=
last_layer_only
,
tokenizer_kwargs
=
tokenizer_kwargs
,
tokenizer_kwargs
=
tokenizer_kwargs
,
transformer_kwargs
=
transformer_kwargs
)
transformer_kwargs
=
transformer_kwargs
)
if
projection_dim
:
if
projection_dim
:
...
...
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