Forked from maranemil/installation_anaconda_pytorch_tensorflow.txt
Created
March 9, 2019 16:18
-
-
Save hristian-carabulea/ec6892857c8b8fc741a62db975ef53bd to your computer and use it in GitHub Desktop.
Installation Anaconda Tensorflow PyTorch Jupyter Notebook Ubuntu 18.04 Server Xfce4 VM Virtualbox
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##################################################################### | |
# | |
# Installation Anaconda Tensorflow PyTorch Jupyter Notebook Ubuntu 18.04 Server Xfce4 VM Virtualbox | |
# https://ftp-stud.hs-esslingen.de/pub/Mirrors/releases.ubuntu.com/18.04/ | |
# | |
# Install | |
# ubuntu-18.04.2-live-server-amd64.iso | |
# sudo apt update && sudo apt upgrate && sudo apt install xfce4 | |
# 20:21 - 20:36 = 15 min ~ | |
# | |
##################################################################### | |
wget https://repo.anaconda.com/archive/Anaconda3-2018.12-Linux-x86_64.sh | |
chmod +x Anaconda3-2018.12-Linux-x86_64.sh | |
bash Anaconda3-2018.12-Linux-x86_64.sh | |
export PATH=~/anaconda3/bin:$PATH | |
python --version | |
conda --version | |
conda env list | |
conda list | |
# conda create -n tensorflow pip python=3.6 | |
# activate tensorflow | |
sudo apt install python3-pip | |
pip --version | |
pip install tensorflow | |
conda install pytorch torchvision -c pytorch | |
# conda update conda | |
# conda install mkl=2018 | |
# conda install jupyter | |
# conda list | |
jupyter notebook | |
# https://www.tensorflow.org/install/pip | |
# http://mirrors.nju.edu.cn/tensorflow/linux/cpu/ | |
# pip install pytorch torchvision | |
# pip install --ignore-installed --upgrade tensorflow | |
# pip install https://files.pythonhosted.org/packages/d4/29/6b4f1e02417c3a1ccc85380f093556ffd0b35dc354078074c5195c8447f2/tensorflow-1.13.1-cp37-cp37m-manylinux1_x86_64.whl | |
# pip install --upgrade pip | |
# pip freeze | |
# pip uninstall numpy | |
# pip uninstall scipy | |
# pip install numpy --upgrade | |
# pip install scipy --upgrade | |
# pip install tensorflow --upgrade | |
# pip install --no-cache numpy | |
# conda install -c conda-forge numpy | |
# conda install pytorch torchvision | |
------ | |
################################# | |
###### test torch | |
################################# | |
from __future__ import print_function | |
import torch | |
import torch.nn as nn | |
m = nn.Linear(20, 30) | |
input = torch.randn(128, 20) | |
output = m(input) | |
print(output.size()) | |
################################# | |
###### test tensorflow | |
################################# | |
import tensorflow as tf | |
data = tf.constant([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], dtype=tf.float32) | |
data = tf.reshape(data, shape=[1, 2, 5, 1]) | |
pool = tf.layers.max_pooling2d(data, pool_size=[2, 2], strides=2, padding='same') | |
sess = tf.Session() | |
print(sess.run(pool)) | |
################################# | |
####### test keras | |
################################# | |
import tensorflow as tf | |
mnist = tf.keras.datasets.mnist | |
(x_train, y_train),(x_test, y_test) = mnist.load_data() | |
x_train, x_test = x_train / 255.0, x_test / 255.0 | |
model = tf.keras.models.Sequential([ | |
tf.keras.layers.Flatten(), | |
tf.keras.layers.Dense(512, activation=tf.nn.relu), | |
tf.keras.layers.Dropout(0.2), | |
tf.keras.layers.Dense(10, activation=tf.nn.softmax) | |
]) | |
model.compile(optimizer='adam', | |
loss='sparse_categorical_crossentropy', | |
metrics=['accuracy']) | |
model.fit(x_train, y_train, epochs=5) | |
model.evaluate(x_test, y_test) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment