certik / mlc

Machine Learning Compiler
MIT License
9 stars 1 forks source link

Use GGUF for test images, plot the digit #35

Closed certik closed 6 months ago

certik commented 6 months ago

This prints:

$ ./mlc_clib 
╔════════════════════════════════════════════════════════╗
║                                                        ║
║                                                        ║
║                                                        ║
║                                                        ║
║                              ▓▓██░░                    ║
║                            ▓▓████▓▓                    ║
║                          ▒▒████████░░                  ║
║                        ░░▓▓██████▓▓                    ║
║                      ░░▓▓████████▓▓                    ║
║                    ▒▒████████████▓▓                    ║
║                  ▓▓██████▓▓▒▒████▓▓                    ║
║                  ░░▓▓██▒▒    ████▓▓                    ║
║                            ░░████▓▓                    ║
║                            ▒▒████▓▓                    ║
║                            ▒▒████▓▓                    ║
║                            ▒▒████▒▒                    ║
║                            ░░████▓▓                    ║
║                              ▓▓██▒▒                    ║
║                              ▓▓██▒▒                    ║
║                              ▓▓██▓▓                    ║
║                      ░░▒▒▒▒▓▓▓▓████▓▓▓▓▒▒              ║
║                  ▒▒██████████████████████              ║
║                ░░██████████▓▓▓▓▓▓▒▒░░░░░░              ║
║                  ▒▒▓▓██▒▒░░                            ║
║                                                        ║
║                                                        ║
║                                                        ║
║                                                        ║
╚════════════════════════════════════════════════════════╝
Reference value: 1
File read successfuly.
Magic:'GGUF'
Version: 3
Number of kv pairs: 1
    0: general.architecture = mnist-cnn
Data Offset: 384
Data Size:   139328
Number of arrays: 6
    0: kernel1 ndim=4 shape=(32,1,3,3) type=f32 offset=0
        First few elements of f32 array:
            [0.012498, 0.236127, 0.164662, -0.447290, 0.083497]
    1: bias1 ndim=1 shape=(32,1,1,1) type=f32 offset=1152
        First few elements of f32 array:
            [-0.024168, -0.093263, -0.071657, -0.006928, -0.117522]
    2: kernel2 ndim=4 shape=(64,32,3,3) type=f32 offset=1280
        First few elements of f32 array:
            [-0.007851, 0.047512, 0.065296, 0.166333, 0.058508]
    3: bias2 ndim=1 shape=(64,1,1,1) type=f32 offset=75008
        First few elements of f32 array:
            [-0.160946, -0.026795, -0.018063, -0.007509, -0.023383]
    4: dense_w ndim=2 shape=(10,1600,1,1) type=f32 offset=75264
        First few elements of f32 array:
            [-0.082233, -0.226420, 0.146930, 0.044679, 0.094696]
    5: dense_b ndim=1 shape=(10,1,1,1) type=f32 offset=139264
        First few elements of f32 array:
            [0.039664, 0.171566, -0.020886, -0.041569, -0.076827]
rebcabin commented 6 months ago

I can't quite run it yet

https://github.com/certik/mlc/issues/36

certik commented 6 months ago

This now prints:

$ ./mlc_clib 
╔════════════════════════════════════════════════════════╗
║                                                        ║
║                                                        ║
║                                                        ║
║                                                        ║
║                                                        ║
║                                                        ║
║                                                        ║
║                  ░░▓▓░░                                ║
║                  ▓▓▓▓▓▓░░          ░░                  ║
║                  ▓▓▓▓▓▓▓▓▓▓░░░░▒▒▓▓██                  ║
║                ▓▓▓▓▓▓▓▓▓▓██▓▓▓▓▓▓▓▓██                  ║
║                ██▓▓▓▓▓▓▓▓██▓▓▓▓▓▓▓▓██                  ║
║              ▒▒██▓▓      ░░░░  ▒▒██▓▓                  ║
║            ░░▓▓██░░            ▓▓▓▓░░                  ║
║              ▓▓▒▒            ░░▓▓▓▓░░                  ║
║                              ░░▓▓▓▓                    ║
║                              ░░▓▓▓▓                    ║
║                              ▒▒██▒▒                    ║
║                              ▓▓▓▓░░                    ║
║                              ▓▓▓▓                      ║
║                            ░░▓▓▒▒                      ║
║                            ▒▒▓▓▒▒                      ║
║                            ▓▓██▒▒                      ║
║                          ░░▓▓▓▓░░                      ║
║                          ▒▒▓▓▓▓                        ║
║                          ▓▓▓▓▒▒                        ║
║                          ▒▒▒▒                          ║
║                                                        ║
╚════════════════════════════════════════════════════════╝
Reference value: 7; digit index 4214
Digit probabilities:
0.000000 0.000000 0.000000 0.000000 0.000003 0.000000 0.000000 0.999994 0.000000 0.000003 
Inferred value: 7
certik commented 6 months ago

I am going to merge it, because it works.