Opennmt-py: word2vec converter

Created on 13 May 2017  路  1Comment  路  Source: OpenNMT/OpenNMT-py

How to covert word2vec model to fit pre_word_vecs_enc ?

Most helpful comment

I've written a script to convert text-formatted embeddings to pytorch-compatible format. Maybe you will find it useful. The embeddings file is in the format of

word1 0.xx 0.xx ...
word2 0.xx 0.xx ...

and the dictionary file is identical to the one that preprocess.py produces.
Run it like

python embeddings_to_torch.py -emb_file emb.txt -dict_file source.dict -output_file emb.src.pt

>All comments

I've written a script to convert text-formatted embeddings to pytorch-compatible format. Maybe you will find it useful. The embeddings file is in the format of

word1 0.xx 0.xx ...
word2 0.xx 0.xx ...

and the dictionary file is identical to the one that preprocess.py produces.
Run it like

python embeddings_to_torch.py -emb_file emb.txt -dict_file source.dict -output_file emb.src.pt
Was this page helpful?
0 / 5 - 0 ratings

Related issues

mbforbes picture mbforbes  路  6Comments

achaitanyasai picture achaitanyasai  路  5Comments

nikhilweee picture nikhilweee  路  3Comments

mzeidhassan picture mzeidhassan  路  4Comments

azureskyL picture azureskyL  路  3Comments