Skip to content

Instantly share code, notes, and snippets.

@glyphx
glyphx / first gist
Created December 24, 2016 12:30
python is pretty damn cool
C:\Python27\python.exe "H:\PyCharm 2016.3.1\helpers\pydev\pydevconsole.py" 19146 19147
PyDev console: starting.
import sys; print('Python %s on %s' % (sys.version, sys.platform))
sys.path.extend(['C:\\Users\\glyph\\PycharmProjects\\hellopythonworld', 'C:/Users/glyph/PycharmProjects/hellopythonworld'])
Python 2.7.8 (default, Jul 2 2014, 19:50:44) [MSC v.1500 32 bit (Intel)] on win32
>>> print('%s %s' % (sys.version_info, sys.hexversion))
sys.version_info(major=2, minor=7, micro=8, releaselevel='final', serial=0) 34015472
>>> print('%s %s' % (sys.version_info, sys.api_version))
@glyphx
glyphx / cpu_gpu_test.py
Created January 2, 2017 15:10
gpu flag set
C:\toolkits\anaconda2-4.2.0\python.exe C:/toolkits/cpu_gpu_test.py
1 #define _CUDA_NDARRAY_C
2
3 #include <Python.h>
4 #include <structmember.h>
5 #include "theano_mod_helper.h"
6
7 #include <numpy/arrayobject.h>
8 #include <iostream>
9
@glyphx
glyphx / cnmem fail
Created January 2, 2017 16:39
THEANO_FLAGS with cnmem = .8 crashed me, .7 worked
C:\toolkits\anaconda2-4.2.0\python.exe C:/toolkits/cpu_gpu_test.py
ERROR (theano.sandbox.cuda): ERROR: Not using GPU. Initialisation of device gpu failed:
initCnmem: cnmemInit call failed! Reason=CNMEM_STATUS_OUT_OF_MEMORY. numdev=1
Traceback (most recent call last):
File "C:/toolkits/cpu_gpu_test.py", line 2, in <module>
from theano import function, config, shared, sandbox
File "C:\toolkits\anaconda2-4.2.0\lib\site-packages\theano-0.8.2-py2.7.egg\theano\__init__.py", line 111, in <module>
theano.sandbox.cuda.tests.test_driver.test_nvidia_driver1()
File "C:\toolkits\anaconda2-4.2.0\lib\site-packages\theano-0.8.2-py2.7.egg\theano\sandbox\cuda\tests\test_driver.py", line 38, in test_nvidia_driver1
nobody@home MINGW64 ~
$ env
USERDOMAIN_ROAMINGPROFILE=HOME
THEANO_FLAGS_GPU=floatX=float32,device=gpu,dnn.enabled=False,lib.cnmem=0.8,blas.ldflags=-LC:/toolkits/openblas-0.2.14-int32/bin -lopenblas
HOMEPATH=\Users\nobody
MANPATH=/mingw64/share/man:/usr/local/man:/usr/share/man:/usr/man:/share/man:
CUDA_PATH=C:\toolkits\cuda-8.0.44
APPDATA=C:\Users\nobody\AppData\Roaming
ProgramW6432=C:\Program Files
glyph@HOME:~$ env
SHELL=/bin/bash
TERM=xterm
USER=glyph
NAME=HOME
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc
@glyphx
glyphx / tensorFlowBackend.txt
Created January 2, 2017 17:50
Error you will get when you discover that keras uses a tensorflow backend by default
nobody@home MINGW64 /c/toolkits/keras-1.1.0 ((1.1.0))
$ cd /c/toolkits/keras-1.1.0/examples/
nobody@home MINGW64 /c/toolkits/keras-1.1.0/examples ((1.1.0))
$ python mnist_cnn.py
Using TensorFlow backend.
Traceback (most recent call last):
File "mnist_cnn.py", line 12, in <module>
from keras.datasets import mnist
File "C:\toolkits\anaconda2-4.2.0\lib\site-packages\keras-1.1.0-py2.7.egg\keras\__init__.py", line 2, in <mo dule>
@glyphx
glyphx / training.txt
Created January 2, 2017 18:14
First training
nobody@home MINGW64 /c/toolkits/keras-1.1.0/examples ((1.1.0))
$ python mnist_cnn.py
Downloading data from https://s3.amazonaws.com/img-datasets/mnist.pkl.gz
15220736/15296311 [============================>.] - ETA: 0sUsing Theano backend.
Using gpu device 0: GeForce GTX 980 (CNMeM is enabled with initial size: 60.0% of memory, cuDNN not available)
DEBUG: nvcc STDOUT mod.cu
Creating library C:/Users/nobody/AppData/Local/Theano/compiledir_Windows-10-10.0.14393-Intel64_Family_6_Model_60_Stepping_3_GenuineIntel-2.7.13-64/tmpxqdi46/17d95f3cf75925b527f3a5290fff5705.lib and object C:/Users/nobody/AppData/Local/Theano/compiledir_Windows-10-10.0.14393-Intel64_Family_6_Model_60_Stepping_3_GenuineIntel-2.7.13-64/tmpxqdi46/17d95f3cf75925b527f3a5290fff5705.exp
DEBUG: nvcc STDOUT mod.cu
Creating library C:/Users/nobody/AppData/Local/Theano/compiledir_Windows-10-10.0.14393-Intel64_Family_6_Model_60_Stepping_3_GenuineIntel-2.7.13-64/tmpke1cnd/3822e09213127a9018d8f73e171845df.lib and object C:/Users/nobody/AppData/Loc
@glyphx
glyphx / training.cuDNN.txt
Created January 2, 2017 20:41
980 matched titan
Creating library C:/Users/nobody/AppData/Local/Theano/compiledir_Windows-10-10.0.14393-Intel64_Family_6_Model_60_Stepping_3_GenuineIntel-2.7.13-64/tmpndc9wX_train shape: (60000L, 1L, 28L, 28L)
60000 train samples
10000 test samples
Train on 60000 samples, validate on 10000 samples
Epoch 1/12
60000/60000 [==============================] - 3s - loss: 0.3816 - acc: 0.8827 - val_loss: 0.1027 - val_acc: 0.9673
Epoch 2/12
60000/60000 [==============================] - 3s - loss: 0.1502 - acc: 0.9558 - val_loss: 0.0674 - val_acc: 0.9789
Epoch 3/12
60000/60000 [==============================] - 3s - loss: 0.1151 - acc: 0.9657 - val_loss: 0.0551 - val_acc: 0.9820
@glyphx
glyphx / lesson1.ipynb
Created January 12, 2017 06:02
First run through - 5 epoch's ~.985 value acc, ~.98 acc
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@glyphx
glyphx / lesson1.ipynb
Created January 12, 2017 06:08
fixed error
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.