Brunobkr/llama.cpp_AlgMor24_github
ΩFFFΣLLIa • llama.cpp • AlgMor24 ██████╗ ███████╗███████╗███████╗██╗ ██╗ ██╗ █████╗ ██╔═══██╗██╔════╝██╔════╝██╔════╝██║ ██║ ██║██╔══██╗ ██║ ██║█████╗ █████╗ █████╗ ██║ ██║ ██║███████║ ██║ ██║██╔══╝ ██╔══╝ ██╔══╝ ██║ ██║ ██║██╔══██║ ╚██████╔╝██║ ██║ ███████╗███████╗███████╗██║██║ ██║ ╚═════╝ ╚═╝ ╚═╝ ╚══════╝╚══════╝╚══════╝╚═╝╚═╝ ╚═╝ High-Performance LLM / VLM Inference & Autonomous Agentic Ecosystem… See the full description on the dataset page: https://huggingface.co/datasets/Brunobkr/llama.cpp_AlgMor24_github.
03.1k
1#pragma once2 3#include "common.h"4#include "arg.h"5 6#include <string>7#include <vector>8#include <map>9#include <set>10 11//12// INI preset parser and writer13//14 15constexpr const char * COMMON_PRESET_DEFAULT_NAME = "default";16 17struct common_preset_context;18 19struct common_preset {20 std::string name;21 22 // options are stored as common_arg to string mapping, representing CLI arg and its value23 std::map<common_arg, std::string> options;24 25 // convert preset to CLI argument list26 std::vector<std::string> to_args(const std::string & bin_path = "") const;27 28 // convert preset to INI format string29 std::string to_ini() const;30 31 // TODO: maybe implement to_env() if needed32 33 // modify preset options where argument is identified by its env variable34 void set_option(const common_preset_context & ctx, const std::string & env, const std::string & value);35 36 // unset option by its env variable37 void unset_option(const std::string & env);38 39 // get option value by its env variable, return false if not found40 bool get_option(const std::string & env, std::string & value) const;41 42 // merge another preset into this one, overwriting existing options43 void merge(const common_preset & other);44 45 // apply preset options to common_params46 // optionally specify handled_keys to only apply a subset of options (identified by their env), if empty, apply all options47 void apply_to_params(common_params & params, const std::set<std::string> & handled_keys = std::set<std::string>()) const;48};49 50// interface for multiple presets in one file51using common_presets = std::map<std::string, common_preset>;52 53// context for loading and editing presets54struct common_preset_context {55 common_params default_params; // unused for now56 common_params_context ctx_params;57 std::map<std::string, common_arg> key_to_opt;58 59 bool filter_allowed_keys = false;60 std::set<std::string> allowed_keys;61 62 // if only_remote_allowed is true, only accept whitelisted keys63 common_preset_context(llama_example ex);64 65 // load presets from INI file66 common_presets load_from_ini(const std::string & path, common_preset & global) const;67 68 // generate presets from cached models69 common_presets load_from_cache() const;70 71 // generate presets from local models directory72 // for the directory structure, see "Using multiple models" in server/README.md73 common_presets load_from_models_dir(const std::string & models_dir) const;74 75 // generate one preset from CLI arguments76 common_preset load_from_args(int argc, char ** argv) const;77 78 // cascade multiple presets if exist on both: base < added79 // if preset does not exist in base, it will be added without modification80 common_presets cascade(const common_presets & base, const common_presets & added) const;81 82 // apply presets over a base preset (same idea as CSS cascading)83 common_presets cascade(const common_preset & base, const common_presets & presets) const;84};85 