Skip to content

Instantly share code, notes, and snippets.

@chakkritte
Created March 30, 2017 13:05
Show Gist options
  • Save chakkritte/2e41be656e0a7390dc2bf3535262c166 to your computer and use it in GitHub Desktop.
Save chakkritte/2e41be656e0a7390dc2bf3535262c166 to your computer and use it in GitHub Desktop.
Deep learning Ep. 5 : [New] Install Tensorflow with CUDA, CUDNN and Keres on Windows : https://www.youtube.com/watch?v=Rmjp1yFi9Ok
1. Install CUDA v8.0 toolkit --> https://developer.nvidia.com/cuda-downloads
2. Install cuDNN v5.1 for CUDA 8.0 --> https://developer.nvidia.com/rdp/cudnn-download
3. Install GIT 64-bit -> https://git-scm.com/download/win
4. Install Anaconda3-4.2.0 --> https://repo.continuum.io/archive/Anaconda3-4.2.0-Windows-x86_64.exe
5. Open windows command terminal
- conda create -n tensorflow
- activate tensorflow
- pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-1.0.1-cp35-cp35m-win_amd64.whl
6. Validate your installation (Open windows command terminal )
- python
- import tensorflow as tf
- hello = tf.constant('Hello, TensorFlow!')
- sess = tf.Session()
- print(sess.run(hello))
7. Install Keras
- git clone git://github.com/fchollet/keras.git
- cd keras
- python setup.py develop
8. Test Keras
- cd ..
- python test.py
Good bye !!!!
from keras.models import Sequential
from keras.layers import Dense, Dropout, Activation
from keras.optimizers import SGD
import numpy as np
data_dim = 100
nb_classes = 10
model = Sequential()
model.add(Dense(32, input_dim=data_dim,init='uniform'))
model.add(Activation('relu'))
model.add(Dropout(0.5))
model.add(Dense(64, input_dim=data_dim, init='uniform'))
model.add(Activation('relu'))
model.add(Dropout(0.5))
model.add(Dense(nb_classes, init='uniform'))
model.add(Activation('softmax'))
model.compile(loss='categorical_crossentropy',
optimizer='sgd',
metrics=["accuracy"])
# generate dummy training data
x_train = np.random.random((1000, data_dim))
y_train = np.random.random((1000, nb_classes))
# generate dummy test data
x_test = np.random.random((100, data_dim))
y_test = np.random.random((100, nb_classes))
model.fit(x_train, y_train,
nb_epoch=50,
batch_size=128)
score = model.evaluate(x_test, y_test, batch_size=16)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment