Merged PR 25950: Add missing defaults for concatenated factors

This PR adds missing default values for concatenated factors.
This commit is contained in:
Marcin Junczys-Dowmunt 2022-10-06 05:53:16 +00:00
parent 1e92cff93d
commit 4d3702c4ec
3 changed files with 7 additions and 7 deletions

View File

@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- `--output-sampling` now works with ensembles (requires proper normalization via e.g `--weights 0.5 0.5`)
### Fixed
- Make concat factors not break old vector implementation
- Use allocator in hashing
- Read/restore checkpoints from main process only when training with MPI
- Multi-loss casts type to first loss-type before accumulation (aborted before due to missing cast)

View File

@ -1 +1 @@
v1.11.13
v1.11.14

View File

@ -6,10 +6,8 @@ namespace marian {
Embedding::Embedding(Ptr<ExpressionGraph> graph, Ptr<Options> options)
: LayerBase(graph, options), inference_(opt<bool>("inference")) {
std::string name = opt<std::string>("prefix");
int dimVoc = opt<int>("dimVocab");
int dimEmb = opt<int>("dimEmb");
int dimFactorEmb = opt<int>("dimFactorEmb");
int dimVoc = opt<int>("dimVocab");
int dimEmb = opt<int>("dimEmb");
bool fixed = opt<bool>("fixed", false);
// Embedding layer initialization should depend only on embedding size, hence fanIn=false
@ -21,6 +19,7 @@ Embedding::Embedding(Ptr<ExpressionGraph> graph, Ptr<Options> options)
dimVoc = (int)factoredVocab_->factorVocabSize();
LOG_ONCE(info, "[embedding] Factored embeddings enabled");
if(opt<std::string>("factorsCombine") == "concat") {
int dimFactorEmb = opt<int>("dimFactorEmb", 0);
ABORT_IF(dimFactorEmb == 0,
"Embedding: If concatenation is chosen to combine the factor embeddings, a factor "
"embedding size must be specified.");
@ -179,8 +178,8 @@ Expr Embedding::applyIndices(const std::vector<WordIndex>& embIdx, const Shape&
"prefix", (opt<bool>("tied-embeddings-src") || opt<bool>("tied-embeddings-all")) ? "Wemb"
: prefix_ + "_Wemb",
"fixed", embeddingFix_,
"dimFactorEmb", opt<int>("factors-dim-emb"), // for factored embeddings
"factorsCombine", opt<std::string>("factors-combine"), // for factored embeddings
"dimFactorEmb", opt<int>("factors-dim-emb", 0), // for factored embeddings
"factorsCombine", opt<std::string>("factors-combine", ""), // for factored embeddings
"vocab", opt<std::vector<std::string>>("vocabs")[batchIndex_]); // for factored embeddings
// clang-format on
if(options_->hasAndNotEmpty("embedding-vectors")) {