![]() |
Nilorea Library
C utilities for networking, threading, graphics
|
Data Structures | |
| struct | N_PTH |
| A checkpoint's tensors. More... | |
| struct | N_PTH_TENSOR |
| One tensor of a checkpoint. More... | |
Macros | |
| #define | N_PTH_MAX_DIMS 8 |
| Most dimensions a tensor read may have. | |
Functions | |
| const N_PTH_TENSOR * | n_pth_find (const N_PTH *pth, const char *name) |
| find a tensor by its path | |
| void | n_pth_free (N_PTH **pth) |
| release a checkpoint's tensors | |
| N_PTH * | n_pth_load (const char *path) |
| read every tensor of a checkpoint | |
| struct N_PTH |
| Data Fields | ||
|---|---|---|
| size_t | count | how many |
| N_PTH_TENSOR * | tensors | the tensors, in the order the file lists them |
| struct N_PTH_TENSOR |
| #define N_PTH_MAX_DIMS 8 |
Most dimensions a tensor read may have.
Definition at line 63 of file n_pth.h.
Referenced by tensor_read().
| const N_PTH_TENSOR * n_pth_find | ( | const N_PTH * | pth, |
| const char * | name ) |
find a tensor by its path
| pth | the checkpoint |
| name | the path, "state_dict.backbone.0.0.weight" |
Definition at line 776 of file n_pth.c.
References N_PTH::count, N_PTH_TENSOR::name, and N_PTH::tensors.
Referenced by main().
| void n_pth_free | ( | N_PTH ** | pth | ) |
release a checkpoint's tensors
| pth | the checkpoint, set to NULL |
Definition at line 784 of file n_pth.c.
Referenced by main(), and n_pth_load().
| N_PTH * n_pth_load | ( | const char * | path | ) |
read every tensor of a checkpoint
| path | the .pth or .pt file |
Definition at line 738 of file n_pth.c.
References PK_VM::all, PK_VM::all_n, collect(), PK_OBJ::items, LOG_ERR, PK_VM::memo, n_log, n_pth_free(), n_zip_find_ending(), n_zip_read(), pk_run(), PTH_PICKLE_MAX, PK_OBJ::s, and PK_VM::stack.
Referenced by main().