Skip to content

Instantly share code, notes, and snippets.

View s-hironobu's full-sized avatar

Hironobu Suzuki s-hironobu

View GitHub Profile
"""
The most atomic way to train and run inference for a GPT in pure, dependency-free Python.
This file is the complete algorithm.
Everything else is just efficiency.
@karpathy
"""
import os # os.path.exists
import math # math.log, math.exp
@euske
euske / parable.md
Last active June 19, 2025 00:11
あるたとえ話 (A parable) - ダイクストラによる、プログラマの魂をもった技師の話。

あるたとえ話 (A parable)

https://www.cs.utexas.edu/~EWD/transcriptions/EWD05xx/EWD594.html

-- エドガー W. ダイクストラ (Edsger W. Dijkstra)

その昔、鉄道会社がありました。その (やり手の) 経営者は、 トイレをすべての客車につけるのではなく、50% の客車にだけつけるようにすれば、 会社の初期投資をずっと少なくできることに気づき、そのように指示しました。

@chao-ji
chao-ji / beamsearch_decoder.py
Last active October 21, 2024 21:44
Easy to understand implementation of beam search algorithm used in decoder of seq2seq models
"""NumPy implementation of Beam Search. Can be used for decoding in Seq2Seq
models or transformer.
See https://chao-ji.github.io/jekyll/update/2019/01/24/Beam_Search.html
for an in-depth disucssion.
"""
import numpy as np
NEG_INF = -1e9
@benschwarz
benschwarz / pg.md
Last active October 16, 2024 23:15
Awesome postgres
@sile
sile / 0_raft.md
Last active May 27, 2024 07:53
Raft(分散合意アルゴリズム)について