Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add local evaluation for simultaneous translation #2040

Open
wants to merge 1 commit into
base: simulastsharedtask
from

Conversation

@xutaima
Copy link
Contributor

@xutaima xutaima commented Apr 21, 2020

Usage:

  • Text Translation
python $fairseq/example/simultaneous_translation/eval/evaluate_local.py \
    --scorer-type text \
    --agent-type simul_trans_text \
    --tokenizer 13a \
    --src-file $src \
    --tgt-file $tgt \
    --data-bin $data_bin \
    --model-path $model \
    --src-splitter-type $src_splitter_type \
    --src-splitter-path $src_splitter_path \
    --tgt-splitter-type $tgt_splitter_type \
    --tgt-splitter-path $tgt_splitter_path \
    --num-threads 10 \
    --output
  • Speech Translation
python $fairseq/example/simultaneous_translation/eval/evaluate_local.py \
    --scorer-type speech \
    --agent-type simul_trans_speech \
    --tokenizer 13a \
    --tgt-file $json_file \
    --data-bin $data_bin \
    --model-path $model \
    --src-splitter-type $src_splitter_type \
    --src-splitter-path $src_splitter_path \
    --tgt-splitter-type $tgt_splitter_type \
    --tgt-splitter-path $tgt_splitter_path \
    --num-threads 10 \
    --output
@xutaima xutaima requested a review from jmp84 Apr 21, 2020
@xutaima xutaima requested a review from mjdousti Apr 21, 2020
Copy link

@mjdousti mjdousti left a comment

See comments.

@@ -0,0 +1,44 @@
#!/bin/bash
set -e

This comment has been minimized.

@mjdousti

mjdousti Apr 22, 2020

Use this instead:

set -euxo errexit
set -o pipefail

This comment has been minimized.

@jmp84

jmp84 Apr 22, 2020
Contributor

Can you explain the advantages?

This comment has been minimized.

@mjdousti

mjdousti Apr 28, 2020

In cmd1 | cmd2 line, if cmd1 fails, the script won't fail as the return value would be taken from cmd2. set -o pipefail ensures the script would fail when cmd1 fails.

For a more detailed discussion, see https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/


user_dir=$(dirname "$0")/..

echo Evaluatation starts at $(date +%Y/%m/%d-%H:%M:%S) &&

This comment has been minimized.

@mjdousti

mjdousti Apr 22, 2020

Do you want to calculate the runtime? If so, use time command instead.

@jmp84
jmp84 approved these changes Apr 22, 2020
Copy link
Contributor

@jmp84 jmp84 left a comment

LGTM

@@ -1,11 +1,14 @@
from . import GET, SEND, DEFAULT_EOS
import time
from multiprocessing.pool import ThreadPool as Pool
from functools import partial
from functools import partial

This comment has been minimized.

@jmp84

jmp84 Apr 22, 2020
Contributor

How did it work before :O ?

This comment has been minimized.

@mjdousti

mjdousti Apr 28, 2020

These two lines are identical to me!

@@ -0,0 +1,44 @@
#!/bin/bash
set -e

This comment has been minimized.

@jmp84

jmp84 Apr 22, 2020
Contributor

Can you explain the advantages?

@facebook-github-bot
Copy link
Contributor

@facebook-github-bot facebook-github-bot commented May 23, 2020

Hi @xutaima!

Thank you for your pull request. We require contributors to sign our Contributor License Agreement, and yours needs attention.

You currently have a record in our system, but we do not have a signature on file.

In order for us to review and merge your code, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.