Skip to content

Instantly share code, notes, and snippets.

@dvruette
dvruette / decay_to_init.py
Created January 18, 2024 08:54
Weight decay to model initialization
import copy
import torch
import torch.nn as nn
class DecayToInit(nn.Module):
def __init__(self, param: torch.Tensor):
super().__init__()
self.register_buffer("param", param)
@ekzhang
ekzhang / Buildcarte.ipynb
Last active July 11, 2024 01:58
Build Systems à la Carte — Python edition
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nullcline
nullcline / baka_trace.py
Created March 9, 2023 08:20
tsundere error traces
import traceback
import openai
import sys
# list models
models = openai.Model.list()
def baka(error, character="tsundere",):
exc_type, exc_value, exc_traceback = sys.exc_info()
traceback_list = traceback.extract_tb(exc_traceback)
using AdvancedMH
using ArraysOfArrays
using CairoMakie
using DiffEqNoiseProcess
using Distributions
using StochasticDiffEq
using Turing
using Random
struct CrankNicolsonProposal{P,T} <: AdvancedMH.Proposal{P}

Foreward

This document was originally written several years ago. At the time I was working as an execution core verification engineer at Arm. The following points are coloured heavily by working in and around the execution cores of various processors. Apply a pinch of salt; points contain varying degrees of opinion.

It is still my opinion that RISC-V could be much better designed; though I will also say that if I was building a 32 or 64-bit CPU today I'd likely implement the architecture to benefit from the existing tooling.

Mostly based upon the RISC-V ISA spec v2.0. Some updates have been made for v2.2

Original Foreword: Some Opinion

The RISC-V ISA has pursued minimalism to a fault. There is a large emphasis on minimizing instruction count, normalizing encoding, etc. This pursuit of minimalism has resulted in false orthogonalities (such as reusing the same instruction for branches, calls and returns) and a requirement for superfluous instructions which impacts code density both in terms of size and

@sbarratt
sbarratt / torch_jacobian.py
Created May 9, 2019 19:40
Get the jacobian of a vector-valued function that takes batch inputs, in pytorch.
def get_jacobian(net, x, noutputs):
x = x.squeeze()
n = x.size()[0]
x = x.repeat(noutputs, 1)
x.requires_grad_(True)
y = net(x)
y.backward(torch.eye(noutputs))
return x.grad.data
@debasishg
debasishg / gist:b4df1648d3f1776abdff
Last active July 27, 2024 14:46
another attempt to organize my ML readings ..
  1. Feature Learning
  1. Deep Learning
@lmullen
lmullen / README.md
Created September 1, 2014 20:49
Getting the Ace editor to work with gitit

The file page.st goes in the templates/ directory in the Gitit wiki home directory. You'll put the Ace JavaScript and CSS files in static/.

@miguelfrde
miguelfrde / archinstall.md
Last active September 4, 2024 10:05
Preinstalled Windows 8.1 and Arch Linux dual boot

Arch Linux installation (preinstalled Windows 8.1 dual boot)

Before

  1. Disable Windows Fast-Startup
  2. Disable Secure Boot

Partitioning

@staltz
staltz / introrx.md
Last active November 14, 2024 11:27
The introduction to Reactive Programming you've been missing