Skip to content

Instantly share code, notes, and snippets.

@rlan
rlan / my_tensorflow_keras_installation_in_virtual_environment.md
Last active December 19, 2018 11:55
My TensorFlow and Keras installation in virtual environment
  1. Create virtual environment
virtualenv -p /usr/local/bin/python3 my_project
source my_project/bin/activate
  1. Install tensorflow
  2. Install the following in the virtual environment:
@rlan
rlan / setup_python_logging.md
Last active August 28, 2018 00:37
Setup python logging

Global

import logger
def setupLogging():
    """
    setup logging
    """
    logger = logging.getLogger('app')
 logger.setLevel(logging.DEBUG)
@rlan
rlan / tensorflow_speed_comparison.md
Last active August 9, 2018 07:36
tensorflow speed comparison
MNIST Plain AVX+FMA+SSE Intel MKL-DNN
Train (s) 83.375 64.026 77.266
Evaluation (s) 3.50 3.47 6.107
  • Tensorflow 1.9.0
  • Macbook Pro 13", 2016, 2.4 GHz Intel Core i7, 16 GB RAM, macOS Sierra
import tensorflow as tf
@rlan
rlan / show_long_name_of_nvidia_gpu.md
Created August 9, 2018 00:48
Show long name of Nvidia GPU

nvidia-smi -q | grep Product

Product Name                    : GeForce GTX 1080 Ti
Product Brand                   : GeForce
Product Name                    : GeForce GTX 1080 Ti
Product Brand                   : GeForce
Product Name                    : GeForce GTX 1080 Ti
Product Brand                   : GeForce
Product Name : GeForce GTX 1080 Ti
@rlan
rlan / check_installed_cuda_version.md
Last active August 7, 2018 01:24
How to check installed CUDA version
nvcc --version
@rlan
rlan / gpu_selection_in_jupyter.md
Created July 5, 2018 07:38
GPU selection in Jupyter

You can do it faster without any imports just by using magics:

%env CUDA_DEVICE_ORDER=PCI_BUS_ID
%env CUDA_VISIBLE_DEVICES=0

Notice that all env variable are strings, so no need to use ". You can verify that env-variable is set up by running: %env <name_of_var>. Or check all of them with %env.

@rlan
rlan / force_git_to_ask_user_name_and_info.md
Created June 25, 2018 12:37
Force git to ask for user name and email
@rlan
rlan / choose_gpu_via_command_line.md
Last active June 15, 2018 06:34
Choose GPU via command line
@rlan
rlan / ignore_output_python_doctest.md
Created June 13, 2018 07:20
Ask python doctest to ignore output

Some functions return the self object. In this case, the object is an instance at an address. We want to ignore this output:

I found it easier to simply assign the unneeded return values to a variable:

>>> _ = do_something()
>>> check_something()
True

https://stackoverflow.com/a/22537703/1704566