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

Throw error if given pretrained word embeddings file don't exist

parent 77afafd7
No related branches found
No related tags found
No related merge requests found
......@@ -7,9 +7,12 @@ void Submodule::setFirstInputIndex(std::size_t firstInputIndex)
void Submodule::loadPretrainedW2vEmbeddings(torch::nn::Embedding & embeddings, std::filesystem::path path)
{
if (!std::filesystem::exists(path))
if (path.empty())
return;
if (!std::filesystem::exists(path))
util::myThrow(fmt::format("pretrained word2vec file '{}' do not exist", path.string()));
torch::NoGradGuard no_grad;
auto originalState = getDict().getState();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment