1#pragma once
 2
 3#include "llama.h"
 4#include "llama-arch.h"
 5
 6#include <vector>
 7
 8struct llama_model_saver {
 9    struct gguf_context * gguf_ctx = nullptr;
10    const struct llama_model & model;
11    const struct LLM_KV llm_kv;
12
13    llama_model_saver(const struct llama_model & model);
14    ~llama_model_saver();
15
16    void add_kv(enum llm_kv key, uint32_t     value);
17    void add_kv(enum llm_kv key, int32_t      value);
18    void add_kv(enum llm_kv key, float        value);
19    void add_kv(enum llm_kv key, bool         value);
20    void add_kv(enum llm_kv key, const char * value);
21
22    [[noreturn]]
23    void add_kv(enum llm_kv key, char value); // needed to make the template below compile
24
25    template <typename Container>
26    void add_kv(enum llm_kv key, const Container & value, bool per_layer = false);
27
28    void add_kv(enum llm_kv key, const std::vector<std::string> & value);
29
30    void add_tensor(const struct ggml_tensor * tensor);
31
32    void add_kv_from_model();
33
34    void add_tensors_from_model();
35
36    void save(const std::string & path_model);
37};