Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Data Augmentation for Metonymy Resolution
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
friebolin
Data Augmentation for Metonymy Resolution
Commits
5b247a47
Commit
5b247a47
authored
1 year ago
by
umlauf
Browse files
Options
Downloads
Patches
Plain Diff
change value_r CEL
parent
e16fa7bc
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Code/train.py
+1
-2
1 addition, 2 deletions
Code/train.py
with
1 addition
and
2 deletions
Code/train.py
+
1
−
2
View file @
5b247a47
...
@@ -165,8 +165,7 @@ def cross_entropy(logits, target):
...
@@ -165,8 +165,7 @@ def cross_entropy(logits, target):
#calculation with indexing (- 1-label * )
#calculation with indexing (- 1-label * )
results
=
torch
.
cat
((
loss_clear_labels
.
view
(
1
),
results
),
dim
=
0
)
results
=
torch
.
cat
((
loss_clear_labels
.
view
(
1
),
results
),
dim
=
0
)
else
:
else
:
value_r
=
round
(
value
,
1
)
#to make it equal to lambda_value e.g. 0.4
mixed_vec
=
torch
.
tensor
([
value
,
1
-
value
])
#creating on-hot mixed vec.
mixed_vec
=
torch
.
tensor
([
value_r
,
1
-
value_r
])
#creating on-hot mixed vec.
logprobs
=
torch
.
nn
.
functional
.
log_softmax
(
lg
,
dim
=
1
)
#logits in log probabilities
logprobs
=
torch
.
nn
.
functional
.
log_softmax
(
lg
,
dim
=
1
)
#logits in log probabilities
loss_mixed_labels
=
-
((
mixed_vec
[
0
]
*
logprobs
[
0
][
0
])
+
(
mixed_vec
[
1
]
*
logprobs
[
0
][
1
]))
loss_mixed_labels
=
-
((
mixed_vec
[
0
]
*
logprobs
[
0
][
0
])
+
(
mixed_vec
[
1
]
*
logprobs
[
0
][
1
]))
#calculation for mixed with indexing
#calculation for mixed with indexing
...
...
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