Felipe97/llama-cpp-compiled
01.1k
1#pragma once2 3#include "gguf.h"4#include "llama.h"5#include "llama-arch.h"6 7#include <vector>8 9// FIXME temporary function for better error messages10bool llama_model_saver_supports_arch(llm_arch arch);11 12struct llama_model_saver {13 struct gguf_context * gguf_ctx = nullptr;14 const bool gguf_ctx_owned;15 const struct llama_model * model;16 const struct LLM_KV llm_kv;17 18 llama_model_saver(const struct llama_model * model);19 llama_model_saver(enum llm_arch arch, struct gguf_context * gguf_ctx);20 ~llama_model_saver();21 22 void add_kv(enum llm_kv key, uint32_t value);23 void add_kv(enum llm_kv key, int32_t value);24 void add_kv(enum llm_kv key, uint64_t value);25 void add_kv(enum llm_kv key, float value);26 void add_kv(enum llm_kv key, bool value);27 void add_kv(enum llm_kv key, const char * value);28 29 [[noreturn]]30 void add_kv(enum llm_kv key, char value); // needed to make the template below compile31 32 template <typename Container>33 void add_kv(enum llm_kv key, const Container & value, bool per_layer = false);34 35 void add_kv(enum llm_kv key, const std::vector<std::string> & value);36 37 void add_tensor(const struct ggml_tensor * tensor);38 39 void add_kv_from_model();40 41 void add_tensors_from_model();42 43 void save(const std::string & path_model);44 void save(FILE * file);45};46 