Skip to content

Instantly share code, notes, and snippets.

View Praveenk8051's full-sized avatar
🐢

Praveen Praveenk8051

🐢
View GitHub Profile
@Praveenk8051
Praveenk8051 / remove_cuda.sh
Last active April 26, 2020 09:13
Autoremove and Clean existing CuDA
# Remove existing CuDA versions
sudo apt --purge remove "cublas*" "cuda*"
sudo apt --purge remove "nvidia*"
rm -rf /usr/local/cuda*
sudo apt-get autoremove && sudo apt-get autoclean
# Reboot to remove cached files
reboot
@Praveenk8051
Praveenk8051 / download_cuda.sh
Last active July 28, 2021 07:10
Download the CuDA package
# Install build essentials
sudo apt-get install g++ freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libglu1-mesa libglu1-mesa-dev
# Download CuDA from following path
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-repo-ubuntu1804_10.0.130-1_amd64.deb
# read as a DebianPackage
sudo apt-key adv - fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
sudo dpkg -i cuda-repo-ubuntu1804_10.0.130–1_amd64.deb
sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
# install cuda-10.0
sudo apt install cuda-10.0
@Praveenk8051
Praveenk8051 / export_path.sh
Last active April 19, 2020 20:27
Export Paths
# copy the following files into the cuda toolkit directory.
echo 'export PATH=/usr/local/cuda-10.0/bin:$PATH' >> ~/.bashrc
echo 'export LD_LIBRARY_PATH=/usr/local/cuda-10.0/lib64:$LD_LIBRARY_PATH' >> ~/.bashrc
reboot
@Praveenk8051
Praveenk8051 / download_export_cudnn.sh
Last active April 19, 2020 20:28
Download and Export CuDNN files
# Download from following link: https://developer.nvidia.com/rdp/cudnn-archive
tar -xzvf cudnn-10.0-linux-x64-v7.4.2.24.tgz
sudo cp -P cuda/include/cudnn.h /usr/local/cuda-10.0/include
sudo cp -P cuda/lib64/libcudnn* /usr/local/cuda-10.0/lib64/
sudo chmod a+r /usr/local/cuda-10.0/lib64/libcudnn*
# Check the version of CuDA, CuDNN
nvcc -V
cat /usr/local/cuda/version.txt
cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2
cat /usr/include/cudnn.h | grep CUDNN_MAJOR -A 2
@Praveenk8051
Praveenk8051 / load_libraries_mnist.py
Last active May 6, 2020 11:10
Load libraries for mnist dataset
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import seaborn as sns
from sklearn.model_selection import train_test_split
from sklearn.metrics import confusion_matrix
import itertools
from keras.utils.np_utils import to_categorical
from keras.models import Sequential
@Praveenk8051
Praveenk8051 / load_data_mnist.py
Created May 6, 2020 10:20
load data for mnist
# load data and visualize the histogram
train = pd.read_csv("../input/train.csv")
test = pd.read_csv("../input/test.csv")
Y_train = train["label"]
X_train = train.drop(labels = ["label"],axis = 1)
g = sns.countplot(Y_train)
Y_train.value_counts()
@Praveenk8051
Praveenk8051 / handle_missing_mnist.py
Created May 6, 2020 10:48
Handle Missing Data Mnist
X_train.isnull().any().describe()
test.isnull().any().describe()
@Praveenk8051
Praveenk8051 / normalize_reshape_mnist.py
Created May 6, 2020 11:09
Normalize and Reshape MNIST
#Normalize
X_train = X_train / 255.0
test = test / 255.0
#Reshape
X_train = X_train.values.reshape(-1,28,28,1)
test = test.values.reshape(-1,28,28,1)
Y_train = to_categorical(Y_train, num_classes = 10)