Skip to content

Commit

Permalink
Use the same number of threads as PyTorch in CTranslate2 (OpenNMT#2117)
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaumekln authored Oct 21, 2021
1 parent 13bd317 commit e2628a2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions onmt/translate/translation_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def setdefault_if_exists_must_match(obj, name, value):

default_for_translator = {
"inter_threads": 1,
"intra_threads": 1,
"intra_threads": torch.get_num_threads(),
"compute_type": "default",
}
for name, value in default_for_translator.items():
Expand Down Expand Up @@ -189,9 +189,9 @@ def start(self, config_file):
'model_root': conf.get('model_root', self.models_root),
'ct2_model': conf.get('ct2_model', None),
'ct2_translator_args': conf.get('ct2_translator_args',
None),
{}),
'ct2_translate_batch_args': conf.get(
'ct2_translate_batch_args', None),
'ct2_translate_batch_args', {}),
}
kwargs = {k: v for (k, v) in kwargs.items() if v is not None}
model_id = conf.get("id", None)
Expand Down

0 comments on commit e2628a2

Please sign in to comment.