提交 2549aaed authored 作者: Frederic's avatar Frederic

Some update.

上级 27303a1f
.. _omlw2014_libgpundarray: .. _omlw2014_libgpuarray:
************* ***********
libGpuNdArray libgpuarray
************* ***********
Why a common GPU ndarray? Why a common GPU ndarray?
------------------------- -------------------------
...@@ -36,7 +36,6 @@ Design Goals ...@@ -36,7 +36,6 @@ Design Goals
Final Note Final Note
---------- ----------
TODO: update - Usable directly, but not all implementation available.
- Usable, but under development. - Is the next GPU array container for Theano and is working (not all implementation available now)
- Is the next GPU array container for Theano
- Mailing list: http://lists.tiker.net/listinfo/gpundarray - Mailing list: http://lists.tiker.net/listinfo/gpundarray
.. _omlw2014_index: .. _omlw2014_index:
=========================== ====================================================
Theano Tutorial @ OMLW 2014 Theano/Pylearn2/libgpuarray Presentation @ OMLW 2014
=========================== ====================================================
August 22, 2014, New York University, US. August 22, 2014, New York University, US.
This presentation will talk about Theano, Pylearn2 software stack for Theano, Pylearn2 and libgpuarray software stack for machine learning.
machine learning.
It complements the Python numeric/scientific software stack (e.g. NumPy, SciPy, It complements the Python numeric/scientific software stack (e.g. NumPy, SciPy,
scikits, matplotlib, PIL.) scikits, matplotlib, PIL.)
...@@ -35,11 +34,12 @@ The result is a very good library for doing research in deep ...@@ -35,11 +34,12 @@ The result is a very good library for doing research in deep
learning and neural network training, and a flexible framework for learning and neural network training, and a flexible framework for
many other models and algorithms in machine learning more generally. many other models and algorithms in machine learning more generally.
# TODO UPDATE
It has proven to be useful for implementing: It has proven to be useful for implementing:
- linear and nonlinear neural network classifiers - linear and nonlinear neural network classifiers
- including Maxout, Dropout
- convolutional models - convolutional models
- Energy models: RBM, DBN, GRBM, ssRBM, AIS - Energy models: RBM, DBN, GRBM, ssRBM, AIS
...@@ -58,8 +58,8 @@ It has proven to be useful for implementing: ...@@ -58,8 +58,8 @@ It has proven to be useful for implementing:
As people's needs change this list will grow, but Theano is built As people's needs change this list will grow, but Theano is built
around vector, matrix, and tensor expressions; there is little reason around vector, matrix, and tensor expressions; there is little reason
to use it for calculations on other data structures except. There is to use it for calculations on other data structures except. It
also sparse matrix support. also support sparse matrix.
Pylearn2 Pylearn2
...@@ -83,7 +83,7 @@ Pylearn2 Vision ...@@ -83,7 +83,7 @@ Pylearn2 Vision
too much top-down planning in advance. too much top-down planning in advance.
* A machine learning toolbox for easy scientific experimentation. * A machine learning toolbox for easy scientific experimentation.
* All models/algorithms published by the LISA lab should have reference * All models/algorithms published by the LISA lab should have reference
implementations in Pylearn2. implementations in Pylearn2. TODO REMOVE???
* Pylearn2 may wrap other libraries such as scikits.learn when this is practical * Pylearn2 may wrap other libraries such as scikits.learn when this is practical
* Pylearn2 differs from scikits.learn in that Pylearn2 aims to provide great * Pylearn2 differs from scikits.learn in that Pylearn2 aims to provide great
flexibility and make it possible for a researcher to do almost anything, flexibility and make it possible for a researcher to do almost anything,
...@@ -99,6 +99,37 @@ Pylearn2 Vision ...@@ -99,6 +99,37 @@ Pylearn2 Vision
* Remain approachable enough to be used in the classroom * Remain approachable enough to be used in the classroom
libgpuarray
===========
Make a common GPU ndarray(matrix/tensor or n dimensions) that can be
reused by all projects. It support CUDA and OpenCL.
Motivation
----------
* Currently there are at least 6 different gpu arrays in python
* CudaNdarray(Theano), GPUArray(pycuda), CUDAMatrix(cudamat), GPUArray(pyopencl), Clyther, Copperhead, ...
* There are even more if we include other languages.
* They are incompatible
* None have the same properties and interface.
* All of them are a subset of numpy.ndarray on the gpu!
Design Goals
------------
* Have the base object in C to allow collaboration with more projects.
* We want people from C, C++, ruby, R, ... all use the same base GPU ndarray.
* Be compatible with CUDA and OpenCL.
* Not too simple, (don't support just matrix).
* But still easy to develop new code that support only a few memory layout.
* This easy the development of new code.
Contents Contents
======== ========
......
...@@ -79,51 +79,6 @@ NumPy in one slide ...@@ -79,51 +79,6 @@ NumPy in one slide
Arrays can be combined with numeric operators, standard mathematical Arrays can be combined with numeric operators, standard mathematical
functions. NumPy has great `documentation <http://docs.scipy.org/doc/numpy/reference/>`_. functions. NumPy has great `documentation <http://docs.scipy.org/doc/numpy/reference/>`_.
Training an MNIST-ready classification neural network in pure NumPy might look like this:
.. code-block:: python
#########################
# NumPy for Training a
# Neural Network on MNIST
#########################
x = np.load('data_x.npy')
y = np.load('data_y.npy')
w = np.random.normal(
avg=0,
std=.1,
size=(784, 500))
b = np.zeros((500,))
v = np.zeros((500, 10))
c = np.zeros((10,))
batchsize = 100
for i in xrange(1000):
x_i = x[i * batchsize: (i + 1) * batchsize]
y_i = y[i * batchsize: (i + 1) * batchsize]
hidin = np.dot(x_i, w) + b
hidout = np.tanh(hidin)
outin = np.dot(hidout, v) + c
outout = (np.tanh(outin) + 1) / 2.0
g_outout = outout - y_i
err = 0.5 * np.sum(g_outout) ** 2
g_outin = g_outout * outout * (1.0 - outout)
g_hidout = np.dot(g_outin, v.T)
g_hidin = g_hidout * (1 - hidout ** 2)
b -= lr * np.sum(g_hidin, axis=0)
c -= lr * np.sum(g_outin, axis=0)
w -= lr * np.dot(x_i.T, g_hidin)
v -= lr * np.dot(hidout.T, g_outin)
What's missing? What's missing?
--------------- ---------------
...@@ -236,7 +191,29 @@ Project status ...@@ -236,7 +191,29 @@ Project status
* Github (`bleeding edge` repository, the one recommanded): unknown * Github (`bleeding edge` repository, the one recommanded): unknown
* Github stats????? * TODO: Github stats?????
Pylearn2 in one slide
---------------------
TODO
Other global information
------------------------
Theano have small basic operation, not layers as base operation:
* Easy reuse
* Don't need to reimplement the grad for each variation of layers
This could cause slowness (more small operation), but the optimizer fix that.
Pylearn2 wrap the small operations into layers like other
projects:
* There is no overhead to this extra layer, due to the
compilation of the function by Theano.
Why scripting for GPUs? Why scripting for GPUs?
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
Sharing code Sharing code
************ ************
* License * License (BSD 3 clauses suggested, don't forget to add the license info in the code)
* Common base object? * Common base object? libgpuarray.
* If not, important implementation that use raw ptr/shape? * If not, important implementation that use raw ptr/shape? Doc that interface.
* Important, acknowledgement section on web site AND in paper about the software. * Important, *acknowledgement section on web site*(citation like) AND *in paper* about the software we reuse! (and use too)
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论