Git Product home page Git Product logo

tensorlayer-chinese's Introduction

Chinese Documentation Chinese Book Downloads

TensorLayer是一个崭新的基于TensorFlow的深度学习与增强学习开发库。它提供大量的神经网络相关组件和函数来帮助顶尖研究人员和一线工程师解决复杂的人工智能问题。 本仓库维护了TensorLayer的中文文档。相对于英文文档,中文文档会有一定滞后性。

TensorLayer拥有大量的华人使用者和开发者。官方的中文社群包括了QQ群微信群进行广泛的讨论。官方英文渠道是Slack。申请加入这些社群时,请star官方项目,并告知github用户名。

tensorlayer-chinese'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  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

tensorlayer-chinese's Issues

mnist float16例子在tf1.4 tl1.7.1下测试不通过

Conv2d(n, 64, (5, 5), (1, 1), padding='SAME', name='cnn2')
这个函数Conv2d的W_init_args = {}, b_init_args = {}参数没有根据输入加入dtype,而参数初始化本身是做float32的,导致了无法运行。
需加入W_init_args={"dtype":tf.float16},b_init_args={"dtype":tf.float16}参数

tutorial_*.py 也需要更新

帅哥,我电脑wechat掉线了,在公海上手机没法scan QR code了。。突然发现没有你的邮箱,有事Line或邮件联系。。

python3.6环境下导入出错

/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/importlib/_bootstrap.py:205: RuntimeWarning: compiletime version 3.5 of module 'tensorflow.python.framework.fast_tensor_util' does not match runtime version 3.6
return f(*args, **kwds)

是3.6版本的python不兼容吗

Confusion in source code of layers.seq2seq

When I look at the source code of tl.layers.seq2seq, something confused me. In traditional seq2seq model, the encode part should return the last output instead of all output. But in the "network_encode" part, “return_last” has been set to "False", that means encode part will return all outputs. Why? Isn't it better to set "return_last=True"? Thanks!
(英文水平不怎么好,所以还是对问题加一段中文翻译好了:经典seq2seq模型的encode部分应该是前面隐藏单元的加权,并输出最后一个unit。但tl.layers.seq2seq源代码中network_encode部分,用DynamicRNNLayer函数进行编码,return_last函数被设置为False,是否意味着encode部分会输出所有单元呢?为什么不是设为True只输出最后一个呢?)

关于 RNN 输入形状的问题

我在最新的官方文档上看到 RNN 的输入形状是这样的 [time_steps, batch_size, num_features],它的 batch 在第二维,因为同时给出了一个例子,应该不是输入错误;
然后我看到 TL 的文档里输入是 [batch_size, n_steps, n_features]
是TL在内部重新做了处理吗,还是两种都可以?

most recent call last

num of params: 1276810
layer 0: Tensor("drop1/mul:0", shape=(?, 784), dtype=float32)
layer 1: Tensor("relu1/Relu:0", shape=(?, 800), dtype=float32)
layer 2: Tensor("drop2/mul:0", shape=(?, 800), dtype=float32)
layer 3: Tensor("relu2/Relu:0", shape=(?, 800), dtype=float32)
layer 4: Tensor("drop3/mul:0", shape=(?, 800), dtype=float32)
layer 5: Tensor("output_layer/Identity:0", shape=(?, 10), dtype=float32)
learning_rate: 0.000100
batch_size: 128
Epoch 1 of 1 took 1.700945s
train loss: 0.439682
val loss: 0.384359
val acc: 0.880900
Traceback (most recent call last):
File "tutorial_mnist.py", line 562, in
main_test_layers(model='relu') # model = relu, dropconnect
File "tutorial_mnist.py", line 154, in main_test_layers
to save the feature images for different dataset")
Exception: You should change visualize_W(), if you want to save the feature images for different dataset

当使用分布式session的时候无法使用checkpoint

