Skip to content

Guide how to encode a simple sentence #19

Description

@djmv

Hello, I'm new and I trying to use this tool. I have downloaded the google word2vec pre-trained file (GoogleNews-vectors-negative300.bin.gz). Then, I use the example code

import tensorflow as tf
from gensim.models import KeyedVectors

from skip_thoughts import SkipThoughts


# Initialize the word2vec and skip-thoughts models only once:
word2vec_model = KeyedVectors.load('GoogleNews-vectors-negative300.bin.gz', mmap='r')
graph = tf.Graph()
with graph.as_default():
  # Refer to the constructor docstring for more information on the arguments.
  model = SkipThoughts(word2vec_model, **kwargs) # What params have to put ? 

with tf.Session(graph=graph):
  # Restore the model only once.
  # Here, `save_dir` is the directory where the .ckpt files live. Typically
  # this would be "output/mymodel" where --model_name=mymodel in train.py.
  model.restore(save_dir)
  
  # Run the model like this as many times as desired.
  print(model.encode(sentence_strings))

Put in keyVectorload the file downloaded, but then when I run, got errors.
I need some basic tutorial for test the example. please.
I'm trying to enconde simple sentences and then I want to use that for train a classifier.
And I read that with skip-thoughts are obtained good results and I want to test.

My question are:
Where I put sentences?
I need train some model or pre-trained file is enough ?

Please, I need help.
Thanks !

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions