Text Generation
MLX
Safetensors
English
Korean
Japanese
solar_open2
solar
solar-open2
Mixture of Experts
quantized
8bit
conversational
8-bit precision
Instructions to use TensorFold/Solar-Open2-250B-MLX-8bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use TensorFold/Solar-Open2-250B-MLX-8bit with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("TensorFold/Solar-Open2-250B-MLX-8bit") prompt = "Write a story about Einstein" messages = [{"role": "user", "content": prompt}] prompt = tokenizer.apply_chat_template( messages, add_generation_prompt=True ) text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Pi
How to use TensorFold/Solar-Open2-250B-MLX-8bit with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "TensorFold/Solar-Open2-250B-MLX-8bit"
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "mlx-lm": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "TensorFold/Solar-Open2-250B-MLX-8bit" } ] } } }Run Pi
# Start Pi in your project directory: pi
- MLX LM
How to use TensorFold/Solar-Open2-250B-MLX-8bit with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "TensorFold/Solar-Open2-250B-MLX-8bit"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "TensorFold/Solar-Open2-250B-MLX-8bit" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "TensorFold/Solar-Open2-250B-MLX-8bit", "messages": [ {"role": "user", "content": "Hello"} ] }' - Hermes Agent
How to use TensorFold/Solar-Open2-250B-MLX-8bit with Hermes Agent:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "TensorFold/Solar-Open2-250B-MLX-8bit"
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 TensorFold/Solar-Open2-250B-MLX-8bit
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use TensorFold/Solar-Open2-250B-MLX-8bit with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "TensorFold/Solar-Open2-250B-MLX-8bit"
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 "TensorFold/Solar-Open2-250B-MLX-8bit" \ --custom-provider-id mlx-lm \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
File size: 3,805 Bytes
150aa2a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | import ast
import json
import re
from typing import Any
tool_call_start = "<|tool_call:start|>"
tool_call_end = "<|tool_call:end|>"
_ARG_RE = re.compile(
r"<\|tool_arg:start\|>(.*?)<\|tool_arg:value\|>(.*?)<\|tool_arg:end\|>",
re.DOTALL,
)
_STRING_TYPES = {"string", "str", "text", "varchar", "char", "enum"}
_BOOL_TYPES = {"boolean", "bool", "binary"}
_INT_PREFIXES = ("int", "uint", "long", "short", "unsigned")
_FLOAT_PREFIXES = ("num", "float", "double", "decimal")
_JSON_TYPES = {"object", "array", "arr", "dict", "list"}
def _tool_properties(name: str, tools: Any | None) -> dict[str, Any]:
if not tools:
return {}
for tool in tools:
function = tool.get("function") if isinstance(tool, dict) else None
if function and function.get("name") == name:
params = function.get("parameters") or {}
return params.get("properties") or {}
return {}
def _schema_type(properties: dict[str, Any], key: str) -> str:
schema = properties.get(key) or {}
typ = schema.get("type", "string")
if isinstance(typ, list):
typ = next((item for item in typ if item != "null"), typ[0] if typ else "string")
return str(typ).lower()
def _coerce(value: str, key: str, properties: dict[str, Any]) -> Any:
value = value.strip()
typ = _schema_type(properties, key)
if value.lower() == "null":
return None
if typ in _STRING_TYPES:
return value
if typ in _BOOL_TYPES:
normalized = value.lower()
if normalized in {"1", "true", "yes"}:
return True
if normalized in {"0", "false", "no"}:
return False
return value
if typ.startswith(_INT_PREFIXES):
try:
return int(value)
except (TypeError, ValueError):
return value
if typ.startswith(_FLOAT_PREFIXES):
try:
number = float(value)
return int(number) if number.is_integer() else number
except (TypeError, ValueError):
return value
if typ in _JSON_TYPES or typ.startswith(("dict", "list")):
try:
return json.loads(value)
except (TypeError, ValueError, json.JSONDecodeError):
try:
return ast.literal_eval(value)
except (SyntaxError, ValueError):
return value
try:
return json.loads(value)
except (TypeError, json.JSONDecodeError):
return value
def parse_tool_call(text: str, tools: Any | None = None) -> dict[str, Any]:
body = text.strip()
if body.startswith(tool_call_start):
body = body[len(tool_call_start) :].strip()
if body.endswith(tool_call_end):
body = body[: -len(tool_call_end)].strip()
first_arg = body.find("<|tool_arg:start|>")
if first_arg == -1:
try:
payload = json.loads(body)
except json.JSONDecodeError as exc:
raise ValueError(f"No Solar tool arguments found in: {text!r}") from exc
name = payload.get("name") or payload.get("tool") or payload.get("function")
args = payload.get("arguments") or payload.get("args") or {}
if not name:
raise ValueError(f"No Solar tool name found in: {text!r}")
if isinstance(args, str):
args = json.loads(args)
return {"name": name, "arguments": args}
name = body[:first_arg].strip().splitlines()[0].strip()
if not name:
raise ValueError(f"No Solar tool name found in: {text!r}")
properties = _tool_properties(name, tools)
arguments: dict[str, Any] = {}
for key, value in _ARG_RE.findall(body[first_arg:]):
key = key.strip()
if key:
arguments[key] = _coerce(value, key, properties)
return {"name": name, "arguments": arguments}
|