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
f10db470
Commit
f10db470
authored
3 years ago
by
Caroline DE POURTALES
Browse files
Options
Downloads
Patches
Plain Diff
concatenation works
parent
92f65c05
No related branches found
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
Configuration/config.ini
+1
-1
1 addition, 1 deletion
Configuration/config.ini
Linker/Linker.py
+2
-1
2 additions, 1 deletion
Linker/Linker.py
main.py
+0
-23
0 additions, 23 deletions
main.py
with
3 additions
and
25 deletions
Configuration/config.ini
+
1
−
1
View file @
f10db470
...
...
@@ -3,7 +3,7 @@ transformers = 4.16.2
[DATASET_PARAMS]
symbols_vocab_size
=
26
max_len_sentence
=
2
66
max_len_sentence
=
2
90
max_atoms_in_sentence
=
1250
max_atoms_in_one_type
=
510
...
...
This diff is collapsed.
Click to expand it.
Linker/Linker.py
+
2
−
1
View file @
f10db470
...
...
@@ -66,6 +66,7 @@ class Linker(Module):
supertagger
=
SuperTagger
()
supertagger
.
load_weights
(
supertagger_path_model
)
self
.
Supertagger
=
supertagger
self
.
Supertagger
.
model
.
to
(
self
.
device
)
self
.
atom_map
=
atom_map
self
.
sub_atoms_type_list
=
list
(
atom_map_redux
.
keys
())
...
...
@@ -103,7 +104,7 @@ class Linker(Module):
the training dataloader and the validation dataloader. They contains the list of atoms, their polarities, the axiom links, the sentences tokenized, sentence mask
"""
print
(
"
Start preprocess Data
"
)
sentences_batch
=
df_axiom_links
[
"
X
"
].
tolist
()
sentences_batch
=
df_axiom_links
[
"
X
"
].
str
.
strip
().
tolist
()
sentences_tokens
,
sentences_mask
=
self
.
Supertagger
.
sent_tokenizer
.
fit_transform_tensors
(
sentences_batch
)
atoms_batch
,
atoms_polarity_batch
=
get_GOAL
(
self
.
max_atoms_in_sentence
,
df_axiom_links
[
"
Z
"
])
...
...
This diff is collapsed.
Click to expand it.
main.py
deleted
100644 → 0
+
0
−
23
View file @
92f65c05
import
torch.nn.functional
as
F
import
torch
from
Configuration
import
Configuration
from
Linker
import
*
from
Supertagger
import
*
max_atoms_in_sentence
=
int
(
Configuration
.
datasetConfig
[
'
max_atoms_in_sentence
'
])
# categories tagger
supertagger
=
SuperTagger
()
supertagger
.
load_weights
(
"
models/model_supertagger.pt
"
)
# axiom linker
linker
=
Linker
(
supertagger
)
linker
.
load_weights
(
"
models/linker.pt
"
)
# predict categories and links for this sentence
sentence
=
[
"
le chat est noir
"
]
sents_tokenized
,
sents_mask
=
supertagger
.
sent_tokenizer
.
fit_transform_tensors
(
sentence
)
logits
,
sentence_embedding
=
supertagger
.
foward
(
sents_tokenized
,
sents_mask
)
categories
=
torch
.
argmax
(
F
.
softmax
(
logits
,
dim
=
2
),
dim
=
2
)
axiom_links
=
linker
.
predict
(
categories
,
sentence_embedding
,
sents_mask
)
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