报道正文
本文目录2 个章节
Doomformer compiles integer neural networks into ZDoom maps and runs them in ViZDoom. Voodoo dolls (the copies of the
player that DOOM spawns for extra player-1 starts) do the arithmetic, and sector light levels and plane heights hold the
sums. Python reads every exposed value back from the running game and compares it with a NumPy integer reference, tolerance 0.
One value off by one and the run fails. It is slow: about 23,000 times slower than NumPy on a small MLP (engine time; 65,000
times with a timer around the whole call), and a handwritten digit takes 163 seconds of real-time DOOM in one map at the
default schedule and 8 seconds at --opt 3.
Install · Proof · How it works · Films · Docs
<img src="https://github.com/mottopanikeiku/doomformer/actions/workflows/tests.yml/badge.svg" alt="tests"> <img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open in Colab"> <img src="https://img.shields.io/badge/license-MIT-blue" alt="MIT">
Install and run
pip install git+https://github.com/mottopanikeiku/doomformer # Python 3.11+, Linux or macOS
doomformer hello # 2 s: a small MLP, every value checked
doomformer draw --digit 7 # 15 s: the marine walks a 7 and the level reads itdoomformer doctor checks ViZDoom, Freedoom and the display, builds ACC if it is absent, and compiles an ACS probe
before reporting success. The first build needs git, cmake, a C compiler and network access to github.com.
Linux uses dynamic runtimes: glibc-static is not required. On Fedora: sudo dnf install git cmake gcc gcc-c++ make.
The Colab notebook
needs no setup, but you draw on a browser canvas and doomformer mnist --image feeds it to DOOM, with no marine.
Proof: walk a digit, DOOM reads it
Holding FIRE, the marine inks a 3×3 brush of floor cells under him. READ makes the level write the 784 pixels into the
network, and 1,355 voodoo dolls in the same map compute it. With --digit, Python stands in for you: it presses the
marine's keys and USE once, then only advances the clock and reads.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▄████████████████
████▀▀ ▀████▀
▀▀▀ ▄███▀
████
███
███
███
████
███▀
████
▀███
DOOM reads: 7 (right) -- the winner's doll lit it on the 7-segment display
EXACT: all 248 values DOOM computed [...] equal the NumPy integer reference (tolerance 0)
READ pass: 273 game tics = 8 s of real-time DOOM at 35 tics/s, 3 s wall [...]Abridged at [...]; docs/commands.md has the whole output. draw builds its
map with --opt 3, so a READ takes 273 game tics; at --opt 0, the original schedule, it takes 5,705 (163 s of real-time
DOOM). Without --digit the command opens a window and you walk and draw yourself; DOOM then runs in real time.
The dolls compute 784 pixels → 64 hidden units → 45 pairwise score comparisons → 10 win counts. Only the digit that wins all nine of its comparisons gets a doll through, and the line that doll crosses starts the level script that lights the digit on the display. Python reads back the 784 pixels, the hidden layer, every comparison and the answer and checks all 248 values (119 values, each read with its negated twin, plus 10 outputs).

EXACT means DOOM equals the integer network. It says nothing about whether the digit is right. On the first 100 MNIST test
digits DOOM reads 99 correctly, and 966 of 1,000 sampled from all 10,000; every result is exact. The integer network
scores 97.16 % on all 10,000 (the float model scores 97.58 %). The 30 walked digits (0 to 9, three scripted stroke
variants each) all read correctly and exact at --opt 3, and the network is also trained on that stroke distribution: the
first version of this demo, a 784-32-10 network trained on MNIST alone, reads only 41.08 % of such strokes. Through real X
key events a drawn 7 read exact at the default --opt 3; a 7 and a 1 were tried at --opt 0 with an earlier network.
Details · film
(注:更多技术实现细节与完整 API 文档请查阅原项目 README)
作者发帖说明(HN):
Instead of trying to run DOOM on things, I have instead decided to use DOOM (many, many, many doom games actually) to create a transformer. For a lot of the math required I essentially had to use DOOM game mechanics and voodoo dolls (DOOM is turing complete btw) and exchange them with the actual operations, essentially creating an alternative to NumPy (a 65000x slower one). Thus, I am proud to present DOOMFORMER. Here are a list of things DOOMFORMER can do :
It can classify MNIST digits, even if you write these digits on the map!
It can talk(kinda)
You can use it to make decisions, so, it can play DOOM. Yes! You can play DOOM with thousands of DOOM games now! The marine's mind can be controlled by DOOM, playing on a map generated by DOOMFORMER. Truly, the possibilities are endless, and even larger-scale training of DOOMFORMER could be done on a measly T4.
If anyone would like to help me scale this up and make crazier things, I'd love to work together.