skip-thoughts
skip-thoughts copied to clipboard
decoding problem
Hi. Thanks very very much for your skip-thought vector.
I can use encode() function with downloaded data(utable.npy, btable.npy, uni_skip.npz, etc.).
And now, I want to decode my encoded sentences with same data. but I have problem with decoding.
Can I get model data(in skip-thoughts-master/decoding/tools.py, path_to_model data and
path_to_dictionary data) like encoding process?
Are you looking for a pre-trained decoder which decodes the encoded sentence (like an autoencoder?).
yes. Can I get that one?
I only have one trained on the Romance part of the BookCorpus (that we used for the "neural-storyteller" project). I don't have one on the full BookCorpus though. You could train one yourself using the decoder code available. I will probably train one myself and make it available in the future.
Depending on what you're decoding, the one included with the neural-storyteller project might be sufficient, so I would give that a try first.
ok, I will try. Thank you for reply:)
Hi, I have my own bookcorpus and if I want to train the decoder, how should I do? I want to know what is C and what is X in "train.trainer(X, C, skmodel)". When I run "train.trainer(X, C, skmodel)", is X and C the same list of passages from my own bookcorpus? And I think it miss function "init_tparams" in trian.py, is right? Thanks very very much :)
Hi. Thanks very very much for your skip-thought vector. I tried the Step3:Launch the training with ipython and met the problems as following:
In [1]: import vocab
In [2]: X=[]
In [3]: fd = file( "8911.txt", "r" )
In [4]: for line in fd.readlines(): ...: X.append(list(map(string,line.split(','))))
...:
NameError Traceback (most recent call last)
NameError: name 'string' is not defined
In [5]: for line in fd.readlines(): X.append(list(map(String,line.split(',')))) ...:
In [6]: import train
In [7]: train.trainer(X) {'grad_clip': 5.0, 'dim': 2400, 'optimizer': 'adam', 'dim_word': 620, 'dictionary': '/data/skip-thoughts/training/temp/book_dictionary_large.pkl', 'reload_': False, 'n_words': 20000, 'batch_size': 64, 'encoder': 'gru', 'maxlen_w': 30, 'saveto': '/data/skip-thoughts/training/temp/toy.npz', 'decoder': 'gru', 'max_epochs': 5, 'dispFreq': 1, 'decay_c': 0.0, 'saveFreq': 1000} Loading dictionary... Building model /usr/lib/python2.7/site-packages/theano/scan_module/scan.py:1019: Warning: In the strict mode, all neccessary shared variables must be passed as a part of non_sequences 'must be passed as a part of non_sequences', Warning) Building f_log_probs... Done Building f_cost... Done Done Building f_grad... Building optimizers... Optimization
Epoch 0
IndexError Traceback (most recent call last)
/data/skip-thoughts/training/train.pyc in trainer(X, dim_word, dim, encoder, decoder, max_epochs, dispFreq, decay_c, grad_clip, n_words, maxlen_w, optimizer, batch_size, saveto, dictionary, saveFreq, reload_) 151 print 'Epoch ', eidx 152 --> 153 for x, y, z in train_iter: 154 n_samples += len(x) 155 uidx += 1
/data/skip-thoughts/training/homogeneous_data.pyc in next(self) 48 while True: 49 self.len_idx = numpy.mod(self.len_idx+1, len(self.len_unique)) ---> 50 if self.len_curr_counts[self.len_unique[self.len_idx]] > 0: 51 break 52 count += 1
IndexError: index 0 is out of bounds for axis 0 with size 0
In [8]:
could you help me ? best, Lan
never mind, I already solved it.
best, Lan
+1
@wllps1988315 I am having the same error if i give a sentence into X, if i give many sentences it is giving this error. can you give me a brief insight on how you solved that error?
Thank You
@oxingoxing did you find one?