PyTorch Artificial Intelligence Fundamentals by Jibin Mathew

PyTorch Artificial Intelligence Fundamentals by Jibin Mathew

Author:Jibin Mathew
Language: eng
Format: epub, pdf
Tags: COM044000 - COMPUTERS / Neural Networks, COM004000 - COMPUTERS / Intelligence (AI) and Semantics, COM042000 - COMPUTERS / Natural Language Processing
Publisher: Packt
Published: 2020-02-28T05:25:53+00:00


Here, we are able to subtract the man vector from the king vector and sum it with the woman vector, and the resulting vector will be close to the vector representation of queen. We will explore this implementation in this recipe.

How to do it...

In this recipe, we will use pretrained embedding with TorchText:

We will start with the import:

>>from torchtext import vocab

Then, we will move on to loading the embedding vectors:

>>vec = vocab.Vectors('glove.6B.100d.txt', cache='./vec/glove_embedding/', url='http://nlp.stanford.edu/data/glove.6B.zip')

We can build the vocabulary from the pretrained vector by applying it to the field object:



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.