Skip to content

Instantly share code, notes, and snippets.

View mxochicale's full-sized avatar
🤖
exploring, building, coding, innovating, etc

Miguel Xochicale, PhD mxochicale

🤖
exploring, building, coding, innovating, etc
View GitHub Profile
@josemarcosrf
josemarcosrf / easy_install_cuda_ubuntu-1804.sh
Last active November 10, 2021 08:24
Install NVIDIA drivers and CUDA for Ubuntu 18.04 LTS
CUDA_REPO_PKG=cuda-repo-ubuntu1804_10.2.89-1_amd64.deb
CUDA_URL=http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64
wget -O /tmp/${CUDA_REPO_PKG} ${CUDA_URL}/${CUDA_REPO_PKG}
sudo dpkg -i /tmp/${CUDA_REPO_PKG}
sudo apt-key adv --fetch-keys ${CUDA_URL}/7fa2af80.pub
rm -f /tmp/${CUDA_REPO_PKG}
@tvercaut
tvercaut / !Latex to MS Word tests
Last active April 8, 2020 11:07
Latex to MS Word tests
Hack file to get a nicer Gist name
@dgobbi
dgobbi / QtImageExample.py
Created November 28, 2019 19:23
Simple image display with QVTKRenderWindowInteractor
# coding=utf-8
"""
Example of displaying an image with VTK/Qt/Python.
Original author: David Gobbi
This example does not include proper image orientation or interaction.
"""
import sys
import torch
import torch.nn as nn
class conv_block_nested(nn.Module):
def __init__(self, in_ch, mid_ch, out_ch):
super(conv_block_nested, self).__init__()
self.activation = nn.ReLU(inplace=True)
self.conv1 = nn.Conv2d(in_ch, mid_ch, kernel_size=3, padding=1, bias=True)
self.bn1 = nn.BatchNorm2d(mid_ch)
@xvdp
xvdp / npuint8_torchfloat32.py
Last active April 12, 2024 09:21
numpy uint8 to pytorch float32; how to do it efficiently
""" I was writing a dataloader from a video stream. I ran some numbers.
# in a nutshell.
-> np.transpose() or torch.permute() is faster as uint8, no difference between torch and numpy
-> np.uint8/number results in np.float64, never do it, if anything cast as np.float32
-> convert to pytorch before converting uint8 to float32
-> contiguous() is is faster in torch than numpy
-> contiguous() is faster for torch.float32 than for torch.uint8
-> convert to CUDA in the numpy to pytorch conversion, if you can.
-> in CPU tensor/my_float is > 130% more costly than tensor.div_(myfloat), however tensor.div_()
does not keep track of gradients, so be careful using it.
@yobibyte
yobibyte / proceedings.py
Created December 3, 2018 23:37
Script to parse NeurIPS proceedings page
import csv
import urllib
from bs4 import BeautifulSoup
url_to_parse = 'https://papers.nips.cc/book/advances-in-neural-information-processing-systems-31-2018'
page = urllib.request.urlopen(url_to_parse)
soup = BeautifulSoup(page, 'html.parser')
with open('proceedings.csv', 'w') as csvfile:
wr = csv.writer(csvfile, delimiter=',')
@bogdan-kulynych
bogdan-kulynych / install-cuda-10-bionic.sh
Last active December 5, 2023 10:26
Install CUDA 10 on Ubuntu 18.04
# WARNING: These steps seem to not work anymore!
#!/bin/bash
# Purge existign CUDA first
sudo apt --purge remove "cublas*" "cuda*"
sudo apt --purge remove "nvidia*"
# Install CUDA Toolkit 10
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-repo-ubuntu1804_10.0.130-1_amd64.deb
@zeyademam
zeyademam / Troubleshoot-dcnn.md
Last active January 22, 2024 05:54
Troubleshooting Convolutional Neural Nets

Troubleshooting Convolutional Neural Networks

Intro

This is a list of hacks gathered primarily from prior experiences as well as online sources (most notably Stanford's CS231n course notes) on how to troubleshoot the performance of a convolutional neural network . We will focus mainly on supervised learning using deep neural networks. While this guide assumes the user is coding in Python3.6 using tensorflow (TF), it can still be helpful as a language agnostic guide.

Suppose we are given a convolutional neural network to train and evaluate and assume the evaluation results are worse than expected. The following are steps to troubleshoot and potentially improve performance. The first section corresponds to must-do's and generally good practices before you start troubleshooting. Every subsequent section header corresponds to a problem and the section is devoted to solving it. The sections are ordered to reflect "more common" issues first and under each header the "most-eas

@Mahedi-61
Mahedi-61 / cuda_11.8_installation_on_Ubuntu_22.04
Last active April 22, 2024 08:21
Instructions for CUDA v11.8 and cuDNN 8.9.7 installation on Ubuntu 22.04 for PyTorch 2.1.2
#!/bin/bash
### steps ####
# Verify the system has a cuda-capable gpu
# Download and install the nvidia cuda toolkit and cudnn
# Setup environmental variables
# Verify the installation
###
### to verify your gpu is cuda enable check
@ElToro1966
ElToro1966 / r_ubuntu_18_04.sh
Last active October 1, 2023 18:29 — forked from pachadotdev/r_ubuntu_17_10.sh
Install R and RStudio on Ubuntu 18.04 with essential libraries for data science. Based on pachamaltese/r_ubuntu_17_10.sh (for Ubuntu 17.10). Note: You need to make sure the default library location - /usr/local/lib/R/site-packages - is writable .
# Install R
sudo apt update
sudo apt install gdebi libxml2-dev libssl-dev libcurl4-openssl-dev libopenblas-dev r-base r-base-dev
# Install RStudio
cd ~/Downloads
wget https://download1.rstudio.org/desktop/bionic/amd64/rstudio-1.2.5001-amd64.deb
sudo gdebi rstudio-1.2.5001-amd64.deb
printf '\nexport QT_STYLE_OVERRIDE=gtk\n' | sudo tee -a ~/.profile