mirror of
https://github.com/marian-nmt/marian.git
synced 2024-11-30 12:02:16 +03:00
add arg --use-fused-softmax
This commit is contained in:
parent
a27f16972b
commit
cf4e6726d3
@ -230,7 +230,9 @@ void Config::AddOptions(size_t argc, char** argv) {
|
||||
("mini-batch-words", po::value<int>()->default_value(0),
|
||||
"Set mini-batch size based on words instead of sentences.")
|
||||
("decoding-mini-batch", po::value<size_t>()->default_value(0),
|
||||
"Number of sentences in mini batch, just in the decoding. (Default=0 - should make the same as mini-batch")
|
||||
"Number of sentences in mini batch, just in the decoding. (Default=0 - should make the same as mini-batch")
|
||||
("use-fused-softmax", po::value<bool>()->default_value(true),
|
||||
"Use fused softmax/nth-element, if appropriate.")
|
||||
|
||||
("show-weights", po::value<bool>()->zero_tokens()->default_value(false),
|
||||
"Output used weights to stdout and exit")
|
||||
@ -328,6 +330,7 @@ void Config::AddOptions(size_t argc, char** argv) {
|
||||
SET_OPTION("maxi-batch", size_t);
|
||||
SET_OPTION("mini-batch-words", int);
|
||||
SET_OPTION("decoding-mini-batch", size_t);
|
||||
SET_OPTION("use-fused-softmax", bool);
|
||||
|
||||
SET_OPTION("max-length", size_t);
|
||||
SET_OPTION("encoder-buffer-size", size_t);
|
||||
|
@ -92,13 +92,18 @@ God& God::Init(int argc, char** argv) {
|
||||
LoadFiltering();
|
||||
|
||||
returnNBestList_ = Get<bool>("n-best");
|
||||
useFusedSoftmax_ = true;
|
||||
if (gpuLoaders_.size() != 1 || // more than 1 scorer
|
||||
God::Get<size_t>("beam-size") > 11 // beam size affect shared mem alloc in gLogSoftMax()
|
||||
) {
|
||||
|
||||
if (Get<bool>("use-fused-softmax")) {
|
||||
useFusedSoftmax_ = true;
|
||||
if (gpuLoaders_.size() != 1 || // more than 1 scorer
|
||||
God::Get<size_t>("beam-size") > 11 // beam size affect shared mem alloc in gLogSoftMax()
|
||||
) {
|
||||
useFusedSoftmax_ = false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
useFusedSoftmax_ = false;
|
||||
}
|
||||
//useFusedSoftmax_ = false;
|
||||
//cerr << "useFusedSoftmax_=" << useFusedSoftmax_ << endl;
|
||||
|
||||
useTensorCores_ = Get<bool>("tensor-cores");
|
||||
|
Loading…
Reference in New Issue
Block a user