Skip to content
How to train your own word2vec model for use with ml5.js
Branch: master
Clone or download
Latest commit 7cc980f Nov 8, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore Update .gitignore Oct 29, 2018
LICENSE adding a conversion from txt to json script Nov 8, 2018 Add Input with Single File or Folder Functionality Oct 29, 2018


Python Environment


pip install gensim

Train the model

  1. Clone this repository or download this python script
git clone
  1. The script supports training from a single text file or directory of files. Create a text file or folder of multiple files. Now run with the name of the file or folder.


python file.xt
python files/
  1. The script will output a vectors.txt and vectors.json file, however, if you would like to specify an output file name you can use the additional argument -o for that.
python data.txt -o output.json
  1. The output JSON file can be used now with the ml5.js word2vec examples.
You can’t perform that action at this time.