Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
master_litl_tp-seg
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
MELODI
AnDiAMO
teaching_cbraud
master_litl_tp-seg
Commits
97669916
Commit
97669916
authored
2 years ago
by
lrivier
Browse files
Options
Downloads
Patches
Plain Diff
fix multi-process pb and change config
parent
c797c1e9
Branches
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
DISCUT/code/config_global_1.1.json
+4
-4
4 additions, 4 deletions
DISCUT/code/config_global_1.1.json
DISCUT/code/discut22_2.py
+15
-3
15 additions, 3 deletions
DISCUT/code/discut22_2.py
with
19 additions
and
7 deletions
DISCUT/code/config_global_1.1.json
+
4
−
4
View file @
97669916
...
...
@@ -13,9 +13,9 @@
"syntactic_tool"
:
"stanza"
,
"sentence_split"
:
true
,
"tokenization"
:
true
,
"syntactic_parsing"
:
fals
e
,
"syntactic_parsing"
:
tru
e
,
"create_metadata"
:
{
"to_do"
:
tru
e
,
"to_do"
:
fals
e
,
"line"
:
"paragraph"
,
"sent"
:
"sent"
}
...
...
@@ -36,11 +36,11 @@
"output"
:{
"conll_file"
:{
"to_do"
:
true
,
"metadata"
:
tru
e
,
"metadata"
:
fals
e
,
"with_gold_labels"
:
false
},
"txt_file"
:{
"to_do"
:
fals
e
,
"to_do"
:
tru
e
,
"metadata"
:
true
}
}
...
...
This diff is collapsed.
Click to expand it.
DISCUT/code/discut22_2.py
+
15
−
3
View file @
97669916
...
...
@@ -10,6 +10,8 @@
import
argparse
from
datetime
import
datetime
import
os
import
subprocess
from
subprocess
import
Popen
import
re
import
json
import
utils.syntactic_parsing
as
synt_pars
...
...
@@ -114,9 +116,18 @@ class Data:
fi_ner
=
self
.
ner
if
fi_ner
==
None
else
fi_ner
model
=
steps
.
model_path
if
model
==
None
else
model
self
.
pred_json
=
f
"
{
self
.
resu
}
/
{
js_name
}
_pred.json
"
cmd
=
f
"
allennlp predict --use-dataset-reader --output-file
{
self
.
pred_json
}
{
model
}
{
fi_ner
}
&>
{
self
.
resu
}
/logs_predictions.txt
"
cmd
=
f
"
allennlp predict --use-dataset-reader --output-file
{
self
.
pred_json
}
{
model
}
{
fi_ner
}
"
print
(
f
"
----> Making predictions:
{
cmd
}
.
"
)
os
.
system
(
cmd
)
cp
=
subprocess
.
run
(
cmd
,
shell
=
True
,
text
=
True
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
print
(
f
"
----> done
"
)
with
open
(
f
"
{
self
.
resu
}
/logs_predictions.txt
"
,
"
w
"
)
as
fe
:
fe
.
write
(
cp
.
stderr
)
#with open(f"{self.resu}/logs_predictions.txt", 'w') as fe: # too long !
# p = Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=fe, universal_newlines=True)
# p.wait()
logs
.
add_infos
(
'
predictions_cmd
'
,
cmd
)
def
pred_json_to_conll_w_metadata_w_gold
(
self
,
name
=
None
):
# here and 3 below..sorry..factorsation TBD
...
...
@@ -268,7 +279,7 @@ class Process:
if
self
.
model
==
"
tony
"
:
arch
=
"
french_tokens.tar.gz
"
if
not
os
.
path
.
isfile
(
f
"
../model/tony/
{
arch
}
"
):
dl
=
"
wget https://zenodo.org/record/4235850/files/french_tokens.tar.gz -P ../model --progress=bar
"
dl
=
"
wget https://zenodo.org/record/4235850/files/french_tokens.tar.gz -P ../model
/tony
--progress=bar
"
os
.
system
(
dl
)
self
.
model_path
=
f
"
../model/tony/
{
arch
}
"
else
:
...
...
@@ -419,5 +430,6 @@ if __name__ == '__main__':
if
steps
.
eval
==
True
:
data
.
evaluation
(
steps
,
prod
,
name
=
steps
.
test_data
,
model
=
steps
.
model_ft_path
)
logs
.
add_infos
(
'
end
'
,
get_stamp
())
logs
.
print
(
stamp_time
)
print
(
f
"
----> All logs saved in
{
logs
.
file_path
}
"
)
\ 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