Instructions to use UlukaDev/bitnet-ternary-moe-gguf 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 UlukaDev/bitnet-ternary-moe-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 UlukaDev/bitnet-ternary-moe-gguf:TQ1_0 # Run inference directly in the terminal: llama cli -hf UlukaDev/bitnet-ternary-moe-gguf:TQ1_0
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf UlukaDev/bitnet-ternary-moe-gguf:TQ1_0 # Run inference directly in the terminal: llama cli -hf UlukaDev/bitnet-ternary-moe-gguf:TQ1_0
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 UlukaDev/bitnet-ternary-moe-gguf:TQ1_0 # Run inference directly in the terminal: ./llama-cli -hf UlukaDev/bitnet-ternary-moe-gguf:TQ1_0
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 UlukaDev/bitnet-ternary-moe-gguf:TQ1_0 # Run inference directly in the terminal: ./build/bin/llama-cli -hf UlukaDev/bitnet-ternary-moe-gguf:TQ1_0
Use Docker
docker model run hf.co/UlukaDev/bitnet-ternary-moe-gguf:TQ1_0
- LM Studio
- Jan
- Ollama
How to use UlukaDev/bitnet-ternary-moe-gguf with Ollama:
ollama run hf.co/UlukaDev/bitnet-ternary-moe-gguf:TQ1_0
- Unsloth Desktop
- Docker Model Runner
How to use UlukaDev/bitnet-ternary-moe-gguf with Docker Model Runner:
docker model run hf.co/UlukaDev/bitnet-ternary-moe-gguf:TQ1_0
- Lemonade
How to use UlukaDev/bitnet-ternary-moe-gguf with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull UlukaDev/bitnet-ternary-moe-gguf:TQ1_0
Run and chat with the model
lemonade run user.bitnet-ternary-moe-gguf-TQ1_0
List all available models
lemonade list
- Atomic Chat
Upload moe_driver.py with huggingface_hub
Browse files- moe_driver.py +36 -1
moe_driver.py
CHANGED
|
@@ -32,6 +32,37 @@ SYSTEM = {0: CALC, 1: CALC} # per-id system prompt; extend later
|
|
| 32 |
SERVER_DOWN_HINT = ("\nThe AI server isn't running. "
|
| 33 |
"Double-click START HERE.bat first, then try again.")
|
| 34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
print("Loading router + embedder...")
|
| 36 |
embedder = SentenceTransformer("all-MiniLM-L6-v2")
|
| 37 |
router = joblib.load(hf_hub_download(ROUTER, "router.joblib"))
|
|
@@ -73,7 +104,7 @@ def answer(q: str) -> tuple[int, str]:
|
|
| 73 |
resp = requests.post(f"{SERVER}/v1/chat/completions", json={
|
| 74 |
"messages": [{"role": "system", "content": SYSTEM[idx]},
|
| 75 |
{"role": "user", "content": q}],
|
| 76 |
-
"max_tokens":
|
| 77 |
}, stream=True, timeout=600)
|
| 78 |
resp.raise_for_status()
|
| 79 |
|
|
@@ -118,6 +149,7 @@ if __name__ == "__main__":
|
|
| 118 |
print(" Convert 1994 to Roman numerals")
|
| 119 |
print("\033[91mTip: press Ctrl+C to stop an answer early.\033[0m "
|
| 120 |
"Close the window when you are done.")
|
|
|
|
| 121 |
|
| 122 |
while True:
|
| 123 |
try:
|
|
@@ -126,6 +158,9 @@ if __name__ == "__main__":
|
|
| 126 |
break
|
| 127 |
if not q:
|
| 128 |
continue
|
|
|
|
|
|
|
|
|
|
| 129 |
try:
|
| 130 |
answer(q)
|
| 131 |
except KeyboardInterrupt:
|
|
|
|
| 32 |
SERVER_DOWN_HINT = ("\nThe AI server isn't running. "
|
| 33 |
"Double-click START HERE.bat first, then try again.")
|
| 34 |
|
| 35 |
+
DEFAULT_MAX_TOKENS = 384
|
| 36 |
+
max_tokens = DEFAULT_MAX_TOKENS
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
def handle_command(cmd: str) -> None:
|
| 40 |
+
"""Handle a /command typed at the prompt. Never raises."""
|
| 41 |
+
global max_tokens
|
| 42 |
+
parts = cmd.split()
|
| 43 |
+
if parts[0].lower() != "/limit":
|
| 44 |
+
print("Unknown command. Available: /limit N "
|
| 45 |
+
"(sets the max answer length, default "
|
| 46 |
+
f"{DEFAULT_MAX_TOKENS})")
|
| 47 |
+
return
|
| 48 |
+
if len(parts) == 1:
|
| 49 |
+
print(f"Current output limit: {max_tokens} tokens. "
|
| 50 |
+
f"Usage: /limit 200")
|
| 51 |
+
return
|
| 52 |
+
try:
|
| 53 |
+
n = int(parts[1])
|
| 54 |
+
except ValueError:
|
| 55 |
+
print(f"'{parts[1]}' is not a number. Usage: /limit 200")
|
| 56 |
+
return
|
| 57 |
+
if n < 16 or n > 4096:
|
| 58 |
+
print("Please pick a limit between 16 and 4096.")
|
| 59 |
+
return
|
| 60 |
+
if n < 150:
|
| 61 |
+
print("Warning: below ~150, long correct answers may get cut off "
|
| 62 |
+
f"before they finish — {DEFAULT_MAX_TOKENS} is the safe default.")
|
| 63 |
+
max_tokens = n
|
| 64 |
+
print(f"Output limit set to {max_tokens} tokens.")
|
| 65 |
+
|
| 66 |
print("Loading router + embedder...")
|
| 67 |
embedder = SentenceTransformer("all-MiniLM-L6-v2")
|
| 68 |
router = joblib.load(hf_hub_download(ROUTER, "router.joblib"))
|
|
|
|
| 104 |
resp = requests.post(f"{SERVER}/v1/chat/completions", json={
|
| 105 |
"messages": [{"role": "system", "content": SYSTEM[idx]},
|
| 106 |
{"role": "user", "content": q}],
|
| 107 |
+
"max_tokens": max_tokens, "temperature": 0.0, "stream": True,
|
| 108 |
}, stream=True, timeout=600)
|
| 109 |
resp.raise_for_status()
|
| 110 |
|
|
|
|
| 149 |
print(" Convert 1994 to Roman numerals")
|
| 150 |
print("\033[91mTip: press Ctrl+C to stop an answer early.\033[0m "
|
| 151 |
"Close the window when you are done.")
|
| 152 |
+
print(f"Type /limit 200 to shorten answers (default {DEFAULT_MAX_TOKENS}).")
|
| 153 |
|
| 154 |
while True:
|
| 155 |
try:
|
|
|
|
| 158 |
break
|
| 159 |
if not q:
|
| 160 |
continue
|
| 161 |
+
if q.startswith("/"):
|
| 162 |
+
handle_command(q)
|
| 163 |
+
continue
|
| 164 |
try:
|
| 165 |
answer(q)
|
| 166 |
except KeyboardInterrupt:
|