Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
99f73bcc
"app/git@developer.sourcefind.cn:orangecat/ollama.git" did not exist on "88622847c6a83508681b8876e2aaca9ca85f83b5"
Unverified
Commit
99f73bcc
authored
Aug 08, 2020
by
Sam Shleifer
Committed by
GitHub
Aug 08, 2020
Browse files
[s2s] tiny QOL improvement: run_eval prints scores (#6341)
parent
322dffc6
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
2 deletions
+2
-2
examples/seq2seq/pack_dataset.py
examples/seq2seq/pack_dataset.py
+0
-1
examples/seq2seq/run_eval.py
examples/seq2seq/run_eval.py
+2
-1
No files found.
examples/seq2seq/pack_dataset.py
View file @
99f73bcc
...
...
@@ -33,7 +33,6 @@ def pack_examples(tok, src_examples, tgt_examples, max_tokens=1024):
new_src
,
new_tgt
=
src
,
tgt
else
:
# can fit, keep adding
new_src
,
new_tgt
=
cand_src
,
cand_tgt
# import ipdb; ipdb.set_trace()
# cleanup
if
new_src
:
...
...
examples/seq2seq/run_eval.py
View file @
99f73bcc
...
...
@@ -89,7 +89,7 @@ def run_generate():
examples
=
[
" "
+
x
.
rstrip
()
if
"t5"
in
args
.
model_name
else
x
.
rstrip
()
for
x
in
open
(
args
.
input_path
).
readlines
()]
if
args
.
n_obs
>
0
:
examples
=
examples
[:
args
.
n_obs
]
Path
(
args
.
save_path
).
parent
.
mkdir
(
exist_ok
=
True
)
generate_summaries_or_translations
(
examples
,
args
.
save_path
,
...
...
@@ -107,6 +107,7 @@ def run_generate():
output_lns
=
[
x
.
rstrip
()
for
x
in
open
(
args
.
save_path
).
readlines
()]
reference_lns
=
[
x
.
rstrip
()
for
x
in
open
(
args
.
reference_path
).
readlines
()][:
len
(
output_lns
)]
scores
:
dict
=
score_fn
(
output_lns
,
reference_lns
)
print
(
scores
)
if
args
.
score_path
is
not
None
:
json
.
dump
(
scores
,
open
(
args
.
score_path
,
"w+"
))
return
scores
...
...
Write
Preview
Markdown
is supported
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