INNER CODE UNIT · Python

csv_print

OpenNMT/CTranslate2 · tools/tune_inter_intra.py:11

def csv_print(*args):
    print(*args, sep=',')

N_PHYSICAL_CORES = multiprocessing.cpu_count() // 2
eprint("Optimizing for up to:", N_PHYSICAL_CORES, "cores")

# try best first, ie: closest to the number of cores
configurations = sorted([(i, j) for (i, j) in itertools.product(range(1, N_PHYSICAL_CORES+1), repeat=2) if i*j <= N_PHYSICAL_CORES], key=lambda x: x[0]*x[1], reverse=True)
eprint("Values to explore:", list(configurations))

# do not wait standard input if a src file to translate is given
input_to_translate = bytes() if "--src" in sys.argv else sys.stdin.read().encode()

translate_bin_path = sys.argv[1]

if not os.access(translate_bin_path, os.X_OK):
    eprint("No executable file at:", translate_bin_path)
    exit(1)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…