venerdì 13 dicembre 2019

Tensorflow on Docker

Oltre ad usare Tensorflow in un virtualenv si puo' impiegare anche un Docker (per una configurazione in modalita' GPU e' anche piu' semplice ) che deriva da una immagine Ubuntu
Si installa tramite

docker pull tensorflow/tensorflow 

Using default tag: latest
latest: Pulling from tensorflow/tensorflow
5667fdb72017: Pull complete
d83811f270d5: Pull complete
ee671aafb583: Pull complete
7fc152dfb3a6: Pull complete
485ea80d093d: Pull complete
e4021511b813: Pull complete
f0f976467b2c: Pull complete
788284490e67: Pull complete
134a5eeb528f: Pull complete
a4d8f6645f3b: Pull complete
db9d0640a96e: Pull complete
Digest: sha256:6d1df66ddf8e5aca56cedd4f333df124132a684dec70f881da687ef2e29f8831
Status: Downloaded newer image for tensorflow/tensorflow:latest
docker.io/tensorflow/tensorflow:latest

Si puo' testare aprendo una shell
root@debian:/home/luca# docker run -it --rm tensorflow/tensorflow bash

________                               _______________               
___  __/__________________________________  ____/__  /________      __
__  /  _  _ \_  __ \_  ___/  __ \_  ___/_  /_   __  /_  __ \_ | /| / /
_  /   /  __/  / / /(__  )/ /_/ /  /   _  __/   _  / / /_/ /_ |/ |/ /
/_/    \___//_/ /_//____/ \____//_/    /_/      /_/  \____/____/|__/


WARNING: You are running this container as root, which can cause new files in
mounted volumes to be created as the root user on your host machine.

To avoid this, run the container by specifying your user's userid:

$ docker run -u $(id -u):$(id -g) args...


Per usare i propri file senza duplicarli su docker si puo' montare la propria home all'interno del docker (in questo caso la cartella in /home/luca/tensor/keras2/train_1500el_5classi viene montata su -tmp2 (attenzione a non usare /tmp perche' manda in crisi apt e non si puo' installare piu' niente)


docker run -it --rm -v $PWD/tensor/keras2/train_1500el_5classi:/tmp2 -w /tmp2 tensorflow/tensorflow


per installare i moduli dentro a docker si procede con pip come di norma

apt-get install python-tk
pip install Pillow
pip install SciPy

Se si vuole cancellare l'immagine si procede

root@debian:/home/luca# docker images

REPOSITORY                 TAG                 IMAGE ID            CREATED             SIZE
tensorflow/tensorflow      latest              d64a95598d6c        2 months ago        1.03GB

root@debian:/home/luca# docker rmi d64a95598d6c

Untagged: tensorflow/tensorflow:latest
Untagged: tensorflow/tensorflow@sha256:6d1df66ddf8e5aca56cedd4f333df124132a684dec70f881da687ef2e29f8831
Deleted: sha256:d64a95598d6cfe0a472112589a2ed67cca21cb5d396d05dc304de9566d67de0f
Deleted: sha256:63d2e2a77e38788dc432866f4feeca36fc9469c4cc131583805b4b7d03552903
Deleted: sha256:7967455aa075896a12daaa2bb4a48b99b63f14b03dd80c09d6fba83b46b6f07b
Deleted: sha256:45d06edb6ecd5222ff22418d8649b8d74dc5cf30991f83eff595b6cd215d77bb
Deleted: sha256:e015b1c8d255426cd9d36475727d257a080ea865e3e0519f12c364464f1e5ef3
Deleted: sha256:dbaaffa3e9690ebc6710bcd9b11a986ccfe35340edecc3e2da1ad06325e5b646
Deleted: sha256:2d6aa956b10ffb80ab7bd53d124d34bb6d5d7b798a3d00d530bcec9408aaa4ae
Deleted: sha256:aee95a60862058fa4688fbe1252a7d4848695163add09c7c53af6071649f2aeb
Deleted: sha256:bd416bed302bc2f061a2f6848a565483a5f265932d2d4fa287ef511b7d1151c8
Deleted: sha256:5308e2e4a70bd4344383b8de54f8a52b62c41afb5caa16310326debd1499b748
Deleted: sha256:dab02287e04c8b8207210b90b4056bd865fcfab91469f39a1654075f550c5592
Deleted: sha256:a1aa3da2a80a775df55e880b094a1a8de19b919435ad0c71c29a0983d64e65db

Nessun commento:

Posta un commento

Debugger integrato ESP32S3

Aggiornamento In realta' il Jtag USB funziona anche sui moduli cinesi Il problema risiede  nell'ID USB della porta Jtag. Nel modulo...