Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DeepGrail Linker
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
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
PNRIA
Global Helper
DeepGrail Linker
Commits
d7a164e5
Commit
d7a164e5
authored
3 years ago
by
Julien Rabault
Browse files
Options
Downloads
Patches
Plain Diff
remove bug
parent
a76e9380
Branches
Branches containing commit
No related tags found
2 merge requests
!6
Linker with transformer
,
!5
Linker with transformer
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitignore
+1
-0
1 addition, 0 deletions
.gitignore
Linker/Linker.py
+2
-2
2 additions, 2 deletions
Linker/Linker.py
train.py
+2
-7
2 additions, 7 deletions
train.py
with
5 additions
and
9 deletions
.gitignore
+
1
−
0
View file @
d7a164e5
...
...
@@ -6,3 +6,4 @@ Utils/gold
Linker/__pycache__
Configuration/__pycache__
__pycache__
TensorBoard
This diff is collapsed.
Click to expand it.
Linker/Linker.py
+
2
−
2
View file @
d7a164e5
...
...
@@ -81,7 +81,7 @@ class Linker(Module):
self
.
device
=
torch
.
device
(
"
cuda
"
if
torch
.
cuda
.
is_available
()
else
"
cpu
"
)
def
__preprocess_data
(
self
,
batch_size
,
df_axiom_links
,
validation_rate
=
0.
0
):
def
__preprocess_data
(
self
,
batch_size
,
df_axiom_links
,
validation_rate
=
0.
1
):
r
"""
Args:
batch_size : int
...
...
@@ -106,7 +106,7 @@ class Linker(Module):
dataset
=
TensorDataset
(
atoms_batch_tokenized
,
atoms_polarity_batch
,
truth_links_batch
,
sentences_tokens
,
sentences_mask
)
if
validation_rate
>
0
:
if
validation_rate
>
0.
0
:
train_size
=
int
(
0.9
*
len
(
dataset
))
val_size
=
len
(
dataset
)
-
train_size
train_dataset
,
val_dataset
=
random_split
(
dataset
,
[
train_size
,
val_size
])
...
...
This diff is collapsed.
Click to expand it.
train.py
+
2
−
7
View file @
d7a164e5
...
...
@@ -6,12 +6,9 @@ from utils import read_csv_pgbar
torch
.
cuda
.
empty_cache
()
batch_size
=
int
(
Configuration
.
modelTrainingConfig
[
'
batch_size
'
])
nb_sentences
=
batch_size
*
2
0
nb_sentences
=
batch_size
*
40
0
epochs
=
int
(
Configuration
.
modelTrainingConfig
[
'
epoch
'
])
file_path_axiom_links
=
'
Datasets/goldANDsilver_dataset_links.csv
'
nb_sentences
=
batch_size
*
20
epochs
=
int
(
Configuration
.
modelTrainingConfig
[
'
epoch
'
])
file_path_axiom_links
=
'
Datasets/gold_dataset_links.csv
'
df_axiom_links
=
read_csv_pgbar
(
file_path_axiom_links
,
nb_sentences
)
...
...
@@ -21,10 +18,8 @@ supertagger = SuperTagger()
supertagger
.
load_weights
(
"
models/flaubert_super_98%_V2_50e.pt
"
)
sents_tokenized
,
sents_mask
=
supertagger
.
sent_tokenizer
.
fit_transform_tensors
(
sentences_batch
)
print
(
"
Linker
"
)
linker
=
Linker
(
supertagger
)
linker
=
linker
.
to
(
torch
.
device
(
"
cuda
"
if
torch
.
cuda
.
is_available
()
else
"
cpu
"
))
print
(
"
Linker Training
"
)
linker
.
train_linker
(
df_axiom_links
,
sents_tokenized
,
sents_mask
,
validation_rate
=
0.1
,
epochs
=
epochs
,
batch_size
=
batch_size
,
checkpoint
=
False
,
validate
=
True
)
linker
.
train_linker
(
df_axiom_links
,
batch_size
=
batch_size
,
checkpoint
=
False
,
tensorboard
=
True
)
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