AotY / Pytorch-Glove

fork from: https://github.com/kefirski/pytorch_GloVe

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pytorch Global Vectors for Word Representation

Global Vectors for Word Representation implemented in PyTorch.

NEG Loss Equation

Usage

glove = GloVe(co_oc_matrix, embed_size)
    
optimizer = Adagrad(glove.parameters(), 0.05)
    
for i in range(num_iterations):
    ''' 
    input and target are [batch_size] shaped arrays of int type
    '''
    input, target = next_batch(batch_size)
        
    loss = glove(input, target)
    
    optimizer.zero_grad()
    loss.backward()
    optimizer.step()
    
word_embeddings = glove.embeddings()        

About

fork from: https://github.com/kefirski/pytorch_GloVe

License:MIT License


Languages

Language:Python 100.0%