Direkt zum Hauptbereich

Deep Learning mit Linux

So I want to have a simplistic but fully featured ML setup
my specs:
  • needed python version
  • conda instead of pip (as long as possible)
  • linux os
  • tensorflow
  • keras
  • jupyter notebooks
  • pycharm IDE
I am following
https://www.pyimagesearch.com/2019/12/09/how-to-install-tensorflow-2-0-on-ubuntu/
(to lengthy / decided not to use gpu for teaching myself)
instead I used straightforward:
  • https://www.tensorflow.org/install/
  • tensorflow hello world (didn't get it running!)
    •  https://github.com/aymericdamien/TensorFlow-Examples/blob/master/examples/1_Introduction/helloworld.py
      • following error apeared, couln't solve: 
      • sess = tf.Session()
        Traceback (most recent call last):
          File "<stdin>", line 1, in <module>
        AttributeError: module 'tensorflow' has no attribute 'Session'
      • cpu tensorflow/stream_executor/cuda/cuda_driver.cc:351] failed call to cuInit: UNKNOWN ERROR (303)
  • https://keras.io/getting-started/sequential-model-guide/
  • keras- hello world: 
    • https://gist.github.com/Orbifold/3f51f3c21d348873f4025813bfcf5614
confused me:
  • not to use python2.7 but  python3.7
  • to use pip instead of pip2

install Pycharm best by Ubuntu Softwarestore
  1. install python3
  2. pip install virtualenv # install virtual environments
  3. #for each projet: create environment
    • mkdir project ; cd project
    • python3 -m venv venv
    • source venv/bin/activate
  4. pip install tensorflow
  5. pip install keras
  6. pip install ipykernel
  7. python -m ipykernel install --user --name=venv # install ipykernel
in Jupyter change kernel to virtual envirionment click:
Kernel->chang kernel->venv

Keras has become a part of tensorflow. The book's code must be adapted:
replace
  • import keras
by
  • import tensorflow.keras as keras
Everything then should work fine.

Otherwise, you can replace each code of keras:

Access keras functionality through tensorflow:
instead of
  • import keras
  • model = keras.Sequential()
do
      • import tensorflow as tf
      • model = tf.keras.Sequential()
With these instructions everything should work out of the box


To start jupyter:
  • jupyter notebook



To leave environment
 deactivate

a good 

Kommentare