Skip to content

Commit

Permalink
Simplify invocation a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
XapaJIaMnu committed Aug 2, 2023
1 parent 1e80e79 commit 3d37edf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
3 changes: 0 additions & 3 deletions bindings/python/translator.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,6 @@ def main():
num_gpus = []
else:
num_gpus = args.num_gpus[0]
print(num_gpus)
print(type(num_gpus))
print(args.num_workers)
translator = Translator(args.config, args.num_workers, num_gpus, args.cache_size, args.logging, args.terminology_tsv, args.force_terminology, args.terminology_form)

if args.path_to_input is None:
Expand Down
11 changes: 6 additions & 5 deletions src/translator/service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,15 +158,16 @@ AsyncService::AsyncService(const AsyncService::Config &config)
safeBatchingPool_(),
cache_(makeOptionalCache(config_.cacheSize, /*mutexBuckets=*/config_.numWorkers)),
logger_(config.logger) {
if (config_.gpuWorkers.size() != 0) {
ABORT_IF(config_.numWorkers != 0, "Unable to mix GPU and CPU workers.");
if (config_.gpuWorkers.empty()) {
ABORT_IF(config_.numWorkers == 0, "Number of workers should be at least 1 in a threaded workflow");
workers_.reserve(config_.numWorkers);
} else {
if (config_.numWorkers != 0)
LOG(info, "Unable to mix GPU and CPU workers, using GPU workers only...");
workers_.reserve(config_.gpuWorkers.size());
// VERY VERY HACKY. EVERYTHING USES NUM_WORKERS AS A REFERENCE FOR THE NUMBER OF WORKERS,
// REFACTOR TO USE gpuWorkers directly...
config_.numWorkers = config_.gpuWorkers.size();
} else {
ABORT_IF(config_.numWorkers == 0, "Number of workers should be at least 1 in a threaded workflow");
workers_.reserve(config_.numWorkers);
}
// Initiate terminology map if present
if (!config_.terminologyFile.empty()) {
Expand Down

0 comments on commit 3d37edf

Please sign in to comment.