16#define WIN32_LEAN_AND_MEAN
57 std::variant<uint8_t, int8_t, uint16_t, int16_t, uint32_t, int32_t, float,
58 bool, std::string, uint64_t, int64_t, double,
GGUFArray>;
82 std::map<std::string, GGUFMetadataValue>
metadata;
97 HANDLE h_file = INVALID_HANDLE_VALUE;
98 HANDLE h_map_file = NULL;
130 if (h_map_file != NULL) {
131 CloseHandle(h_map_file);
133 if (h_file != INVALID_HANDLE_VALUE) {
136 h_file = INVALID_HANDLE_VALUE;
151 ,
metadata(std::move(other.metadata))
162 , h_file(other.h_file)
163 , h_map_file(other.h_map_file)
173 other.file_descriptor = -1;
175 other.h_file = INVALID_HANDLE_VALUE;
176 other.h_map_file = NULL;
178 other.mapped_tensor_data =
nullptr;
179 other.mapped_tensor_data_size = 0;
180 other.offset_diff_for_mmap = 0;
184 if (
this != &other) {
197 if (h_map_file != NULL) {
198 CloseHandle(h_map_file);
200 if (h_file != INVALID_HANDLE_VALUE) {
207 metadata = std::move(other.metadata);
219 h_file = other.h_file;
220 h_map_file = other.h_map_file;
230 other.file_descriptor = -1;
232 other.h_file = INVALID_HANDLE_VALUE;
233 other.h_map_file = NULL;
235 other.mapped_tensor_data =
nullptr;
236 other.mapped_tensor_data_size = 0;
237 other.offset_diff_for_mmap = 0;
Type definitions for GGML (Georgi Gerganov Machine Learning) library.
GGMLType
Enumeration of GGML tensor data types.
GGUFValueType
Enumeration of value types used in GGUF metadata.
std::variant< uint8_t, int8_t, uint16_t, int16_t, uint32_t, int32_t, float, bool, std::string, uint64_t, int64_t, double, GGUFArray > GGUFMetadataValue
Type for storing metadata values of various types.
Represents an array in GGUF metadata.
Complete representation of a GGUF file's contents.
static const void * MMapFailure
GGUFData & operator=(GGUFData &&other) noexcept
std::vector< GGUFTensorInfo > tensor_infos
std::vector< std::string > tokenizer_tokens
std::vector< float > tokenizer_scores
size_t offset_diff_for_mmap
std::vector< uint8_t > tensor_data
std::vector< std::string > tokenizer_merges
size_t mapped_tensor_data_size
std::map< std::string, GGUFMetadataValue > metadata
GGUFData(GGUFData &&other) noexcept
GGUFData(const GGUFData &)=delete
void * mapped_tensor_data
std::map< std::string, GGUFTensorInfo > tensor_infos_map
std::vector< uint32_t > tokenizer_token_types
GGUFData & operator=(const GGUFData &)=delete
Information about a tensor stored in a GGUF file.
std::vector< uint64_t > shape