skip-thoughts icon indicating copy to clipboard operation
skip-thoughts copied to clipboard

decoding problem

Open oxingoxing opened this issue 9 years ago • 10 comments

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?

oxingoxing avatar Nov 04 '15 08:11 oxingoxing

Are you looking for a pre-trained decoder which decodes the encoded sentence (like an autoencoder?).

ryankiros avatar Nov 08 '15 21:11 ryankiros

yes. Can I get that one?

oxingoxing avatar Nov 09 '15 01:11 oxingoxing

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.

ryankiros avatar Nov 11 '15 22:11 ryankiros

ok, I will try. Thank you for reply:)

oxingoxing avatar Nov 12 '15 01:11 oxingoxing

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 :)

hit-computer avatar Dec 18 '15 13:12 hit-computer

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) in () 1 for line in fd.readlines(): ----> 2 X.append(list(map(string,line.split(',')))) 3

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) in () ----> 1 train.trainer(X)

/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

wllps1988315 avatar Jan 15 '16 07:01 wllps1988315

never mind, I already solved it.

best, Lan

wllps1988315 avatar Jan 19 '16 06:01 wllps1988315

+1

jtoy avatar Jun 15 '16 19:06 jtoy

@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? screenshot from 2018-02-04 15 22 03 screenshot from 2018-02-04 15 22 39

Thank You

Pratyusha1796 avatar Feb 04 '18 20:02 Pratyusha1796

@oxingoxing did you find one?

HassanAzzam avatar Mar 10 '18 12:03 HassanAzzam