text icon indicating copy to clipboard operation
text copied to clipboard

Need makedirs call for .vector_cache when path to custom embeddings is passed to Vectors init

Open zhzhang opened this issue 8 years ago • 1 comments

https://github.com/pytorch/text/blob/4ecb8d8b04b2f9ac3295e96f53409b98cd706c0a/torchtext/vocab.py#L256

The makedirs call here needs to be moved to just before the cache is written to. Otherwise, if you specify a custom pre-trained embeddings file, it will error with

No such file or directory: u'.vector_cache/wiki_en.emb.pt'.

zhzhang avatar Apr 19 '18 00:04 zhzhang

@zhzhang I might be missing something, but I haven't been able to reproduce the exception. Could you please provide your code snippet and exactly what folders and files exist at the time? Thanks.

domaala avatar May 04 '18 20:05 domaala