Showing posts with label: python. Show all posts.

TensorFlow GPU Errors on Windows

Monday 12 February 2018

I have been loving TensorFlow lately and have installed tensorflow-gpu on my Windows 10 laptop. Given that the GPU on my laptop is not a really great one I have run into quite a few issues, most of which I have solved. My GPU is an Nvidia GeForce GT 750M with 2GB of RAM and I am running the latest release of tensorflow as of February 2018, with Python 3.6. 

If you are running into errors I would suggest you try these things in this order:

  1. Try reducing the batch size for training AND validation. I always use batches for training but would evaluate on the validation data all at once. By using batches for validation and averaging the results I am able to avoid most of the memory errors.
  2. If this doesn't work try to restrict the amount of GPU RAM available to tensorflow with config.gpu_options.per_process_gpu_memory_fraction = 0.7
    which restricts the amount  available to 70%. Note that I am unable to ever run the GPU with the memory fraction above 0.7
  3. If all else fails turn the GPU off and use the CPU: 
    config = tf.ConfigProto()
    config = tf.ConfigProto(device_count = {'GPU': 0})

The difference between using the CPU and the GPU is like night and day... With the CPU it takes all day to train through 20 epochs, with the GPU the same can be done in a few hours. I think the main roadblock with my GPU is the amount of RAM, which can easily be managed by controlling the batch size and the config settings above. Just remember to feed the config into the session.

Labels: python, data_science, machine_learning, tensor_flow
No comments

Django

Wednesday 27 September 2017

I have really been loving Django lately, and I wrote another version of this site in it. That site is skooch.com. The new site uses the same database as this one, so the only real difference is the language they are written in.

I find Python to be a much more opinionated and formal language than PHP, which makes it a steeper learning curve, but it forces you to think things through a bit more. I find the extra effort to be well worth it in the end as far as code quality goes. 

As a note the Python code was significantly shorter than the same code in PHP, for whatever that is worth.

 

Labels: coding, python, django
No comments

Python mysqlclient for Django on Windows

Wednesday 06 September 2017

I had been using SQLLite with Django for quite some time because I couldn't get mysqlclient for windows to install properly with pip. SQLLite was fine for local development, but before I deploy an app I wanted to get MySQL working.

It turns out it was very easy:

pip install mysqlclient==1.3.9

That's all I need to do! I had tried downloading wheels and all sorts of other stuff, none of which worked, but version 1.3.9 installs fine with no errors on Windows 10.

Labels: coding, python, django
No comments

Archives