基于Theano的可擴展深度學習框架:deepy
基于Theano的可擴展深度學習框架deepy。
Dependencies
- Python 2.7 (Better on Linux)
- numpy
- theano
- scipy for L-BFGS and CG optimization </ul>
Clean interface
# MNIST Multi-layer model with dropout. from deepy.dataset import MnistDataset, MiniBatches from deepy.networks import NeuralClassifier from deepy.layers import Dense, Softmax, Dropout from deepy.trainers import MomentumTrainer, LearningRateAnnealermodel = NeuralClassifier(input_dim=28*28) model.stack(Dense(256, 'relu'), Dropout(0.2), Dense(256, 'relu'), Dropout(0.2), Dense(10, 'linear'), Softmax())
trainer = MomentumTrainer(model)
annealer = LearningRateAnnealer(trainer)
mnist = MiniBatches(MnistDataset(), batch_size=20)
trainer.run(mnist, controllers=[annealer])</pre>
Examples
Enviroment setting
- CPU </ul>
source bin/cpu_env.sh
- GPU </ul>
source bin/gpu_env.sh
MNIST Handwriting task
- Simple MLP </ul>
python experiments/mnist/mlp.py
- MLP with dropout </ul>
python experiments/mnist/mlp_dropout.py
- MLP with PReLU and dropout </ul>
python experiments/mnist/mlp_prelu_dropout.py
- Deep convolution </ul>
python experiments/mnist/deep_convolution.py
- Elastic distortion </ul>
python experiments/mnist/mlp_elastic_distortion.py
- Recurrent visual attention model
- Result visualization </ul> </li> </ul>
python experiments/attention_models/baseline.py
Language model
Penn Treebank benchmark
- Baseline RNNLM (Full-output layer) </ul>
python experiments/lm/baseline_rnnlm.py
- Class-based RNNLM </ul>
python experiments/lm/class_based_rnnlm.py
- LSTM based LM (Full-output layer) </ul>
python experiments/lm/lstm_rnnlm.py
Char-based language models
- Char-based LM with LSTM </ul>
python experiments/lm/char_lstm.py
- Char-based LM with Deep RNN </ul>
python experiments/lm/char_rnn.py
Deep Q learning
- Start server </ul>
pip install Flask-SocketIO python experiments/deep_qlearning/server.py
- Open this address in browser </ul>
http://localhost:5003
Auto encoders
- Recurrent NN based auto-encoder </ul>
python experiments/auto_encoders/rnn_auto_encoder.py
- Recursive auto-encoder </ul>
python experiments/auto_encoders/recursive_auto_encoder.py
Train with CG and L-BFGS
- CG </ul>
python experiments/scipy_training/mnist_cg.py
- L-BFGS </ul>
python experiments/scipy_training/mnist_lbfgs.py
Other experiments
DRAW
See https://github.com/uaca/deepy-draw
# Train the model python mnist_training.py # Create animation python animation.py experiments/draw/mnist1.gz
Highway networks
python experiments/highway_networks/mnist_baseline.py python experiments/highway_networks/mnist_highway.py
Effect of different initialization schemes
python experiments/initialization_schemes/gaussian.py python experiments/initialization_schemes/uniform.py python experiments/initialization_schemes/xavier_glorot.py python experiments/initialization_schemes/kaiming_he.py
Other features
- Auto gradient correction
Sorry for that deepy is not well documented currently, but the framework is designed in the spirit of simplicity and readability. This will be improved if someone requires.
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!