Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Hit-Girl
code
Commits
9f880092
Commit
9f880092
authored
Feb 26, 2022
by
Jerome Wuerf
Browse files
Remove header from output
parent
37980b6b
Changes
5
Hide whitespace changes
Inline
Side-by-side
.vscode/launch.json
View file @
9f880092
...
...
@@ -4,6 +4,7 @@
{
"name"
:
"Python: Attach"
,
"type"
:
"python"
,
"justMyCode"
:
false
,
"request"
:
"attach"
,
"host"
:
"localhost"
,
"port"
:
5678
,
...
...
docker/docker-compose.dev.yaml
View file @
9f880092
...
...
@@ -15,32 +15,16 @@ services:
-
/media:/media
-
/tmp:/tmp
-
/mnt/data/model:/model
depends_on
:
-
elastic
-
/mnt:/mnt
entrypoint
:
-
"
/bin/sh"
-
-ecx
-
|
python -m debugpy --wait-for-client --listen 0.0.0.0:5678 \
/app/src/app.py retrieval --topic-nrb 2 \
--reranking word-mover-distance --reuse-unranked /mnt/data/initial_retrieval_dump.pkl test \
/media/training-datasets/"touche-task-1"/touche-task-1-2022-02-16 /tmp/test
elastic
:
image
:
"
docker.elastic.co/elasticsearch/elasticsearch:7.15.2"
restart
:
always
networks
:
-
tira
ports
:
-
"
9200:9200"
-
"
9300:9300"
volumes
:
-
/mnt/data/elastic:/usr/share/elasticsearch/data
-
./conifg:/conifg
environment
:
-
discovery.type=single-node
-
logger.level=DEBUG
healthcheck
:
test
:
[
"
CMD"
,
"
curl"
,
"
-s"
,
"
-f"
,
"
http://localhost:9200/_cat/health"
]
networks
:
tira
:
null
python/src/retrieval/reranking.py
View file @
9f880092
...
...
@@ -124,12 +124,15 @@ class Reranking:
stance_premise
=
premise
[
'_source'
][
'sentence_stance'
]
if
stance_conclusion
==
stance_premise
\
and
premise
[
'_id'
]
not
in
encountered_premise_ids
:
final_key
=
"final_reranking_score"
if
"final_reranking_score"
in
conclusion
else
"_score"
trec_style_rows
.
append
(
(
topic_nrb
,
conclusion
[
'_source'
][
'sentence_stance'
],
f
'
{
"__"
.
join
(
premise
[
"_id"
].
split
(
"_"
))
}
,'
+
f
'
{
"__"
.
join
(
conclusion
[
"_id"
].
split
(
"_"
))
}
'
,
len
(
trec_style_rows
),
f
'
{
conclusion
[
"
final_
reranking_score"
]
:
.
2
f
}
'
,
self
.
run_name
))
f
'
{
conclusion
[
final_
key
]
:
.
2
f
}
'
,
self
.
run_name
))
encountered_premise_ids
.
add
(
premise
[
'_id'
])
break
rows_per_topic
[
topic_nrb
]
=
trec_style_rows
...
...
python/src/utils/parse_cli_args.py
View file @
9f880092
...
...
@@ -80,11 +80,11 @@ def parse_cli_args() -> argparse.Namespace:
parser_retrieval
.
add_argument
(
'--lambda-conclusions'
,
type
=
float
,
required
=
False
,
default
=
0.5
)
default
=
0.
7
5
)
parser_retrieval
.
add_argument
(
'--lambda-premises'
,
type
=
float
,
required
=
False
,
default
=
0.5
)
default
=
0.
7
5
)
parser_retrieval
.
add_argument
(
'--wait-for-es'
,
action
=
'store_true'
)
...
...
python/src/utils/write_trec_file.py
View file @
9f880092
...
...
@@ -10,7 +10,6 @@ def write_terc_file(result: list, output_path: Path) -> None:
with
open
(
str
(
output_path
),
'w'
)
as
csvfile
:
fieldnames
=
[
'qid'
,
'stance'
,
'pair'
,
'rank'
,
'score'
,
'tag'
]
writer
=
DictWriter
(
csvfile
,
delimiter
=
' '
,
fieldnames
=
fieldnames
)
writer
.
writeheader
()
for
row
in
result
:
writer
.
writerow
(
dict
(
zip
(
fieldnames
,
row
)))
csvfile
.
flush
()
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment