edit

tools/translation_server.lua

translation_server.lua options:

  • -h [] (default: false)
    This help.
  • -md [] (default: false)
    Dump help in Markdown format.
  • -config (default: '')
    Load options from this file.
  • -save_config (default: '')
    Save options to this file.

Server options

  • -host (default: 127.0.0.1)
    Host to run the server on.
  • -port (default: 5556)
    Port to run the server on.

Translator options

  • -model (default: '')
    Path to the serialized model file.
  • -lm_model (default: '')
    Path to serialized language model file.
  • -lm_weight (default: 0.1)
    Relative weight of language model.
  • -beam_size (default: 5)
    Beam size.
  • -max_sent_length (default: 250)
    输出句子的最大长度。
  • -replace_unk [] (default: false)
    Replace the generated tokens with the source token that has the highest attention weight. If -phrase_table is provided, it will lookup the identified source token and give the corresponding target token. If it is not provided (or the identified source token does not exist in the table) then it will copy the source token
  • -replace_unk_tagged [] (default: false)
    The same as -replace_unk, but wrap the replaced token in ⦅unk:xxxxx⦆ if it is not found in the phrase table.
  • -phrase_table (default: '')
    Path to source-target dictionary to replace tokens.
  • -n_best (default: 1)
    If > 1, it will also output an n-best list of decoded sentences.
  • -max_num_unks (default: inf)
    All sequences with more s than this will be ignored during beam search.
  • -target_subdict (default: '')
    Path to target words dictionary corresponding to the source.
  • -pre_filter_factor (default: 1)
    Optional, set this only if filter is being used. Before applying filters, hypotheses with top beam_size * pre_filter_factor scores will be considered. If the returned hypotheses voilate filters, then set this to a larger value to consider more.
  • -length_norm (default: 0)
    Length normalization coefficient (alpha). If set to 0, no length normalization.
  • -coverage_norm (default: 0)
    Coverage normalization coefficient (beta). An extra coverage term multiplied by beta is added to hypotheses scores. If is set to 0, no coverage normalization.
  • -eos_norm (default: 0)
    End of sentence normalization coefficient (gamma). If set to 0, no EOS normalization.
  • -dump_input_encoding [] (default: false)
    Instead of generating target tokens conditional on the source tokens, we print the representation (encoding/embedding) of the input.
  • -save_beam_to (default: '')
    Path to a file where the beam search exploration will be saved in a JSON format. Requires the dkjson package.

Cuda options

  • -gpuid (default: 0)
    List of GPU identifiers (1-indexed). CPU is used when set to 0.
  • -fallback_to_cpu [] (default: false)
    If GPU can't be used, rollback on the CPU.
  • -fp16 [] (default: false)
    Use half-precision float on GPU.
  • -no_nccl [] (default: false)
    在并行模式下使得 nccl 不能运用。
  • Logger options

    • -log_file (default: '')
      Output logs to a file under this path instead of stdout.
    • -disable_logs [] (default: false)
      If set, output nothing.
    • -log_level (accepted: DEBUG, INFO, WARNING, ERROR, NOERROR; default: INFO)
      Output logs at this level and above.