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
99b95166
Commit
99b95166
authored
2 years ago
by
kulcsar
Browse files
Options
Downloads
Patches
Plain Diff
main update
parent
41cf3ed2
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Code/main.py
+7
-2
7 additions, 2 deletions
Code/main.py
Code/train.py
+1
-0
1 addition, 0 deletions
Code/train.py
with
8 additions
and
2 deletions
Code/main.py
+
7
−
2
View file @
99b95166
...
...
@@ -9,12 +9,14 @@ from typing import List
def
run
(
raw_args
):
print
(
"
parsing
"
)
args
=
_parse_args
(
raw_args
)
print
(
"
parsed arguments
"
)
#load test and train dataset as well as tokenizers and models...
#Datasets
print
(
"
opened datasets...
"
)
with
open
(
args
.
train_dataset
)
as
f
:
data_train
=
json
.
loads
(
f
.
read
())
...
...
@@ -23,6 +25,7 @@ def run(raw_args):
#Tokenizers & Models
print
(
"
Loading tokenizers and initializing model...
"
)
tokenizer
=
AutoTokenizer
.
from_pretrained
(
args
.
architecture
)
models
.
set_seed
(
args
.
random_seed
)
...
...
@@ -40,6 +43,7 @@ def run(raw_args):
#preprocess...
print
(
"
preprocessing datasets...
"
)
if
args
.
tokenizer
==
"
salami
"
:
train_dataset
=
preprocess
.
salami_tokenizer
(
tokenizer
,
data_train
,
args
.
max_length
,
masked
=
args
.
masking
)
#no context implemented
test_dataset
=
preprocess
.
salami_tokenizer
(
tokenizer
,
data_test
,
args
.
max_length
,
masked
=
args
.
masking
)
...
...
@@ -55,6 +59,7 @@ def run(raw_args):
print
(
"
non eligible tokenizer selected
"
)
#train...
print
(
"
training..
"
)
if
args
.
train_loop
==
"
swp
"
:
evaluation_test
,
evaluation_train
=
train
.
train
(
model
,
args
.
random_seed
,
train_dataset
,
test_dataset
,
args
.
epochs
,
args
.
learning_rate
,
args
.
batch_size
,
args
.
test_batch_size
)
elif
args
.
train_loop
==
"
salami
"
:
...
...
@@ -144,5 +149,5 @@ def _parse_args(raw_args: List[str]) -> argparse.Namespace:
type
=
int
,
default
=
64
)
return
parser
.
parse_args
(
raw_args
)
This diff is collapsed.
Click to expand it.
Code/train.py
+
1
−
0
View file @
99b95166
...
...
@@ -2,6 +2,7 @@ import torch
import
tqdm
import
numpy
as
np
import
evaluation
import
evaluate
import
json
import
random
import
math
...
...
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