当我用文档提供的例子tutorial_mnist_distributed做实验的时候,我发现当我把创建Session的代码改为:
with tl.distributed.DistributedSession(task_spec=task_spec,checkpoint_dir="checkpoint",save_checkpoint_secs=1000,save_summaries_steps=100,save_summaries_secs=None) as sess:
这时候会出现RuntimeError:"Global step should be created to use StepCounterHook."
另外单独指定task_spec和checkpoint_dir属性也会报错,
tl.distributed.DistributedSession(task_spec=task_spec,checkpoint_dir="checkpoint") as sess:
TypeError: unorderable types: object() > int()
这个错误可以通过指定save_summaries_steps和save_summaries_secs解决。
感觉tensorlayer对分布式的支持并不成熟,有很多问题。

Translation in tutorial.rst

  • Autoencoder is a unsupervised learning models which able to extract representative features, it has become more widely used for learning generative models of data and Greedy layer-wise pre-train.
  • 自编码器是一种能够提取具有代表性特征的无监督(Unsupervised)学习模型,
    它已经广泛使用于数据生成模式的学习逐层贪婪的预训练(Greedy layer-wise pre-train)。
  • Since every layer knows its immediate incoming layers, the output layer (or output layers) of a network double as a handle to the network as a whole, so usually this is the only thing we will pass on to the rest of the code.
  • 由于每一层都知道它在一个网络中的直接输入层和(多个)输出接收层,**网络的输出层 double as a handle 对于网络作为一个整体,**所以通常这是我们唯一要传递给其他代码的内容。

重点在加粗的部分,有没有更加合适的翻译?

MNIST MLP 例子需要的 operators

以TF为参考:

  • tf.Variable
  • tf.nn.bias_add
  • tf.matmul
  • tf.nn.relu
  • tf.nn.dropout
  • tf.reduce_mean
  • tf.nn.sparse_softmax_cross_entropy_with_logits
  • tf.optimizers.Adam

TF求导例子:

optimizer = tf.optimizers.Adam(learning_rate=0.0001)
with tf.GradientTape() as tape:
            ## compute outputs
            _logits = MLP(X_batch, foo=1)
            ## compute loss and update model
            _loss = tl.cost.cross_entropy(_logits, y_batch, name='train_loss')

grad = tape.gradient(_loss, MLP.weights)
optimizer.apply_gradients(zip(grad, MLP.weights))

服务器中报异常:QXcbConnection: Could not connect to display

我在 windows下通过 xshell 访问 centos,在 centos 中运行 example 中的 tutorial_mnist.py 就报异常了:QXcbConnection: Could not connect to display
原因应该是服务器中不能运行 GUI 程序
错误的位置应该是 tutorial_mnist.py 中第 390 行左右用到的 tl.visualize ,再进去就是 tl.visualize 这个文件中的 import matplotlib.pyplot as plt
我的解决方法:在 tl.visualize 源码中把被注释掉的 matplotlib.use('Agg') 去掉注释,就可以了。
现在我想请问一下有没有其他途径可以解决这个问题呢?

what went wrong in this code to fine-tune

def train(x_data, y_data):

x_train, y_train, x_valid, y_valid = split_data(x_data, y_data)

# train
#
sess = tf.InteractiveSession()
x = tf.placeholder(tf.float32, (None, 227, 227, 3))
y_ = tf.placeholder(tf.int64, (None, 17))
net = model_alexnet(x, 17)
y = net.outputs

# define cost and metric
cost = tl.cost.cross_entropy(y, tf.argmax(y_, 1), name='cost')
correct_predic = tf.equal(tf.argmax(y, 1), tf.argmax(y_, 1))
acc = tf.reduce_mean(tf.cast(correct_predic, tf.float32))
# y_op = tf.argmax(tf.nn.softmax(y))
train_op = tf.train.AdamOptimizer(1e-5).minimize(cost)

tl.layers.initialize_global_variables(sess)

# 导入参数 --> 用同一段代码训练过得参数继续训练,提示load success但是fit的时候正确率还是从很
# 低开始,像是从头开始训练了
#
if os.path.isfile('net_params.npz'):
    print('load pre-train params...')
    tl.files.load_and_assign_npz(sess, 'net_params.npz', net)

tl.utils.fit(sess, net, train_op, cost, x_train, y_train, x, y_,
             acc, batch_size=32, n_epoch=100, print_freq=10,
             X_val=x_valid, y_val=y_valid, eval_train=True, tensorboard=True)
tl.files.save_npz(net.all_params, name='net_params.npz', sess=sess)
sess.close()

如上注释...

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.