Text Generation
MLX
Safetensors
English
Korean
Japanese
solar_open2
solar
solar-open2
Mixture of Experts
quantized
4bit
conversational
4-bit precision
Instructions to use TensorFold/Solar-Open2-250B-MLX-4bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use TensorFold/Solar-Open2-250B-MLX-4bit 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-4bit") 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-4bit 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-4bit"
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-4bit" } ] } } }Run Pi
# Start Pi in your project directory: pi
- MLX LM
How to use TensorFold/Solar-Open2-250B-MLX-4bit 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-4bit"
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-4bit" # 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-4bit", "messages": [ {"role": "user", "content": "Hello"} ] }' - Hermes Agent
How to use TensorFold/Solar-Open2-250B-MLX-4bit 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-4bit"
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-4bit
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use TensorFold/Solar-Open2-250B-MLX-4bit 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-4bit"
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-4bit" \ --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"
Download omlx/install_omlx_solar_open2_patch.sh from TensorFold/Solar-Open2-250B-MLX-4bit: direct link, hf CLI and curl.
- Browser
- Download file 5.34 kB
-
https://huggingface.co/TensorFold/Solar-Open2-250B-MLX-4bit/resolve/d34aa99f4f6f6a4c18e7aec3ece15a8a5c9809b8/omlx/install_omlx_solar_open2_patch.sh
- Command line
-
hf download hf://TensorFold/Solar-Open2-250B-MLX-4bit@d34aa99f4f6f6a4c18e7aec3ece15a8a5c9809b8/omlx/install_omlx_solar_open2_patch.sh
-
curl -L -o install_omlx_solar_open2_patch.sh https://huggingface.co/TensorFold/Solar-Open2-250B-MLX-4bit/resolve/d34aa99f4f6f6a4c18e7aec3ece15a8a5c9809b8/omlx/install_omlx_solar_open2_patch.sh
5.34 kB
| set -euo pipefail | |
| SCRIPT_DIR="${0:A:h}" | |
| REPO_DIR="${SCRIPT_DIR:h}" | |
| BASE="${OMLX_MLX_LM_DIR:-/Applications/oMLX.app/Contents/Resources/Python/framework-mlx-base/lib/python3.11/site-packages/mlx_lm}" | |
| PY="${OMLX_PYTHON:-/Applications/oMLX.app/Contents/Resources/Python/cpython-3.11/bin/python3.11}" | |
| OMLX_RESOURCES="${OMLX_RESOURCES:-/Applications/oMLX.app/Contents/Resources}" | |
| PREFIX_CACHE="$OMLX_RESOURCES/omlx/cache/prefix_cache.py" | |
| STAMP="$(date +%Y%m%d-%H%M%S)" | |
| if [[ "$(id -u)" -ne 0 ]]; then | |
| echo "Run this installer with sudo so it can patch the OMLX app bundle." | |
| exit 1 | |
| fi | |
| test -f "$REPO_DIR/solar_open2.py" | |
| test -f "$SCRIPT_DIR/solar_open2_tool_parser.py" | |
| test -f "$BASE/tokenizer_utils.py" | |
| test -f "$PREFIX_CACHE" | |
| mkdir -p "$BASE/models" "$BASE/tool_parsers" | |
| cp "$BASE/tokenizer_utils.py" "$BASE/tokenizer_utils.py.bak-$STAMP" | |
| cp "$PREFIX_CACHE" "$PREFIX_CACHE.bak-$STAMP" | |
| if [[ -f "$BASE/models/solar_open2.py" ]]; then | |
| cp "$BASE/models/solar_open2.py" "$BASE/models/solar_open2.py.bak-$STAMP" | |
| fi | |
| if [[ -f "$BASE/tool_parsers/solar_open2.py" ]]; then | |
| cp "$BASE/tool_parsers/solar_open2.py" "$BASE/tool_parsers/solar_open2.py.bak-$STAMP" | |
| fi | |
| install -m 0644 "$REPO_DIR/solar_open2.py" "$BASE/models/solar_open2.py" | |
| install -m 0644 "$SCRIPT_DIR/solar_open2_tool_parser.py" "$BASE/tool_parsers/solar_open2.py" | |
| TOKENIZER_UTILS="$BASE/tokenizer_utils.py" "$PY" - <<'PY' | |
| import os | |
| from pathlib import Path | |
| path = Path(os.environ["TOKENIZER_UTILS"]) | |
| text = path.read_text(encoding="utf-8") | |
| think_marker = ' ("<|think:start|>", "<|think:end|>"),\n' | |
| if think_marker not in text: | |
| anchor = ' ("<longcat_think>", "</longcat_think>"),\n' | |
| if anchor not in text: | |
| raise SystemExit("Could not find the thinking-token list in tokenizer_utils.py") | |
| text = text.replace(anchor, anchor + think_marker, 1) | |
| parser_marker = ' return "solar_open2"\n' | |
| if parser_marker not in text: | |
| anchor = ( | |
| ' elif "<|tool_list_start|>" in chat_template:\n' | |
| ' return "pythonic"\n' | |
| ) | |
| insert = ( | |
| ' elif "<|tool_call:start|>" in chat_template and "<|tool_arg:start|>" in chat_template:\n' | |
| ' return "solar_open2"\n' | |
| ) | |
| if anchor not in text: | |
| raise SystemExit("Could not find the tool-parser inference block in tokenizer_utils.py") | |
| text = text.replace(anchor, anchor + insert, 1) | |
| solar_apply_marker = 'is_solar_open2 = "<|tool_call:start|>" in template and "<|tool_arg:start|>" in template and "<|think:start|>" in template\n' | |
| if solar_apply_marker not in text: | |
| old = ( | |
| ' def apply_chat_template(self, *args, tokenize=True, **kwargs):\n' | |
| ' if "enable_thinking" not in kwargs:\n' | |
| ' kwargs["enable_thinking"] = self.has_thinking\n' | |
| ) | |
| new = ( | |
| ' def apply_chat_template(self, *args, tokenize=True, **kwargs):\n' | |
| ' template = self._chat_template or getattr(self._tokenizer, "chat_template", None) or ""\n' | |
| ' is_solar_open2 = "<|tool_call:start|>" in template and "<|tool_arg:start|>" in template and "<|think:start|>" in template\n' | |
| ' if is_solar_open2 and "reasoning_effort" not in kwargs:\n' | |
| ' enable_thinking = kwargs.pop("enable_thinking", False)\n' | |
| ' kwargs["reasoning_effort"] = "high" if enable_thinking else "none"\n' | |
| ' elif "enable_thinking" not in kwargs:\n' | |
| ' kwargs["enable_thinking"] = self.has_thinking\n' | |
| ) | |
| if old not in text: | |
| raise SystemExit("Could not patch TokenizerWrapper.apply_chat_template in tokenizer_utils.py") | |
| text = text.replace(old, new, 1) | |
| path.write_text(text, encoding="utf-8") | |
| PY | |
| PREFIX_CACHE="$PREFIX_CACHE" "$PY" - <<'PY' | |
| import os | |
| from pathlib import Path | |
| path = Path(os.environ["PREFIX_CACHE"]) | |
| text = path.read_text(encoding="utf-8") | |
| marker = "Solar Open2 variable ArraysCache compatibility" | |
| if marker not in text: | |
| old = """ cache = marker_handler.deserialize_state( | |
| tuple(elements), meta_state | |
| ) | |
| """ | |
| new = """ # Solar Open2 variable ArraysCache compatibility: | |
| # preserve all recurrent-state tensors and their token count. | |
| if marker_handler.is_variable_length_state(): | |
| cache = marker_handler.reconstruct_cache( | |
| { | |
| \"states\": list(elements), | |
| \"cache_type\": marker_class, | |
| }, | |
| meta_state, | |
| token_count=valid_token_count, | |
| ) | |
| else: | |
| cache = marker_handler.deserialize_state( | |
| tuple(elements), meta_state | |
| ) | |
| """ | |
| if old not in text: | |
| raise SystemExit("Could not patch variable ArraysCache reconstruction in prefix_cache.py") | |
| text = text.replace(old, new, 1) | |
| path.write_text(text, encoding="utf-8") | |
| PY | |
| "$PY" -m py_compile \ | |
| "$BASE/models/solar_open2.py" \ | |
| "$BASE/tool_parsers/solar_open2.py" \ | |
| "$BASE/tokenizer_utils.py" \ | |
| "$PREFIX_CACHE" | |
| echo "Installed Solar Open2 OMLX compatibility patch. Backups use stamp $STAMP." | |