Skip to content

Instantly share code, notes, and snippets.

import torch
from torch.utils._python_dispatch import TorchDispatchMode
from torch.utils._pytree import tree_map
import itertools
# cribbed from https://github.com/albanD/subclass_zoo/blob/main/logging_mode.py
class Lit:
def __init__(self, s):
self.s = s
import torch
import torch.utils.dlpack
import jax
import jax.dlpack
# A generic mechanism for turning a JAX function into a PyTorch function.
def j2t(x_jax):
x_torch = torch.utils.dlpack.from_dlpack(jax.dlpack.to_dlpack(x_jax))
return x_torch

Ubuntu 22.04 for Deep Learning

In the name of God

This gist contains steps to setup Ubuntu 22.04 for deep learning.


Install Ubuntu 22.04

@qsh-zh
qsh-zh / install-cuda-10-bionic.sh
Created September 17, 2019 19:32 — forked from bogdan-kulynych/install-cuda-10-bionic.sh
Install CUDA 10 on Ubuntu 18.04
#!/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
sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub && sudo apt update
sudo dpkg -i cuda-repo-ubuntu1804_10.0.130-1_amd64.deb
@uzl
uzl / nvidia_driver_install_ubuntu_18.md
Last active April 30, 2022 13:04
Install Latest Nvidia Driver in Ubuntu 18.04

Install Latest Nvidia Driver in Ubuntu 18.04 LTS

Step: 1

Remove previous installation

sudo apt-get purge nvidia*
sudo apt-get autoremove 

@piwwww
piwwww / jllocal.sh
Created January 14, 2019 17:14
Running Jupyter Lab Remotely (Local Part)
# tips from Ben Lindsay: http://benjlindsay.com/blog/running-jupyter-lab-remotely/
# This function does a few things when you type jllocal:
# Runs ssh tunneling command if it's not already running
# Grabs the Jupyter token from the remote machine
# Opens a tab in your browser with the right url and token for you
# When you're done with Jupyter Lab, you just type jllocal kill and it will shut down the ssh connection.
function jllocal {
@bogdan-kulynych
bogdan-kulynych / install-cuda-10-bionic.sh
Last active October 17, 2024 23:17
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
@dpfrakes
dpfrakes / install_box2d.sh
Last active November 18, 2019 23:34
Install Box2D
### Install Box2D from source
# Mac
brew install swig
# Linux
sudo apt-get install build-essential python-dev swig
# Download source
cd ~/dev
@jarvisschultz
jarvisschultz / CMakeLists.txt
Last active April 19, 2024 00:56
Simple Float32MultiArray +Eigen Demo
cmake_minimum_required(VERSION 3.5.1)
project(matrix_demo)
find_package(catkin REQUIRED
rospy
roscpp
std_msgs
)
include_directories(
@myusuf3
myusuf3 / delete_git_submodule.md
Created November 3, 2014 17:36
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule