mnist-mlp
์ฑ ใ๋ฐ๋ฐ๋ฅ๋ถํฐ ๋ง๋๋ ์ถ๋ก ์์ง: Rust๋ก ๋ฐฐ์ฐ๋ AI ์ธํผ๋ฐ์ค ์์ง๋์ด๋งใ (Building an Inference Engine from Scratch) 7์ฅ์์ ์ฐ๋ ์๊ธ์จ ์ซ์ ๋ถ๋ฅ ๋ชจ๋ธ์ ๋๋ค.
A tiny MNIST classifier used in chapter 7 of the book. It exists so that
readers can run the book's inference engine, badak, without training the
model themselves.
- ์ฑ / Book: https://chosungmann.github.io/building-an-inference-engine-from-scratch/
- ์ฝ๋ / Code: https://github.com/chosungmann/building-an-inference-engine-from-scratch
๋ชจ๋ธ / Model
| ๊ตฌ์กฐ / Architecture | ๋ค์ธต ํผ์ ํธ๋ก 784 โ 128 โ 10, ReLU |
| ํ๋ผ๋ฏธํฐ / Parameters | 101,770 |
| ์ ๋ ฅ / Input | 28 ร 28 ํฝ์
์ (x / 255 โ 0.1307) / 0.3081๋ก ์ ๊ทํํด 784๊ฐ๋ก ํธ ๊ฒ |
| ์ถ๋ ฅ / Output | ์ซ์ 0~9์ ๋ํ ์ ์ 10๊ฐ |
| ์ํ ์ ํ๋ / Test accuracy | 97.64% (10,000์ฅ ์ค 9,764์ฅ) |
ํ์ผ / Files
| ํ์ผ | ๋ด์ฉ |
|---|---|
model.safetensors |
๊ฐ์ค์น fc1.weight, fc1.bias, fc2.weight, fc2.bias. ์ ์ฒ๋ฆฌ์ ์ฐ๋ ํ๊ท ๊ณผ ํ์คํธ์ฐจ๋ ๋ฉํ๋ฐ์ดํฐ์ ์์ต๋๋ค. |
reference.safetensors |
PyTorch๊ฐ ๊ณ์ฐํ ์ ๋ต. ์์ 16์ฅ์ ๋ํ ์ธต๋ณ ์ถ๋ ฅ(input, fc1, relu, logits)๊ณผ ์ํ ๋ฐ์ดํฐ ์ ์ฒด์ ์ ์(all_logits), ์์ธก(predictions). |
๋ง๋ ๋ฐฉ๋ฒ / How it was made
์ ์ฅ์์ reference/ch07_train_mnist.py๋ก ํ์ตํ์ต๋๋ค. PyTorch 2.15.0,
๋์ ์จ์ 0, Adam(ํ์ต๋ฅ 0.001), ๋ฐฐ์น 64, 5 ์ํญ, CPU.
sh scripts/download_mnist.sh
python reference/ch07_train_mnist.py
๊ฐ์ ์คํฌ๋ฆฝํธ๋ฅผ ์คํํด๋ ๊ธฐ๊ณ์ PyTorch ๋ฒ์ ์ ๋ฐ๋ผ ๊ฐ์ค์น๊ฐ ์กฐ๊ธ ๋ค๋ฅผ ์ ์์ต๋๋ค. ์ฑ ์ ์ซ์๋ฅผ ๊ทธ๋๋ก ์ฌํํ๋ ค๋ฉด ์ด ์ ์ฅ์์ ํ์ผ์ ์ฐ์ญ์์ค.
ํ๊ณ / Limitations
ํ์ต ์ฌ๋ฃ๋ฅผ ๋ณด์ฌ ์ฃผ๊ธฐ ์ํ ์์ ๋ชจ๋ธ์ ๋๋ค. MNIST์ ๊ฐ์ ๋ฐฉ์์ผ๋ก ๊ฐ์ด๋ฐ ์ ๋ ฌ๋ ํฐ ์ซ์, ๊ฒ์ ๋ฐฐ๊ฒฝ์ 28 ร 28 ๊ทธ๋ฆผ์์๋ง ์ ๋์ํฉ๋๋ค.