Skip to content

Instantly share code, notes, and snippets.

@mattiasarro
mattiasarro / rwkv.py
Last active February 6, 2024 18:48
RWKV MVP
# Taken from https://johanwind.github.io/2023/03/23/rwkv_details.html.
# I've added additional comments restructured it a tiny bit, which makes it clearer for me.
import numpy as np
from torch import load as torch_load # Only for loading the model weights
from tokenizers import Tokenizer
exp = np.exp
layer_norm = lambda x, w, b : (x - np.mean(x)) / np.std(x) * w + b
sigmoid = lambda x : 1/(1 + exp(-x))
@chuntaro
chuntaro / vc-git-grep-quick.el
Created April 15, 2020 08:47
`vc-git-grep'はインタラクティブに実行するとファイル名等色々聞いてくるので、Enterだけで実行する為のラッパーコマンド
;; `vc-git-grep'はインタラクティブに実行するとファイル名等色々聞いてくるので
;; Enterだけで実行する為のラッパーコマンド
(defun vc-git-grep-quick (regexp &optional files dir)
(interactive
(progn
(grep-compute-defaults)
(let ((regexp (grep-read-regexp))
(files (concat "*." (file-name-extension (buffer-file-name))))
(dir "."))
@fuqunaga
fuqunaga / SimplestGSBillboard
Created January 7, 2019 10:16
Simplest Geometry Shader Billboard
Shader "Custom/SimplestGSBillboard"
{
Properties
{
_Size ("Size", Float) = 1.0
}
SubShader
{
Tags { "RenderType"="Opaque" }