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
| // GBNF Grammatik-Definition, die das Modell auf exakte JSON-Tool-Calls zwingt | |
| const std::string JSON_GRAMMAR = | |
| "root ::= object\n" | |
| "object ::= \"{\n \\\"action\\\": \\\"\" name \"\\\",\n \\\"parameters\\\": \" params \"\n}\"\n" | |
| "name ::= [a-zA-Z0-9_]+\n" | |
| "params ::= \"{\n \" pair ( \",\n \" pair )* \"\n }\"\n" | |
| "pair ::= \"\\\"\" [a-zA-Z0-9_]+ \"\\\": \\\"\" [^\"]* \"\\\"\""; | |
| int main(int argc, char ** argv) { | |
| // 1. Hardware-Parameter für Smartphone-SoCs initialisieren | |
| llama_model_params model_params = llama_model_default_params(); | |
| model_params.use_mmap = true; // Direktes Mapping in den RAM (schont die Batterie) | |
| model_params.main_gpu = 0; // Nutze GPU/NPU falls via Metal/Vulkan kompiliert | |
| // 2. Das kompakte 300MB Modell laden | |
| std::string model_path = "slm750_edge_q4_k.gguf"; | |
| llama_model * model = llama_load_model_from_file(model_path.c_str(), model_params); | |
| if (!model) { | |
| std::cerr << "Fehler: Modell konnte nicht geladen werden!" << std::endl; | |
| return 1; | |
| } | |
| // 3. Kontext für hocheffizientes Batch-Processing aufsetzen | |
| llama_context_params ctx_params = llama_context_default_params(); | |
| ctx_params.n_ctx = 2048; // Gleiche Kontext-Länge wie im Trainings-Skript von Neo | |
| ctx_params.n_batch = 512; | |
| ctx_params.n_threads = 4; // Optimal für die "Big-Cores" moderner Smartphone-CPUs | |
| llama_context * ctx = llama_new_context_with_model(model, ctx_params); | |
| // 4. Grammatik-Parser initialisieren (Der "Wow-Effekt" Garant für 100% JSON-Validität) | |
| auto grammar = llama_grammar_init(JSON_GRAMMAR.c_str()); | |
| // 5. Prompt für den Tool-Call vorbereiten | |
| std::string prompt = "User: Erstelle eine neue Stellenausschreibung für einen Senior App Developer.\nAgent:"; | |
| std::vector<llama_token> tokens = llama_tokenize(ctx, prompt, true); | |
| // Prompt in den KV-Cache evaluieren | |
| llama_decode(ctx, llama_batch_get_one(tokens.data(), tokens.size(), 0, 0)); | |
| std::cout << "Generiere ultraschnellen Tool-Call...\n" << std::endl; | |
| // 6. Token-Generierungs-Schleife mit Grammatik-Zwang | |
| for (int i = 0; i < 200; ++i) { | |
| auto candidates = llama_sampler_get_candidates(ctx); | |
| // Zwinge das Modell, nur Tokens zu wählen, die zur JSON-Grammatik passen | |
| llama_grammar_sample(grammar, ctx, &candidates); | |
| llama_token token = llama_sampler_sample(ctx, &candidates); | |
| // Abbruch bei End-of-Token | |
| if (token == llama_token_eos(model)) break; | |
| // Token sofort auf dem Bildschirm ausgeben | |
| std::cout << llama_token_to_piece(ctx, token); | |
| std::flush(std::cout); | |
| // Nächstes Token verarbeiten | |
| llama_decode(ctx, llama_batch_get_one(&token, 1, i + tokens.size(), 0)); | |
| } | |
| // Speicherbereinigung | |
| llama_grammar_free(grammar); | |
| llama_free(ctx); | |
| llama_free_model(model); | |
| return 0; | |
| } | |