glample/tagger

Pre-trained word embedding for German/Spanish/Dutch/French

Closed this issue · 11 comments

Hi @glample,

Do you use any pre-trained embedding for languages other than English? If so, where I can download these embeddings?

Thanks,
Dung Thai

Hi @dungtn @SawyerW i want to use Publicly available word vectors trained from Google News as pre-trained word embeddings available at https://drive.google.com/file/d/0B7XkCwpI5KDYNlNUTTlSS21pQmM/edit?usp=sharing

Its a .gz file, but i dont have any idea how to use those word embeddings in my script.
python train.py --train dataset/eng.train --dev dataset/eng.testa --test dataset/eng.testb --lr_method=adam --tag_scheme=iob

Can you please guide me?I am stuck...

Since your pre-trained word embedding comes from word2vec, you can use " gensim.models.KeyedVectors.load_word2vec_format" .
You can find what you need from here: https://radimrehurek.com/gensim/models/word2vec.html

@Rabia-Noureen

I wrote a (very) simple script a little while ago to achieve exactly what you are looking to do. It it based directly off the documentation @SawyerW links to.

You can grab the script here. Just make sure you haven genism installed by running either:

easy_install -U gensim or pip install --upgrade gensim

And make sure to first unzip the .gz file.

To use, just open the script and set binary_w2v_file_path to the location of your unzipped.bin file. By default the script will save the converted embeddings in the directory you called the script from (although you can also change this in the script). Then run the script: python convert_w2v_bin_to_glove_format.py in the terminal.

(I confirmed the script works with the word vectors you linked to)

@JohnGiorgi @SawyerW Thanks a lot for your quick response i appreciate your suggestions. I will try the script and will get back to you if i need any further help in this regard.

Thanks again

Hi @JohnGiorgi i tried to run the script but i got this error

image

I tried this for changing the permissions
image

but no use..... Can you please suggest some other way regarding the permissions?

@Rabia-Noureen , got no idea why you try to convert the word2vec embedding. Why don't you just use the word2vec embedding directly?

word2vec_model = gensim.models.KeyedVectors.load_word2vec_format(
    '/path/GoogleNews-vectors-negative300.bin.gz', binary=True)
word2vec_model.init_sims(replace=True)

then you can find all the embedding with word2vec_model.vocab

@SawyerW actually i have just started with python and i was trying to train the model. I dont have any idea where should i embed the code in NERtagger

word2vec_model = gensim.models.KeyedVectors.load_word2vec_format(
'/path/GoogleNews-vectors-negative300.bin.gz', binary=True)
word2vec_model.init_sims(replace=True)

I would highly appreciate if you can guide me....

Maybe it is a good idea if you can post your code and show us what you want to do.

@SawyerW I am actually trying to use this project NER tagger as it is, in order to train the model i am using iob tag scheme and adam as learning method

python train.py --train dataset/eng.train --dev dataset/eng.testa --test dataset/eng.testb --lr_method=adam --tag_scheme=iob

Now i have to use the pre-trained word embedding for training using GoogleNews-vectors-negative300.bin.gz

You can find all pretrained embeddings used in the paper here: #44