GithubHelp home page GithubHelp logo

sentencerepresentation's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sentencerepresentation's Issues

Run train_model.sh Error

The error report is:

fastsent_inner.c:4:10: fatal error: 'Python.h' file not found
#include "Python.h"

I create a environment contain python=2.7 by using anaconda.
What should I do?

An update must have the same type as the original shared variable

Thank you for publishing this code.

After following the instructions for SDAE, I run train_book.py and receive an error which suggests a shard variable is being overwritten with data of a different type.

Please could you help


 File "train_book.py", line 55, in <module>
    'test_text': ['newstest.tok.en']})
  File "train_book.py", line 32, in main
    embeddings=params['embeddings'][0])
  File "../SentenceRepresentation/SDAE/desent.py", line 905, in train
    f_grad_shared, f_update = eval(optimizer)(lr, tparams, grads, inps, cost)
  File "../SentenceRepresentation/SDAE/desent.py", line 711, in adam
    f_update = theano.function([lr], [], updates=updates, on_unused_input='ignore')
  File "../local/lib/python2.7/site-packages/theano/compile/function.py", line 320, in function
    output_keys=output_keys)
  File "../local/lib/python2.7/site-packages/theano/compile/pfunc.py", line 442, in pfunc
    no_default_updates=no_default_updates)
  File "../local/lib/python2.7/site-packages/theano/compile/pfunc.py", line 207, in rebuild_collect_shared
    raise TypeError(err_msg, err_sug)
TypeError: ('An update must have the same type as the original shared variable (shared_var=<TensorType(float32, matrix)>, shared_var.type=TensorType(float32, matrix), update_val=Elemwise{add,no_inplace}.0, update_val.type=TensorType(float64, matrix)).', 'If the difference is related to the broadcast pattern, you can call the tensor.unbroadcast(var, axis_to_unbroadcast[, ...]) function to remove broadcastable dimensions.')

Adding requirements in the documentation

Thanks for making this GitHub public! I'm now training the FastSent model, but noticed that it requires the pattern module, which is not installed by default. This is very easy to overlook, as it is not a hard requirement. Could you add this requirement in the documentation?

TypeError: unhashable type: 'list'

Hello !

Thank you for releasing your code for FastSent ! I tried to use it, but i got this error just before the training step :

2016-02-24 14:36:52,081 : INFO : training model with 1 workers on 52178 vocabulary and 200 features, using sg=0 hs=1 sample=0 and negative=0
2016-02-24 14:36:52,081 : INFO : expecting 10655070 examples, matching count from corpus used for vocabulary survey
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 763, in run
self.__target(_self.__args, *_self.__kwargs)
File "/fastsent/SentenceRepresentation/FastSent/gensim/gensim/models/word2vec.py", line 735, in worker_loop
if not worker_one_job(job, init):
File "
/fastsent/SentenceRepresentation/FastSent/gensim/gensim/models/word2vec.py", line 724, in worker_one_job
tally, raw_tally = self._do_train_job(items, alpha, inits)
File "~/fastsent/SentenceRepresentation/FastSent/gensim/gensim/models/word2vec.py", line 661, in _do_train_job
tally += train_sentence_cbow(self, sentences, alpha, work, neu1)
File "gensim/models/word2vec_inner.pyx", line 397, in gensim.models.word2vec_inner.train_sentence_cbow (word2vec_inner.c:4436)
cdef int cbow_mean = model.cbow_mean
TypeError: unhashable type: 'list'

My sentence iterator is the same as yours, except I added an utf-8 decoding step just before yielding the split.

Request for required newsdev.tok.en and newstest.tok.en training files

Hello:
Trying to figure out format for newsdev.tok.en and newstest.tok.en required for SDAE training.
Have attempted using Penn Tree Bank test & valid files as renamed substitutes but throws this ValueError:

Nvidia 1070 gpu, ubuntu 16.04

Building model
Building f_log_probs... Done
Building f_ctx... Done
Building f_cost... Done
Computing gradient... Done
Building optimizers... Done
Optimization
Traceback (most recent call last):
File "train_book.py", line 54, in
'test_text': ['data/newstest.tok.en']}) # using PTB file
File "train_book.py", line 31, in main
embeddings=params['embeddings'][0])
File "/home/pixelhead/Desktop/FastSent/SentenceRepresentation/SDAE/desent.py", line 953, in train
if x == None:
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

Would appreciate links to these files or if not possible a simple example of the format required.

Also, a link or recommended substitute for "D_medium_cbow_pdw_8B.pkl" would be helpful.

embeddings='../Files/D_medium_cbow_pdw_8B.pkl',
dictionary='../Files/dict.pkl',
valid_text='../Files/newsdev.tok.en',
test_text='../Files/newstest.tok.en'

Have downloaded all other recommended models and files.

Cheers

Fatal error when compiling using Anaconda python

fastsent_inner.c:436:31: fatal error: numpy/arrayobject.h: No such file or directory                                  │tences$ ipython
 #include "numpy/arrayobject.h"                                                                                       │Python 3.5.2 |Anaconda custom (64-bit)| (default, Jul  2 2016, 17:53:06) 
                               ^                                                                                      │Type "copyright", "credits" or "license" for more information.
compilation terminated. 

I've set up a python 2.7 environment and installed numpy and other prerequisites using conda. When FastSent's train_model.sh tries to compile the cython file, I get the above error. The actual location of the arrayobject.h file is here:
/home/user/anaconda3/envs/python2/lib/python2.7/site-packages/numpy/core/include

What can I do to point python to my anaconda installation?

**EDIT**
Actually I get the same error when using the regular version of python.

All this to say that the FastSent model doesn't look like it will take only 2 hours to train as the paper mentions, and I figure this is because it isn't using cython optimized code. Is there something I'm doing wrong or is this to be expected?

**UPDATE**

I had to change the line

gcc -shared -pthread -fPIC -fwrapv -O2 -Wall -fno-strict-aliasing -I/usr/include/python2.7 -o fastsent_inner.so fastsent_inner.c

to

gcc -shared -pthread -fPIC -fwrapv -O2 -Wall -fno-strict-aliasing -I/home/user/anaconda3/envs/python2/lib/python2.7/site-packages/numpy/core/include -I/home/user/anaconda3/envs/python2/include/python2.7 -o fastsent_inner.so fastsent_inner.c

Note that python2 is a conda environment I created for this purpose. The exact path might be different for you, but the fix is basically locating arrayobject.h header from numpy and including that directory.

The error in the comment below also fixed itself when the compilation was successful.

How to retrieve the embeddings after training?

Thank you for releasing the code!
I have trained the model using my own data from scratch. But I am unable to understand how to retrieve the embeddings for the training data, or for new data.
Any help will be appreciated.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.