Skip to content

Instantly share code, notes, and snippets.

View rijulg's full-sized avatar

Rijul Gupta rijulg

View GitHub Profile
@rijulg
rijulg / README.md
Created September 25, 2025 15:11
Instructions for setting up pytorch on windows using docker containers

Pytorch on docker on WSL on Windows

This setup is to make the development platform fairly consistent with what would be used to run the same exact system on a server, and more importantly allowing us to work with multiple versions of Pytorch and nvidia drivers seamlessly without having to change configuration on the host system.

There are a few too many layers of abstraction here, and even the explanation (Pytorch on docker on WSL on Windows) is technically an excerpt on the underlying complexities and abstractions of each of docker, WSL and Windows. Not to mention the missing NGC containers that are not part of the abbreviated explanation.

Motivation

This is a highly opinionated workflow that I have developed because I work on multiple different tech stacks at the same time which is largely enabled by docker. Since running docker on windows requires a virtualization backend, WSL is the natural choice for that. Developing within these containerized environments is usually done using VSCode devcontain

@rijulg
rijulg / rds.py
Created August 19, 2024 08:37
File loader for University of Sydney RDS to deal with IO failures
import json
import torch
from typing import Dict
from pathlib import Path
def retry_me(max_retries):
def decorator(func):
def wrapper(*args, **kwargs):
last_err = None
@rijulg
rijulg / pytorch_hot_embedding.ipynb
Last active July 18, 2020 08:06
Pytorch Embedding that supports gradient propagation to inputs
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rijulg
rijulg / packagify.py
Created June 17, 2020 14:51
Packagify - for loading python projects not maintained as packages like packages
import builtins
import sys
class Packagify:
"""
Used to load python projects that aren't suitable to be used as packages
You can use this class as following:
```
from packagify import Packagify
@rijulg
rijulg / prune.py
Created June 7, 2020 06:31
Pruning and converting sparse network to dense in pytorch
#!/usr/bin/python
import copy
import torch
import numpy as np
torch.manual_seed(0)
class Original(torch.nn.Module):
@rijulg
rijulg / apollo.js
Created August 26, 2019 02:31
Monitor apollo client network requests globally
import { isNetworkRequestInFlight } from 'apollo-client/core/networkStatus';
/**
* Hooking into the onBroadcast function to save the inFlight data point in the client state
*/
apolloClient.queryManager.onBroadcast = () => {
const { queryManager: { queryStore: { store } } } = apolloClient;
const queries = Object.values(store);
// if we can find a way to escape early that will be better, but regular for loops don't sit well with eslint
const inFlight = queries.reduce(
@rijulg
rijulg / gamma.html
Created January 4, 2019 11:13
An implementation of Gamma filter in HTML5 Canvas
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>HTML5 Canvas Gamma Adjust</title>
<meta name="og:title" content="HTML5 Canvas Gamma Adjust"/>
<meta name="author" content="Rijul Gupta">
<meta name="description" content="An implementation of Gamma filter in HTML5 Canvas"/>
</head>
@rijulg
rijulg / example.vhd
Created August 30, 2018 15:49
Sample VHDL Code
-- --------------------------------------------------------------------.
--
-- Example VHDL Component Organization
--
-- Title : example
-- :
-- Library : work
-- :
-- Developers : Rijul Gupta ([email protected])
-- :