Commit 30e51f46 authored by Franck Dary's avatar Franck Dary
Browse files

Corrected bug in MacaonDecode where dicts were not closed. Parallel decode.

parent 17e6ebe9
#include "MacaonDecode.hpp"
#include <filesystem>
#include <execution>
#include "util.hpp"
#include "Decoder.hpp"
#include "Submodule.hpp"
......@@ -122,11 +123,23 @@ int MacaonDecode::main()
configs.emplace_back(mcd, tsv, util::utf8string(), std::vector<int>());
for (unsigned int i = 0; i < configs.size(); i++)
if (configs.size() > 1)
decoder.decode(configs[i], beamSize, beamThreshold, debug, printAdvancement);
configs[i].print(stdout, i == 0);
NeuralNetworkImpl::device = torch::kCPU;;
std::for_each(std::execution::par_unseq, configs.begin(), configs.end(),
[&decoder, debug, printAdvancement, beamSize, beamThreshold](BaseConfig & config)
decoder.decode(config, beamSize, beamThreshold, debug, printAdvancement);
decoder.decode(configs[0], beamSize, beamThreshold, debug, printAdvancement);
for (unsigned int i = 0; i < configs.size(); i++)
configs[i].print(stdout, i == 0);
} catch(std::exception & e) {util::error(e);}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment