Instructions to use building-an-inference-engine-from-scratch/mnist-tflite with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- LiteRT
How to use building-an-inference-engine-from-scratch/mnist-tflite with LiteRT:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
mnist-tflite
์ฑ
ใ๋ฐ๋ฐ๋ฅ๋ถํฐ ๋ง๋๋ ์ถ๋ก ์์ง: Rust๋ก ๋ฐฐ์ฐ๋ AI ์ธํผ๋ฐ์ค ์์ง๋์ด๋งใ
(Building an Inference Engine from Scratch) 26์ฅ์์ ์ฐ๋ ์๊ธ์จ ์ซ์ ๋ถ๋ฅ
๋ชจ๋ธ ๋์
๋๋ค. .tflite ํ์ผ์ด๊ณ , ์ฑ
์ ๊ทธ๋ํ ํด์๊ธฐ๊ฐ ์ฒ์์ผ๋ก ์ฝ๋
ํ์ผ์
๋๋ค.
Two tiny MNIST classifiers in the .tflite format, used in chapter 26 of the
book. They are the first files read by the graph interpreter of the book's
inference engine, badak.
- ์ฑ / Book: https://chosungmann.github.io/building-an-inference-engine-from-scratch/
- ์ฝ๋ / Code: https://github.com/chosungmann/building-an-inference-engine-from-scratch
๋ชจ๋ธ / Models
mlp.tflite |
residual.tflite |
|
|---|---|---|
| ๊ตฌ์กฐ / Architecture | 784 โ 128 โ 10, ReLU | 784 โ 256, ์์ฐจ ๋ธ๋ก 3๊ฐ(256 โ 512 โ 256), 256 โ 10 |
| ํ๋ผ๋ฏธํฐ / Parameters | 101,770 | 992,266 |
| ์ฐ์ฐ / Operators | FULLY_CONNECTED ร 2, SOFTMAX |
FULLY_CONNECTED ร 8, ADD ร 3, SOFTMAX |
| ์ํ ์ ํ๋ / Test accuracy | 97.64% (9,764 / 10,000) | 97.73% (9,773 / 10,000) |
๋ ๋ชจ๋ธ ๋ชจ๋ ์
๋ ฅ์ 0๊ณผ 1 ์ฌ์ด์ ํฝ์
๊ฐ (1, 784)์ด๊ณ , ์ถ๋ ฅ์ ์ซ์ 0~9์
ํ๋ฅ (1, 10)์
๋๋ค. ์ ๊ทํ (x โ 0.1307) / 0.3081์ ๊ทธ๋ํ ์์ ๋ค์ด
์์ต๋๋ค(๋ณํ๊ธฐ๊ฐ ์ฒซ ์ธต์ ๊ฐ์ค์น์ ์ ์ด ๋ฃ์์ต๋๋ค).
Both take pixel values in [0, 1] with shape (1, 784) and return ten
probabilities. The normalization is part of the graph.
mlp.tflite์ ๊ฐ์ค์น๋
mnist-mlp์
๊ฐ์ต๋๋ค.
ํ์ผ / Files
| ํ์ผ | ๋ด์ฉ |
|---|---|
mlp.tflite |
7์ฅ์ ๋ชจ๋ธ์ ๊ทธ๋ํ๋ก ์ฎ๊ธด ๊ฒ |
residual.tflite |
์์ฐจ ์ฐ๊ฒฐ์ด ์๋ ๋ชจ๋ธ |
reference.safetensors |
LiteRT๊ฐ ๊ณ์ฐํ ์ ๋ต. ๋ชจ๋ธ๋ง๋ค ์์ 16์ฅ์ ๋ํ ํ๋ฅ (mlp.probabilities, residual.probabilities)๊ณผ ์ํ ๋ฐ์ดํฐ ์ ์ฒด์ ์์ธก(mlp.predictions, residual.predictions) |
๋ง๋ ๋ฐฉ๋ฒ / How it was made
์ ์ฅ์์ reference/ch26_make_tflite.py๋ก ๋ง๋ค์์ต๋๋ค. PyTorch 2.14.1,
litert-torch 0.10.0, ai-edge-litert 2.3.0. ์์ฐจ ๋ชจ๋ธ์ ๋์ ์จ์ 0,
Adam(ํ์ต๋ฅ 0.001), ๋ฐฐ์น 64, 4 ์ํญ, CPU๋ก ํ์ตํ์ต๋๋ค.
sh scripts/download_mnist.sh
sh scripts/download_ch07.sh
pip install -r reference/requirements_ch26.txt
python reference/ch26_make_tflite.py
๊ฐ์ ์คํฌ๋ฆฝํธ๋ฅผ ์คํํด๋ ๊ธฐ๊ณ์ ๋๊ตฌ์ ๋ฒ์ ์ ๋ฐ๋ผ ํ์ผ์ด ์กฐ๊ธ ๋ค๋ฅผ ์ ์์ต๋๋ค. ์ฑ ์ ์ซ์๋ฅผ ๊ทธ๋๋ก ์ฌํํ๋ ค๋ฉด ์ด ์ ์ฅ์์ ํ์ผ์ ์ฐ์ญ์์ค.
ํ๊ณ / Limitations
ํ์ต ์ฌ๋ฃ๋ฅผ ๋ณด์ฌ ์ฃผ๊ธฐ ์ํ ์์ ๋ชจ๋ธ์ ๋๋ค. MNIST์ ๊ฐ์ ๋ฐฉ์์ผ๋ก ๊ฐ์ด๋ฐ ์ ๋ ฌ๋ ํฐ ์ซ์, ๊ฒ์ ๋ฐฐ๊ฒฝ์ 28 ร 28 ๊ทธ๋ฆผ์์๋ง ์ ๋์ํฉ๋๋ค.
- Downloads last month
- 179