backstopmedia / tensorflowbook

459 stars 297 forks source link

Chapter 6? #5

Open camrongodbout opened 8 years ago

camrongodbout commented 8 years ago

Is any code available from chapter 6 particularly the Char RNN?

vgoklani commented 8 years ago

I'm looking for the chapter code 6 code too. Thanks!

samjabrahams commented 8 years ago

Hey guys! I'll do what I can to get it up in the next day or two!

vgoklani commented 8 years ago

Thanks! and thanks for writing the book!!! If you're even in NYC one day, let's grab coffee.

wfs commented 8 years ago

Really enjoying the book. Thank you! Looking forward to the Chapter 6 code.

samjabrahams commented 8 years ago

Just wanted to provide an update: this has not been forgotten! I'm just over halfway cleaning up the code and setting up to be run "out-of-the-box" from the repo. The past week has been nuts with travel.

SOON™

samjabrahams commented 8 years ago

I've gone through and added full, functioning-out-of-the-box code for chapter 6. I still want to clean up a few things as well as add Python 2 versions of everything (a few libraries shifted between 2.7 and 3+), but you can start toying around with the examples! Here's a generated arXiv abstract on a hastily trained network from the final example in the chapter:

Win on a Tesla K40c GPU benefiting deep learning framework for human posers for ternail arn performance representation performed sortimate visual smy practic of different types of recurrent also describes the distingy by trained Deep Neural Networks are describes the difter op ining state-yperformentank Neural Network (CNN) on 4 data sets, space. The provided as the state of the art method ob structures deep neural networks can be trained from ImageNet, and extract, search datasets than a conventio

cgmircea commented 7 years ago

Hi,

I tried to use the code from chapter 6 in an interactive python session, but I get the following error:

ValueError: Variable rnn/gru_cell/gates/kernel already exists, disallowed. Did you mean to set reuse=True in VarScope? Originally defined at:

File "", line 83, in prediction sequence_length=self.length, File "", line 65, in init self.prediction File "", line 173, in model = SequenceLabellingModel(data, target, params)

Any ideas? Thanks!

I have found a fix, by adding a reuse member and setting it in prediction like this: @property def prediction(self): output, _ = tf.nn.dynamic_rnn( tf.contrib.rnn.GRUCell(self.params.rnn_hidden, reuse=self.reuse), self.data, dtype=tf.float32, sequence_length=self.length, ) if not self.reuse: self.reuse = True

danijar commented 6 years ago

I also have a gist for a char-rnn in TensorFlow that works very similar to the one described in the book: https://gist.github.com/danijar/c70e7f7811231ce0cecceea76d07ffed

mupengX commented 6 years ago

i run the char-rnn code and got this ValueError: Dimensions must be equal, but are 400 and 283 for 'rnn/while/rnn/multi_rnn_cell/cell_0/cell _0/gru_cell/MatMul_2' (op: 'MatMul') with input shapes: [?,400], [283,400]. with tf version 1.4.1