Skip to content

Instantly share code, notes, and snippets.

View teleprint-me's full-sized avatar

Austin teleprint-me

View GitHub Profile
@teleprint-me
teleprint-me / gpt-2-encode.py
Last active May 6, 2024 16:04
gpt-2-encode.py
import json
import os
import re
from functools import lru_cache
from typing import IO
class Encoder:
def __init__(
self,
@teleprint-me
teleprint-me / convert.py
Created March 24, 2024 04:36 — forked from chu-tianxiang/convert.py
Convert grok-1 weight to torch
import numpy as np
import torch
import jax
from tqdm import tqdm
from model import LanguageModelConfig, TransformerConfig, QuantizedWeight8bit as QW8Bit
from runners import InferenceRunner, ModelRunner, sample_from_model
CKPT_PATH = "./checkpoints"
@teleprint-me
teleprint-me / timestamp.py
Created November 28, 2022 01:46
Simplify timestamps in python
from datetime import date, datetime
from dateutil import parser
def to_datetime(value: str) -> datetime:
return parser.parse(value)
def to_iso(value: datetime) -> str:
@teleprint-me
teleprint-me / security.py
Created November 28, 2022 01:37
Home brewed scrypt and json web token implementation in python
import base64
import hmac
import json
import os
import secrets
import string
import time
import uuid
import scrypt