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
5a130063
Commit
5a130063
authored
2 years ago
by
friebolin
Browse files
Options
Downloads
Patches
Plain Diff
Update imports
parent
375d90b0
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/train.py
+1
-0
1 addition, 0 deletions
Code/train.py
inference.py
+7
-6
7 additions, 6 deletions
inference.py
with
8 additions
and
6 deletions
Code/train.py
+
1
−
0
View file @
5a130063
...
...
@@ -17,6 +17,7 @@ import os
import
pandas
as
pd
import
sklearn
device
=
torch
.
device
(
'
cuda
'
if
torch
.
cuda
.
is_available
()
else
'
cpu
'
)
metric
=
evaluate
.
load
(
"
accuracy
"
)
torch
.
cuda
.
empty_cache
()
...
...
This diff is collapsed.
Click to expand it.
inference.py
+
7
−
6
View file @
5a130063
"""
Demo for inference: User enters a sentence and our trained BERT model predicts if the target word is literal or non-literal
"""
import
sys
sys
.
path
.
insert
(
0
,
'
Code/
'
)
from
Code.preprocess
import
*
from
Code.models
import
*
from
Code.train
import
*
#import preprocess
#import models
#import train
# from Code.preprocess import *
# from Code.models import *
# from Code.train import *
import
Code.preprocess
import
Code.models
import
Code.train
import
json
import
torch
from
transformers
import
BertTokenizer
,
BertModel
,
BertConfig
,
BertPreTrainedModel
,
PreTrainedModel
,
AutoConfig
,
AutoModel
,
AutoTokenizer
...
...
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