Skip to content
Snippets Groups Projects
Commit ad8e0187 authored by Franck Dary's avatar Franck Dary
Browse files

Throws error if asked to read empty w2v file

parent 05062ca7
No related branches found
No related tags found
No related merge requests found
......@@ -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);
}
......@@ -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);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment