Instructions to use Kentucky-Open-Science/KOS-V4-Instruct-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Kentucky-Open-Science/KOS-V4-Instruct-GGUF with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Kentucky-Open-Science/KOS-V4-Instruct-GGUF") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Kentucky-Open-Science/KOS-V4-Instruct-GGUF", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use Kentucky-Open-Science/KOS-V4-Instruct-GGUF 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 Kentucky-Open-Science/KOS-V4-Instruct-GGUF:Q4_K_M # Run inference directly in the terminal: llama cli -hf Kentucky-Open-Science/KOS-V4-Instruct-GGUF:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf Kentucky-Open-Science/KOS-V4-Instruct-GGUF:Q4_K_M # Run inference directly in the terminal: llama cli -hf Kentucky-Open-Science/KOS-V4-Instruct-GGUF:Q4_K_M
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 Kentucky-Open-Science/KOS-V4-Instruct-GGUF:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf Kentucky-Open-Science/KOS-V4-Instruct-GGUF:Q4_K_M
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 Kentucky-Open-Science/KOS-V4-Instruct-GGUF:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf Kentucky-Open-Science/KOS-V4-Instruct-GGUF:Q4_K_M
Use Docker
docker model run hf.co/Kentucky-Open-Science/KOS-V4-Instruct-GGUF:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use Kentucky-Open-Science/KOS-V4-Instruct-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Kentucky-Open-Science/KOS-V4-Instruct-GGUF" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Kentucky-Open-Science/KOS-V4-Instruct-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Kentucky-Open-Science/KOS-V4-Instruct-GGUF:Q4_K_M
- SGLang
How to use Kentucky-Open-Science/KOS-V4-Instruct-GGUF with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "Kentucky-Open-Science/KOS-V4-Instruct-GGUF" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Kentucky-Open-Science/KOS-V4-Instruct-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "Kentucky-Open-Science/KOS-V4-Instruct-GGUF" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Kentucky-Open-Science/KOS-V4-Instruct-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use Kentucky-Open-Science/KOS-V4-Instruct-GGUF with Ollama:
ollama run hf.co/Kentucky-Open-Science/KOS-V4-Instruct-GGUF:Q4_K_M
- Unsloth Studio
How to use Kentucky-Open-Science/KOS-V4-Instruct-GGUF 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 Kentucky-Open-Science/KOS-V4-Instruct-GGUF 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 Kentucky-Open-Science/KOS-V4-Instruct-GGUF to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for Kentucky-Open-Science/KOS-V4-Instruct-GGUF to start chatting
- Pi
How to use Kentucky-Open-Science/KOS-V4-Instruct-GGUF with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf Kentucky-Open-Science/KOS-V4-Instruct-GGUF:Q4_K_M
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "Kentucky-Open-Science/KOS-V4-Instruct-GGUF:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use Kentucky-Open-Science/KOS-V4-Instruct-GGUF with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf Kentucky-Open-Science/KOS-V4-Instruct-GGUF:Q4_K_M
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default Kentucky-Open-Science/KOS-V4-Instruct-GGUF:Q4_K_M
Run Hermes
hermes
- Atomic Chat new
- OpenClaw new
How to use Kentucky-Open-Science/KOS-V4-Instruct-GGUF with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf Kentucky-Open-Science/KOS-V4-Instruct-GGUF:Q4_K_M
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "Kentucky-Open-Science/KOS-V4-Instruct-GGUF:Q4_K_M" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
- Docker Model Runner
How to use Kentucky-Open-Science/KOS-V4-Instruct-GGUF with Docker Model Runner:
docker model run hf.co/Kentucky-Open-Science/KOS-V4-Instruct-GGUF:Q4_K_M
- Lemonade
How to use Kentucky-Open-Science/KOS-V4-Instruct-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull Kentucky-Open-Science/KOS-V4-Instruct-GGUF:Q4_K_M
Run and chat with the model
lemonade run user.KOS-V4-Instruct-GGUF-Q4_K_M
List all available models
lemonade list
| """Vocab-only GGUF conversions of kos-v4 tokenizer with different forced pre-types, | |
| then token-parity vs HF across several representative strings. Fast (no weights).""" | |
| import os, sys, re, subprocess, tempfile | |
| LL="/workspace/llm/llama.cpp" | |
| SRC="/workspace/llm/kos-v4-conv" # conversion mirror (no tokenizer.model) | |
| TOKREF="/workspace/llm/kos-v4-instruct" # pristine HF tokenizer | |
| OUTDIR="/tmp/claude-0/-workspace/f1993a73-9699-445b-818e-eb56628e7541/scratchpad/vocabtest" | |
| os.makedirs(OUTDIR, exist_ok=True) | |
| TOKBIN=f"{LL}/build/bin/llama-tokenize" | |
| from transformers import AutoTokenizer | |
| at = AutoTokenizer.from_pretrained(TOKREF) | |
| PROMPTS = [ | |
| "<|im_start|>system\nYou are a helpful medical assistant.<|im_end|>\n<|im_start|>user\nList three symptoms of anemia.<|im_end|>\n<|im_start|>assistant\n", | |
| "Write exactly 3 bullet points.\n- one\n- two\n- three\n", | |
| "The patient's BP was 148/92 (elevated). Multiple spaces and\ttabs.\n\nNew paragraph.", | |
| "Answer in ALL CAPS: what is 2+2? Also use commas, semicolons; and dashes—like this.", | |
| ] | |
| def convert_vocab_only(pre): | |
| out=f"{OUTDIR}/vocab_{pre}.gguf" | |
| code=f''' | |
| import os,sys,re,gguf | |
| sys.path.insert(0,"{LL}"); os.chdir("{LL}") | |
| from conversion.base import TextModel | |
| def _pre(self,tok): return "{pre}" | |
| TextModel.get_vocab_base_pre=_pre | |
| _byte=re.compile(r"^<0x[0-9A-Fa-f]{{2}}>$") | |
| _ob=TextModel.get_vocab_base | |
| def _bp(self): | |
| t,tt,tp=_ob(self) | |
| for i,x in enumerate(t): | |
| if _byte.match(x) and tt[i]!=gguf.TokenType.BYTE: tt[i]=gguf.TokenType.BYTE | |
| return t,tt,tp | |
| TextModel.get_vocab_base=_bp | |
| import convert_hf_to_gguf as c | |
| sys.argv=["x","--outfile","{out}","--outtype","f16","--vocab-only","{SRC}"] | |
| try: c.main() | |
| except SystemExit as e: | |
| if e.code not in (None,0): raise | |
| ''' | |
| r=subprocess.run([sys.executable,"-c",code],capture_output=True,text=True) | |
| if not os.path.exists(out): | |
| return None, r.stderr[-300:] | |
| return out, None | |
| def gg_tokenize(gguf_path, text): | |
| r=subprocess.run([TOKBIN,"-m",gguf_path,"-p",text,"--ids"],capture_output=True,text=True) | |
| line=next((l for l in r.stdout.splitlines() if l.strip().startswith("[")),"") | |
| return [int(x) for x in line.strip().strip("[]").replace(","," ").split()] if line else None | |
| for pre in ["qwen2","gpt-2","default","llama-bpe","tekken"]: | |
| out,err=convert_vocab_only(pre) | |
| if out is None: | |
| print(f"pre={pre:10} CONVERT FAILED: {err}"); continue | |
| allok=True; details=[] | |
| for p in PROMPTS: | |
| hf=at(p,add_special_tokens=False)["input_ids"] | |
| gg=gg_tokenize(out,p) | |
| ok=(gg==hf) | |
| allok&=ok | |
| details.append(("OK" if ok else f"MISS(hf{len(hf)}/gg{len(gg) if gg else '?'})")) | |
| print(f"pre={pre:10} {'ALL-PARITY ✅' if allok else 'mismatch'} {details}") | |