diff --git a/common/src/Dict.cpp b/common/src/Dict.cpp index cab960bb79affb84b91a6f01fd093f984f43c1f9..12d7bffd155d7898e86969c60c962b62776d3038 100644 --- a/common/src/Dict.cpp +++ b/common/src/Dict.cpp @@ -246,6 +246,9 @@ void Dict::loadWord2Vec(std::filesystem::path & path) std::fclose(file); + if (firstLine) + util::myThrow(fmt::format("file '{}' is empty", path.string())); + setState(originalState); } diff --git a/torch_modules/src/Submodule.cpp b/torch_modules/src/Submodule.cpp index e58ff2849effc45d778d62eaae489b4c17f2ae89..ea63b99f952ba705bf7a4d9dd6ae7475568d4704 100644 --- a/torch_modules/src/Submodule.cpp +++ b/torch_modules/src/Submodule.cpp @@ -60,6 +60,9 @@ void Submodule::loadPretrainedW2vEmbeddings(torch::nn::Embedding & embeddings, s std::fclose(file); + if (firstLine) + util::myThrow(fmt::format("file '{}' is empty", path.string())); + getDict().setState(originalState); }