Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DeepGrail Tagger-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 Tagger-Linker
Commits
3f41f1f0
Commit
3f41f1f0
authored
2 years ago
by
Caroline de Pourtalès
Browse files
Options
Downloads
Patches
Plain Diff
drawing link predictions
parent
0d01158b
No related branches found
No related tags found
1 merge request
!3
Prepare paper
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
predict_links.py
+17
-21
17 additions, 21 deletions
predict_links.py
with
17 additions
and
21 deletions
predict_links.py
+
17
−
21
View file @
3f41f1f0
from
NeuralProofNet.NeuralProofNet
import
NeuralProofNet
from
NeuralProofNet.NeuralProofNet
import
NeuralProofNet
from
postprocessing
import
draw_sentence_output
from
postprocessing
import
draw_sentence_output
# region data
if
__name__
==
'
__main__
'
:
a_s
=
[
"
( 1 ) parmi les huit
\"
partants
\"
acquis ou potentiels , MM. Lacombe , Koehler et Laroze ne sont pas membres du PCF .
"
]
# region data
tags_s
=
[
'
let
'
,
'
dr(0,s,s)
'
,
'
let
'
,
'
dr(0,dr(0,s,s),np)
'
,
'
dr(0,np,n)
'
,
'
dr(0,n,n)
'
,
'
let
'
,
'
n
'
,
'
let
'
,
'
dl(0,n,n)
'
,
a_s
=
[
"
( 1 ) parmi les huit
\"
partants
\"
acquis ou potentiels , MM. Lacombe , Koehler et Laroze ne sont pas membres du PCF .
"
]
'
dr(0,dl(0,dl(0,n,n),dl(0,n,n)),dl(0,n,n))
'
,
'
dl(0,n,n)
'
,
'
let
'
,
'
dr(0,np,np)
'
,
'
np
'
,
'
dr(0,dl(0,np,np),np)
'
,
tags_s
=
[
'
let
'
,
'
dr(0,s,s)
'
,
'
let
'
,
'
dr(0,dr(0,s,s),np)
'
,
'
dr(0,np,n)
'
,
'
dr(0,n,n)
'
,
'
let
'
,
'
n
'
,
'
let
'
,
'
dl(0,n,n)
'
,
'
np
'
,
'
dr(0,dl(0,np,np),np)
'
,
'
np
'
,
'
dr(0,dl(0,np,s),dl(0,np,s))
'
,
'
dr(0,dl(0,np,s),np)
'
,
'
dl(1,s,s)
'
,
'
np
'
,
'
dr(0,dl(0,dl(0,n,n),dl(0,n,n)),dl(0,n,n))
'
,
'
dl(0,n,n)
'
,
'
let
'
,
'
dr(0,np,np)
'
,
'
np
'
,
'
dr(0,dl(0,np,np),np)
'
,
'
dr(0,dl(0,np,np),n)
'
,
'
n
'
,
'
dl(0,s,txt)
'
]
'
np
'
,
'
dr(0,dl(0,np,np),np)
'
,
'
np
'
,
'
dr(0,dl(0,np,s),dl(0,np,s))
'
,
'
dr(0,dl(0,np,s),np)
'
,
'
dl(1,s,s)
'
,
'
np
'
,
# endregion
'
dr(0,dl(0,np,np),n)
'
,
'
n
'
,
'
dl(0,s,txt)
'
]
# endregion
# region model
model_tagger
=
"
models/flaubert_super_98_V2_50e.pt
"
neuralproofnet
=
NeuralProofNet
(
model_tagger
)
model
=
"
Output/linker.pt
"
neuralproofnet
.
linker
.
load_weights
(
model
)
# endregion
# region prediction
# region model
linker
=
neuralproofnet
.
linker
model_tagger
=
"
models/flaubert_super_98_V2_50e.pt
"
categories
,
links
=
linker
.
predict_without_categories
(
a_s
)
neuralproofnet
=
NeuralProofNet
(
model_tagger
)
#links = linker.predict_with_categories(a_s, tags_s)
model
=
"
Output/linker.pt
"
# endregion
neuralproofnet
.
linker
.
load_weights
(
model
)
# endregion
if
__name__
==
'
__main__
'
:
linker
=
neuralproofnet
.
linker
categories
,
links
=
linker
.
predict_without_categories
(
a_s
)
#links = linker.predict_with_categories(a_s, tags_s)
idx
=
0
idx
=
0
draw_sentence_output
(
a_s
[
idx
].
split
(
"
"
),
categories
[
idx
],
links
[:,
idx
,:].
numpy
())
draw_sentence_output
(
a_s
[
idx
].
split
(
"
"
),
categories
[
idx
],
links
[:,
idx
,:].
numpy
())
\ No newline at end of file
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