Skip to content

Instantly share code, notes, and snippets.

View monajalal's full-sized avatar
🎯
Focusing

Mona Jalal monajalal

🎯
Focusing
View GitHub Profile
@primus852
primus852 / cuda_11.7_installation_on_Ubuntu_22.04
Last active April 17, 2024 22:34 — forked from Mahedi-61/cuda_11.8_installation_on_Ubuntu_22.04
Instructions for CUDA v11.7 and cuDNN 8.5 installation on Ubuntu 22.04 for PyTorch 1.12.1
#!/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
@spatial-bit
spatial-bit / snippet.py
Created February 3, 2022 16:14
USD get prim starts_with #USD #OMNIVERSE
import omni.usd
from pxr import UsdGeom, Usd, UsdGeom
def get_prims_startswith(stage, root_path, starts_with):
matching_prims = []
root_prim = stage.GetPrimAtPath(root_path)
for prim in Usd.PrimRange(root_prim):
if prim.GetName().startswith(starts_with):
matching_prims.append(prim)
return matching_prims
@thomwolf
thomwolf / datadistributedparallel.py
Last active December 13, 2022 19:15
Using DistributedDataParallel
from torch.utils.data.distributed import DistributedSampler
from torch.utils.data import DataLoader
# Each process runs on 1 GPU device specified by the local_rank argument.
parser = argparse.ArgumentParser()
parser.add_argument("--local_rank", type=int)
args = parser.parse_args()
# Initializes the distributed backend which will take care of sychronizing nodes/GPUs
torch.distributed.init_process_group(backend='nccl')
@vikash512
vikash512 / plot_confusion_matrix.png
Created July 31, 2018 12:47 — forked from hitvoice/plot_confusion_matrix.png
Generate matrix plot for confusion matrix with pretty annotations.
plot_confusion_matrix.png
@andrewjong
andrewjong / pytorch_image_folder_with_file_paths.py
Last active February 27, 2024 09:24
PyTorch Image File Paths With Dataset Dataloader
import torch
from torchvision import datasets
class ImageFolderWithPaths(datasets.ImageFolder):
"""Custom dataset that includes image file paths. Extends
torchvision.datasets.ImageFolder
"""
# override the __getitem__ method. this is the method that dataloader calls
def __getitem__(self, index):
@bshishov
bshishov / forecasting_metrics.py
Last active April 20, 2024 04:29
Python Numpy functions for most common forecasting metrics
import numpy as np
EPSILON = 1e-10
def _error(actual: np.ndarray, predicted: np.ndarray):
""" Simple error """
return actual - predicted
@jrjames83
jrjames83 / Python Graph Traversal Fundamentals.ipynb
Created February 25, 2018 22:14
Fundamentals of Graph Traversals in Python (explain it to me like i'm 10 years old)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@crizCraig
crizCraig / gtav_object_ids.txt
Created December 30, 2016 22:28
GTAV object ids
prop_a4_pile_01
prop_a4_sheet_01
prop_a4_sheet_02
prop_a4_sheet_03
prop_a4_sheet_04
prop_a4_sheet_05
prop_abat_roller_static
prop_abat_slide
prop_acc_guitar_01
prop_acc_guitar_01_d1
@gauravbarthwal
gauravbarthwal / Multi-Part zip extraction in Ubuntu.txt
Last active February 27, 2024 16:34
How to extract multi-part .zip, .z01, .z02 files in ubuntu
Download/Copy all related *.zip files in one directory.
Open terminal and change to that directory which has all zip files.
Enter command zip -s- FILE_NAME.zip -O COMBINED_FILE.zip
Enter unzip COMBINED_FILE.zip
'''Functional Keras is a more functional replacement for the Graph API.
'''
###################
# 2 LSTM branches #
###################
a = Input(input_shape=(10, 32)) # output is a TF/TH placeholder, augmented with Keras attributes
b = Input(input_shape=(10, 32))
encoded_a = LSTM(32)(a) # output is a TF/TH tensor
encoded_b = LSTM(32)(b)