Skip to content

Instantly share code, notes, and snippets.

View HarshTrivedi's full-sized avatar

Harsh Trivedi HarshTrivedi

View GitHub Profile
@hangsong
hangsong / Install NVIDIA Driver and CUDA.md
Created September 9, 2016 06:59 — forked from wangruohui/Install NVIDIA Driver and CUDA.md
Install NVIDIA Driver and CUDA on Ubuntu / CentOS / Fedora
@Tushar-N
Tushar-N / pad_packed_demo.py
Last active October 27, 2024 15:17
How to use pad_packed_sequence in pytorch<1.1.0
import torch
import torch.nn as nn
from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence
seqs = ['gigantic_string','tiny_str','medium_str']
# make <pad> idx 0
vocab = ['<pad>'] + sorted(set(''.join(seqs)))
# make model
@dirkgr
dirkgr / logging_tqdm.py
Last active November 14, 2023 04:54
A drop-in replacement for TQDM which writes log messages instead of progress bars
from typing import *
import time
import logging
def logging_tqdm(
i,
*,
logger: Optional[logging.Logger] = None,
desc: str = "Working",
total: Optional[int] = None,