Text Generation
GGUF
English
llama.cpp
bitnet
ternary
1.58-bit
quantized
q4_k_m
edge
efficient-inference
cpu
tool-calling
Instructions to use Qapdex/SLM750-Edge-1.58-bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use Qapdex/SLM750-Edge-1.58-bit with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="Qapdex/SLM750-Edge-1.58-bit", filename="quantized_q4km.gguf", )
output = llm( "Once upon a time,", max_tokens=512, echo=True ) print(output)
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use Qapdex/SLM750-Edge-1.58-bit 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 Qapdex/SLM750-Edge-1.58-bit:Q4_K_M_QUANT # Run inference directly in the terminal: llama cli -hf Qapdex/SLM750-Edge-1.58-bit:Q4_K_M_QUANT
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf Qapdex/SLM750-Edge-1.58-bit:Q4_K_M_QUANT # Run inference directly in the terminal: llama cli -hf Qapdex/SLM750-Edge-1.58-bit:Q4_K_M_QUANT
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf Qapdex/SLM750-Edge-1.58-bit:Q4_K_M_QUANT # Run inference directly in the terminal: ./llama-cli -hf Qapdex/SLM750-Edge-1.58-bit:Q4_K_M_QUANT
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf Qapdex/SLM750-Edge-1.58-bit:Q4_K_M_QUANT # Run inference directly in the terminal: ./build/bin/llama-cli -hf Qapdex/SLM750-Edge-1.58-bit:Q4_K_M_QUANT
Use Docker
docker model run hf.co/Qapdex/SLM750-Edge-1.58-bit:Q4_K_M_QUANT
- LM Studio
- Jan
- vLLM
How to use Qapdex/SLM750-Edge-1.58-bit with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Qapdex/SLM750-Edge-1.58-bit" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Qapdex/SLM750-Edge-1.58-bit", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Qapdex/SLM750-Edge-1.58-bit:Q4_K_M_QUANT
- Ollama
How to use Qapdex/SLM750-Edge-1.58-bit with Ollama:
ollama run hf.co/Qapdex/SLM750-Edge-1.58-bit:Q4_K_M_QUANT
- Unsloth Studio
How to use Qapdex/SLM750-Edge-1.58-bit with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for Qapdex/SLM750-Edge-1.58-bit to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for Qapdex/SLM750-Edge-1.58-bit to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for Qapdex/SLM750-Edge-1.58-bit to start chatting
- Atomic Chat new
- Docker Model Runner
How to use Qapdex/SLM750-Edge-1.58-bit with Docker Model Runner:
docker model run hf.co/Qapdex/SLM750-Edge-1.58-bit:Q4_K_M_QUANT
- Lemonade
How to use Qapdex/SLM750-Edge-1.58-bit with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull Qapdex/SLM750-Edge-1.58-bit:Q4_K_M_QUANT
Run and chat with the model
lemonade run user.SLM750-Edge-1.58-bit-Q4_K_M_QUANT
List all available models
lemonade list
| // | |
| // logging | |
| // | |
| static float frand(void) { | |
| return (float)rand()/(float)RAND_MAX; | |
| } | |
| static struct ggml_tensor * get_random_tensor( | |
| struct ggml_context * ctx0, int ndims, int64_t ne[], float fmin, float fmax | |
| ) { | |
| struct ggml_tensor * result = ggml_new_tensor(ctx0, GGML_TYPE_F32, ndims, ne); | |
| switch (ndims) { | |
| case 1: | |
| for (int i0 = 0; i0 < ne[0]; i0++) { | |
| ((float *)result->data)[i0] = frand()*(fmax - fmin) + fmin; | |
| } | |
| break; | |
| case 2: | |
| for (int i1 = 0; i1 < ne[1]; i1++) { | |
| for (int i0 = 0; i0 < ne[0]; i0++) { | |
| ((float *)result->data)[i1*ne[0] + i0] = frand()*(fmax - fmin) + fmin; | |
| } | |
| } | |
| break; | |
| case 3: | |
| for (int i2 = 0; i2 < ne[2]; i2++) { | |
| for (int i1 = 0; i1 < ne[1]; i1++) { | |
| for (int i0 = 0; i0 < ne[0]; i0++) { | |
| ((float *)result->data)[i2*ne[1]*ne[0] + i1*ne[0] + i0] = frand()*(fmax - fmin) + fmin; | |
| } | |
| } | |
| } | |
| break; | |
| case 4: | |
| for (int i3 = 0; i3 < ne[3]; i3++) { | |
| for (int i2 = 0; i2 < ne[2]; i2++) { | |
| for (int i1 = 0; i1 < ne[1]; i1++) { | |
| for (int i0 = 0; i0 < ne[0]; i0++) { | |
| ((float *)result->data)[i3*ne[2]*ne[1]*ne[0] + i2*ne[1]*ne[0] + i1*ne[0] + i0] = frand()*(fmax - fmin) + fmin; | |
| } | |
| } | |
| } | |
| } | |
| break; | |
| default: | |
| assert(false); | |
| } | |
| return result; | |
| } | |
| int main(void) { | |
| struct ggml_init_params params = { | |
| /* .mem_size = */ 1024*1024*1024, | |
| /* .mem_buffer = */ NULL, | |
| /* .no_alloc = */ false, | |
| }; | |
| struct ggml_context * ctx = ggml_init(params); | |
| int64_t ne1[4] = {4, 128, 1, 1}; | |
| int64_t ne2[4] = {4, 256, 1, 1}; | |
| int64_t ne3[4] = {128, 256, 1, 1}; | |
| struct ggml_tensor * a = get_random_tensor(ctx, 2, ne1, -1, +1); | |
| struct ggml_tensor * b = get_random_tensor(ctx, 2, ne2, -1, +1); | |
| ggml_set_param(ctx, a); | |
| ggml_set_param(ctx, b); | |
| struct ggml_tensor * c = get_random_tensor(ctx, 2, ne3, -1, +1); | |
| struct ggml_tensor * ab = ggml_mul_mat(ctx, a, b); | |
| struct ggml_tensor * d = ggml_sub(ctx, c, ab); | |
| struct ggml_tensor * e = ggml_sum(ctx, ggml_sqr(ctx, d)); | |
| struct ggml_cgraph * ge = ggml_new_graph_custom(ctx, GGML_DEFAULT_GRAPH_SIZE, true); | |
| ggml_build_forward_expand(ge, e); | |
| ggml_graph_reset(ge); | |
| ggml_graph_compute_with_ctx(ctx, ge, /*n_threads*/ 1); | |
| const float fe = ggml_get_f32_1d(e, 0); | |
| printf("%s: e = %.4f\n", __func__, fe); | |
| struct ggml_opt_params opt_params = ggml_opt_default_params(GGML_OPT_TYPE_ADAM); | |
| ggml_opt(ctx, opt_params, e); | |
| ggml_graph_reset(ge); | |
| ggml_graph_compute_with_ctx(ctx, ge, /*n_threads*/ 1); | |
| const float fe_opt = ggml_get_f32_1d(e, 0); | |
| printf("%s: original e = %.4f\n", __func__, fe); | |
| printf("%s: optimized e = %.4f\n", __func__, fe_opt); | |
| const bool success = (fe_opt <= fe); | |
| assert(success); | |
| ggml_free(ctx); | |
| return success ? 0 : -1; | |
| } | |
| // int64_t ne1[4] = {4, 128, 1, 1}; | |
| // int64_t ne2[4] = {4, 256, 1, 1};; | |
| // int64_t ne3[4] = {128, 256, 1, 1}; | |
| // main: original e = 25890.9375 | |
| // main: optimized e = 10094.7031 | |
| // int64_t ne1[4] = {8, 128, 1, 1}; | |
| // int64_t ne2[4] = {8, 256, 1, 1};; | |
| // int64_t ne3[4] = {128, 256, 1, 1}; | |
| // main: original e = 39429.5078 | |
| // main: optimized e = 9275.8936 | |
| // int64_t ne1[4] = {16, 128, 1, 1}; | |
| // int64_t ne2[4] = {16, 256, 1, 1};; | |
| // int64_t ne3[4] = {128, 256, 1, 1}; | |
| // main: original e = 68371.1328 | |
| // main: optimized e = 7854.4502 | |
| // int64_t ne1[4] = {32, 128, 1, 1}; | |
| // int64_t ne2[4] = {32, 256, 1, 1};; | |
| // int64_t ne3[4] = {128, 256, 1, 1}; | |
| // main: original e = 126061.1953 | |
| // main: optimized e = 5451.0166 | |
| // int64_t ne1[4] = {4, 1024, 1, 1}; | |
| // int64_t ne2[4] = {4, 2048, 1, 1};; | |
| // int64_t ne3[4] = {1024, 2048, 1, 1}; | |
| // main: original e = 1620817.8750 | |
| // main: optimized e = 698387.6875 | |
| // another run on M1 | |
| // int64_t ne1[4] = {4, 1024, 1, 1}; | |
| // int64_t ne2[4] = {4, 2048, 1, 1};; | |
| // int64_t ne3[4] = {1024, 2048, 1, 1}; | |
| // main: original e = 1629595.6250 | |
| // main: optimized e = 698169.1250 | |
| // int64_t ne1[4] = {32, 1024, 1, 1}; | |
| // int64_t ne2[4] = {32, 2048, 1, 1};; | |
| // int64_t ne3[4] = {1024, 2048, 1, 1}; | |
| // main: original e = 8146770.5000 | |
| // main: optimized e = 651119.1250 | |