Learn Ggml Through MNIST

为了深入了解ggml库,我们以官方的稍复杂的MINST示例作为参考: https://github.com/ggml-org/ggml/blob/master/examples/mnist/README.md

一些简单的GGML介绍参考此前的博客quickstart-of-llama.cpp-and-powerinfer

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# 编译
cmake -B build -DGGML_CUDA=ON
cmake --build build --config Debug -j 8

# 我们主要关注用fc的方式训练与推理

# train with pytorch
python3 mnist-train-fc.py mnist-fc-f32.gguf

# eval
build/bin/mnist-eval mnist-fc-f32.gguf data/MNIST/raw/t10k-images-idx3-ubyte data/MNIST/raw/t10k-labels-idx1-ubyte

# train
build/bin/mnist-train mnist-fc mnist-fc-f32.gguf data/MNIST/raw/train-images-idx3-ubyte data/MNIST/raw/train-labels-idx1-ubyte
CC BY-NC-SA 4.0
Built with Hugo