Skip to content

Instantly share code, notes, and snippets.

View dan-zheng's full-sized avatar
🥛
우유맛

Dan Zheng dan-zheng

🥛
우유맛
View GitHub Profile
@moyix
moyix / CodeGen_GPTJ_Conversion.md
Last active January 5, 2024 12:50
How to convert the SalesForce CodeGen models to GPT-J

Using Linear Algebra to Convert a Large Code Model

Background

The SalesForce CodeGen models are a family of large language models trained on a large amount of natural language data and then fine-tuned on specialized datasets of code. Models of size 350M, 2B, 6B, and 16B parameters are provided in three flavors:

  • nl, the base model trained on The Pile, a large natural language dataset compiled by EleutherAI
  • multi, which is fine-tuned from the nl model on a dataset of code in multiple languages, scraped from GitHub, and
  • mono, which is fine-tuned from the multi model on Python code only.
@dpiponi
dpiponi / main.lhs
Created December 24, 2020 22:53
Branch relaxation with monotonic time travel
Here's a block of code in some imaginary assembly language:
jmp A
block1
jmp A
block2
jmp A
block3
.A ...
@niklasschmitz
niklasschmitz / jaxpr_graph.py
Last active June 24, 2024 17:53 — forked from mattjj/grad_graph.py
visualizing jaxprs
import jax
from jax import core
from graphviz import Digraph
import itertools
styles = {
'const': dict(style='filled', color='goldenrod1'),
'invar': dict(color='mediumspringgreen', style='filled'),
'outvar': dict(style='filled,dashed', fillcolor='indianred1', color='black'),
@Kraks
Kraks / Futamura.scala
Created May 10, 2019 00:45
Some types of Futamura projections.
trait Futamura1 {
// Roughly follow the idea from http://blog.sigfpe.com/2009/05/three-projections-of-doctor-futamura.html
type P[_] // program representation type
type M[_] // machine type
/* To run a machine: */
def run[A](ma: M[A]): A
/* The specializer: a machine that
takes a program representation of A => B,
@rxwei
rxwei / rnn.ipynb
Created March 11, 2019 10:40
RNN.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rntz
rntz / Runtime.hs
Created February 14, 2019 21:38
A seminaïve, mildly optimizing compiler from modal Datafun to Haskell, in OCaml.
-- The Datafun runtime.
module Runtime where
import qualified Data.Set as Set
import Data.Set (Set)
class Eq a => Preord a where
(<:) :: a -> a -> Bool
class Preord a => Semilat a where
@marcrasi
marcrasi / XXXX-constexpr.md
Last active April 19, 2024 21:10
Compile Time Constant Expressions for Swift
@DougGregor
DougGregor / dynamic_member_lookup_environment.swift
Created May 2, 2018 16:59
Using Swift 4.2's @dynamicMemberLookup to expose environment variables
import Darwin
@dynamicMemberLookup
struct Environment {
subscript(dynamicMember name: String) -> String? {
get {
guard let value = getenv(name) else { return nil }
return String(validatingUTF8: value)
}
@regexident
regexident / GenericsManifesto.md
Created November 14, 2017 09:16
Draft for extended section on generic protocols in Swift Raw

Generic protocols

One of the most commonly requested features is the ability to parameterize protocols themselves. For example, a protocol that indicates that the Self type can be constructed from some specified type T or converted into T:

// T -> Self:
protocol ConstructibleFrom<T> {
  init(from value: T)
}
@Azoy
Azoy / Random.swift
Last active November 13, 2017 11:01
Swift Random Unification Design
public protocol RandomSource {
static var shared: RandomSource { get }
func next<T : FixedWidthInteger>(_ type: T.Type) -> T
func nextUniform<T : BinaryFloatingPoint>(_ type: T.Type) -> T
}
// Utilizes /dev/urandom
public class DevRandom: RandomSource {
public static let shared = DevRandom()