Instructions to use VladHong/llama-cpp-K2-FAST2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use VladHong/llama-cpp-K2-FAST2 with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf VladHong/llama-cpp-K2-FAST2 # Run inference directly in the terminal: llama cli -hf VladHong/llama-cpp-K2-FAST2
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf VladHong/llama-cpp-K2-FAST2 # Run inference directly in the terminal: llama cli -hf VladHong/llama-cpp-K2-FAST2
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf VladHong/llama-cpp-K2-FAST2 # Run inference directly in the terminal: ./build/bin/llama cli -hf VladHong/llama-cpp-K2-FAST2
Use Docker
docker model run hf.co/VladHong/llama-cpp-K2-FAST2
- Llama new
- LM Studio
- Jan
- Ollama
How to use VladHong/llama-cpp-K2-FAST2 with Ollama:
ollama run hf.co/VladHong/llama-cpp-K2-FAST2
- Unsloth Desktop
- Docker Model Runner
How to use VladHong/llama-cpp-K2-FAST2 with Docker Model Runner:
docker model run hf.co/VladHong/llama-cpp-K2-FAST2
- Lemonade
How to use VladHong/llama-cpp-K2-FAST2 with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull VladHong/llama-cpp-K2-FAST2
Run and chat with the model
lemonade run user.llama-cpp-K2-FAST2-{{QUANT_TAG}}List all available models
lemonade list
- Atomic Chat
Download tools/tuning/main.cpp from VladHong/llama-cpp-K2-FAST2: direct link, hf CLI and curl.
- Browser
- Download file 5.11 kB
-
https://huggingface.co/VladHong/llama-cpp-K2-FAST2/resolve/main/tools/tuning/main.cpp
- Command line
-
hf download hf://VladHong/llama-cpp-K2-FAST2/tools/tuning/main.cpp
-
curl -L -o main.cpp https://huggingface.co/VladHong/llama-cpp-K2-FAST2/resolve/main/tools/tuning/main.cpp
5.11 kB
| struct tuner_def { | |
| const char * name; | |
| bool (*run)(ggml_backend_t, ggml_backend_dev_t, const tuner_opts &); | |
| }; | |
| static const tuner_def k_tuners[] = { | |
| { "fa-vec", tuner_fa_vec_run }, | |
| }; | |
| static void usage(const char * argv0) { | |
| printf("usage: %s <tuner> [options]\n", argv0); | |
| printf("\n"); | |
| printf(" offline kernel tuner for the Metal backend: sweeps a kernel's config grid and\n"); | |
| printf(" prints pasteable table rows for the machine it runs on. never a pass/fail test.\n"); | |
| printf("\n"); | |
| printf(" tuners:\n"); | |
| printf(" fa-vec flash-attn vec (Q,NE) for ggml-metal-tuning.cpp\n"); | |
| printf("\n"); | |
| printf(" options:\n"); | |
| printf(" -b <name> backend device (default: first Metal device)\n"); | |
| printf(" --dtype <list> restrict KV dtypes, e.g. f16,q4_0 (default: all)\n"); | |
| printf(" --dk <list> restrict head sizes, e.g. 128,192 (default: all)\n"); | |
| printf(" --reps <n> timed reps per candidate, odd for an exact median (default: 7)\n"); | |
| printf(" --seed <n> RNG seed; per-cell seeds mix it with the shape (default: 1234)\n"); | |
| printf(" --no-cooldown do not pause/re-measure on thermal drift, only warn\n"); | |
| printf(" --cool-drift <f> anchor drift that triggers a cooldown (default: 0.10)\n"); | |
| printf(" --cool-eps <f> anchor tolerance to consider the GPU cool again (default: 0.03)\n"); | |
| printf(" --cool-max-wait <s> give up cooling a cell after this many seconds (default: 120)\n"); | |
| printf(" --cool-max-retry <n> re-measure rounds per cell before giving up (default: 2)\n"); | |
| printf("\n"); | |
| printf(" the table goes to stdout, all diagnostics to stderr:\n"); | |
| printf(" %s fa-vec > rows.txt 2> sweep.log\n", argv0); | |
| } | |
| int main(int argc, char ** argv) { | |
| const char * tuner = nullptr; | |
| const char * bname = nullptr; | |
| tuner_opts opts; | |
| for (int i = 1; i < argc; i++) { | |
| const char * a = argv[i]; | |
| if (strcmp(a, "-h") == 0 || strcmp(a, "--help") == 0) { | |
| usage(argv[0]); | |
| return 0; | |
| } else if (strcmp(a, "-b") == 0 && i + 1 < argc) { | |
| bname = argv[++i]; | |
| } else if (strcmp(a, "--dtype") == 0 && i + 1 < argc) { | |
| opts.dtype_filter = argv[++i]; | |
| } else if (strcmp(a, "--dk") == 0 && i + 1 < argc) { | |
| opts.dk_filter = argv[++i]; | |
| } else if (strcmp(a, "--reps") == 0 && i + 1 < argc) { | |
| opts.reps = atoi(argv[++i]); | |
| } else if (strcmp(a, "--seed") == 0 && i + 1 < argc) { | |
| opts.seed = (unsigned) strtoul(argv[++i], nullptr, 10); | |
| } else if (strcmp(a, "--no-cooldown") == 0) { | |
| opts.cooldown = false; | |
| } else if (strcmp(a, "--cool-drift") == 0 && i + 1 < argc) { | |
| opts.cool_drift = atof(argv[++i]); | |
| } else if (strcmp(a, "--cool-eps") == 0 && i + 1 < argc) { | |
| opts.cool_eps = atof(argv[++i]); | |
| } else if (strcmp(a, "--cool-max-wait") == 0 && i + 1 < argc) { | |
| opts.cool_max_wait = atoi(argv[++i]); | |
| } else if (strcmp(a, "--cool-max-retry") == 0 && i + 1 < argc) { | |
| opts.cool_max_retry = atoi(argv[++i]); | |
| } else if (a[0] != '-' && tuner == nullptr) { | |
| tuner = a; | |
| } else { | |
| fprintf(stderr, "error: unrecognized or incomplete argument: %s\n\n", a); | |
| usage(argv[0]); | |
| return 1; | |
| } | |
| } | |
| if (tuner == nullptr) { | |
| usage(argv[0]); | |
| return 1; | |
| } | |
| if (opts.reps < 1) { | |
| fprintf(stderr, "error: --reps must be >= 1\n"); | |
| return 1; | |
| } | |
| const tuner_def * t = nullptr; | |
| for (const auto & cand : k_tuners) { | |
| if (strcmp(tuner, cand.name) == 0) { | |
| t = &cand; | |
| break; | |
| } | |
| } | |
| if (t == nullptr) { | |
| fprintf(stderr, "error: unknown tuner: %s\n\n", tuner); | |
| usage(argv[0]); | |
| return 1; | |
| } | |
| ggml_backend_load_all(); | |
| ggml_backend_dev_t dev = nullptr; | |
| for (size_t i = 0; i < ggml_backend_dev_count(); i++) { | |
| ggml_backend_dev_t d = ggml_backend_dev_get(i); | |
| if (bname) { | |
| if (strcmp(ggml_backend_dev_name(d), bname) == 0) { | |
| dev = d; | |
| break; | |
| } | |
| } else if (strncmp(ggml_backend_dev_name(d), "MTL", 3) == 0) { | |
| dev = d; | |
| break; | |
| } | |
| } | |
| if (dev == nullptr) { | |
| fprintf(stderr, "error: no %s device found\n", bname ? bname : "Metal"); | |
| return 1; | |
| } | |
| ggml_backend_t backend = ggml_backend_dev_init(dev, nullptr); | |
| if (backend == nullptr) { | |
| fprintf(stderr, "error: failed to init backend %s\n", ggml_backend_dev_name(dev)); | |
| return 1; | |
| } | |
| fprintf(stderr, "device: %s (%s)\n", ggml_backend_dev_name(dev), ggml_backend_dev_description(dev)); | |
| const bool ok = t->run(backend, dev, opts); | |
| ggml_backend_free(backend); | |
| ggml_quantize_free(); | |
| return ok ? 0 : 1; | |
| } | |