GDLnotes
GDLnotes copied to clipboard
深度学习
可以在这里讨论深度学习相关问题
就我一个吗?
@tzengwei 暂时是酱:smile:
刚刚学了CNN,打算再看看RNN,希望楼主提供一些关于RNN/LSTM的论文,其他干货也可以啊^_^
你好,楼主,运行你的seq2seq 程序,报错,如下 ImportError: No module named not_mnist.img_pick
@chenjun0210 如果使用pycharm,需要把src目录设置为source directory,才能找到not_mnist包下的代码
我直接把你的工程下载到linux上,然后直接python seq2seq.py 执行,然后就出现我上面提到的错误。 我刚用pycharm,这个必须在linux安装的吧,然后把你的项目导入进来之后。设置src 为源目录就可以了是吗?tensorflow也可以直接用是吗?包括程序的debug都可以是吗?我之前用ipython notebook看程序。看感觉你这种方式更方便调试。谢谢,貌似是可以了。
@chenjun0210 需要先安装tensorflow,否则直接import tensorflow会出错的,
因为直接运行python seq2seq.py的时候,源代码目录就相当于是在rnn这个目录下了 可以试一下cd 到src目录下,然后
/home/cwh/.conda/envs/tensorflow/bin/python convnet/conv_mnist.py
其中
/home/cwh/.conda/envs/tensorflow/bin/python
是安装了tensorflow的python的路径
恩恩,好的,非常感谢啊。我尝试用pycharm运行吧,方便调试开发。
@GuZhebin http://colah.github.io/posts/2015-08-Understanding-LSTMs/ 可以看下这个LSTM的文章,写的很好
大神能不能看一下这个错误是怎么回事/? 函数代码:
def _generate_image_and_label_batch(image, label, min_queue_examples, batch_size, shuffle):
num_preprocess_threads = 10
if shuffle:
images, label_batch = tf.train.shuffle_batch(
[image, label],
batch_size = batch_size,
num_threads = num_preprocess_threads,
#capacity = min_queue_examples,
capacity = min_queue_examples + 3 * batch_size,
min_after_dequeue = min_queue_examples
)
else:
images, label_batch = tf.train.batch(
[image, label],
batch_size = batch_size,
num_threads = num_preprocess_threads,
#capacity = min_queue_examples,
capacity = min_queue_examples + 3 * batch_size
)
#Display the training images in the visualizer
tf.image_summary('images', images)
return images, tf.reshape(label_batch, [batch_size])
tensorflow.python.framework.errors.OutOfRangeError: FIFOQueue '_2_batch/fifo_queue' is closed and has insufficient elements (requested 40, current size 0)
[[Node: batch = QueueDequeueMany[component_types=[DT_FLOAT, DT_INT32], timeout_ms=-1, _device="/job:localhost/replica:0/task:0/cpu:0"](batch/fifo_queue, batch/n)]]
Caused by op u'batch', defined at:
File "/home/yang/recognition/train.py", line 109, in <module>
tf.app.run()
File "/home/yang/.local/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 30, in run
sys.exit(main(sys.argv))
File "/home/yang/recognition/train.py", line 106, in main
train()
File "/home/yang/recognition/train.py", line 34, in train
images, labels = inference.distorted_inputs()
File "/home/yang/recognition/inference.py", line 93, in distorted_inputs
return input_data.distorted_inputs(data_dir=data_dir, batch_size=FLAGS.batch_size)
File "/home/yang/recognition/input_data.py", line 116, in distorted_inputs
return _generate_image_and_label_batch(float_image, read_input.label, min_queue_examples, batch_size, shuffle=False)
File "/home/yang/recognition/input_data.py", line 59, in _generate_image_and_label_batch
capacity = min_queue_examples + 3 * batch_size
File "/home/yang/.local/lib/python2.7/site-packages/tensorflow/python/training/input.py", line 544, in batch
dequeued = queue.dequeue_many(batch_size, name=name)
@yangkun1993 有点像是你的数据集有问题,image可能是空的(看第一行的size 0),然后在执行batch的时候batch_size 为40大于0,所以报out of range
请问udacity的deep learning中Lenet5模型有实现吗?最近在对照你的代码学习这个课程,作业做到Lenet5的地方卡住了
@tyr2000 Lenet5的模型跟我的代码里的cnn部分很像,都是卷积层套pool套mlp,只不过具体超参数可以自己调整,可以参考Lesson3的代码看看
谢谢,我还没有看lesson3. 有问题再想你请教
@ahangchen 请教大神: https://github.com/sherjilozair/char-rnn-tensorflow/blob/master/model.py 这个项目里,weight的更新算法是:
def weighted_pick(weights):
t = np.cumsum(weights)
s = np.sum(weights)
return(int(np.searchsorted(t, np.random.rand(1)*s)))
请问,是否可以用 beam search 来优化呢?如果可以的话,beam search 要怎么实现呢?有没有相关的例子?求助~~~
@sunxiaobiu 按我的理解 beam search是一种预测的策略,不是权重更新的策略,预测多个字符就是beam search,你的sample函数的是用在哪里的呢?没有找到调用的地方,如果你现在是单字符预测的话,改成多字符预测就算是用上beam search了
@ahangchen sample函数用在sample.py里面:https://github.com/sherjilozair/char-rnn-tensorflow/blob/master/sample.py
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--save_dir', type=str, default='save',
help='model directory to store checkpointed models')
parser.add_argument('-n', type=int, default=500,
help='number of characters to sample')
parser.add_argument('--prime', type=text_type, default=u' ',
help='prime text')
parser.add_argument('--sample', type=int, default=1,
help='0 to use max at each timestep, 1 to sample at each timestep, 2 to sample on spaces')
args = parser.parse_args()
sample(args)
def sample(args):
with open(os.path.join(args.save_dir, 'config.pkl'), 'rb') as f:
saved_args = cPickle.load(f)
with open(os.path.join(args.save_dir, 'chars_vocab.pkl'), 'rb') as f:
chars, vocab = cPickle.load(f)
model = Model(saved_args, True)
with tf.Session() as less:
tf.initialize_all_variables().run()
saver = tf.train.Saver(tf.all_variables())
ckpt = tf.train.get_checkpoint_state(args.save_dir)
if ckpt and ckpt.model_checkpoint_path:
saver.restore(sess, ckpt.model_checkpoint_path)
print(model.sample(sess, chars, vocab, args.n, args.prime, args.sample))
if __name__ == '__main__':
main()
现在是单字符预测,如何改成多字符预测呢?tensorflow有现成的beam search 方法可以调用的吗?还是要自己开发? 如果不是放在权重更新的方法里面的话,要在放在哪一部分代码里面的?要怎么去评估用了beam search,和没有用beam search两种情况的结果好坏呢?
@sunxiaobiu 据我所知没有现成的beam search,要实现这种多字符的预测,在做word embedding的时候就要从多字符做起,多字符的代码可以看这个
楼主 ,想问下 谷歌在udacity 上的那个深度学习视频,我下载了他们提供的视频和字幕,但是木有中文字幕啊,想问下 你有吗,谢谢
@skyoflovehc 我这里只有英文的字幕,链接在笔记里有,其实那些英文都是这个领域常见的词,建议看英文,看的时候查一查也增强一下理解
有微信群吗,一个人学习很艰难啊,没有的话我发一个
大神: 您好, 我想问下 我这个word2vec 里我在window下用python3.5运行的时候一直报错 在教学的时候没有报错 教学用的ubantu 这是怎么回事 是python 版本的问题吗
with graph.as_default():
train_inputs = tf.placeholder(tf.int32, shape=[batch_size])
train_labels = tf.placeholder(tf.int32, shape=[batch_size, 1])
valid_dataset = tf.constant(valid_examples, dtype=tf.int32)
with tf.device('/cpu:0'): embeddings = tf.Variable( tf.random_uniform([vocabulary_size, embedding_size], -1.0, 1.0)) embed = tf.nn.embedding_lookup(embeddings, train_inputs)
nce_weights = tf.Variable(
tf.truncated_normal([vocabulary_size, embedding_size],
stddev=1.0 / math.sqrt(embedding_size)))
nce_biases = tf.Variable(tf.zeros([vocabulary_size]))
loss = tf.reduce_mean(
tf.nn.nce_loss(nce_weights, nce_biases, embed, train_labels,num_sampled, vocabulary_size))
报错信息: Input 'y' of 'Mul' Op has type float32 that does not match type int32 of argument 'x'
@Prayforhanluo 不是python版本的问题,是你的输入x和y的类型不匹配,可以把x也转为float32再去进行那个mul的乘操作
请问下你的数据是在哪里可以下载?
@flaght Lesson 1中简要介绍了notMNIST,有下载链接
请问下你画草图用是什么软件?是PC端还是移动端?如下图: https://github.com/ahangchen/GDLnotes/blob/master/res/cross-entropy.png
@flaght 这个是Google的视频教程里截图下来的,并不是我画的哦
请问你说的google视频教程在哪里可以看到?
@flaght 每个lesson对应的note都把视频地址放在最上面了
由于这个教程对应的是TensorFlow0.8的版本,而现在TensorFlow已经有很多的改动,5月20日后会开始重构改成与新API兼容的版本 (已重构完成)