Instructions to use Arain119/sophia 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 Arain119/sophia 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 Arain119/sophia:Q4_K_M # Run inference directly in the terminal: llama cli -hf Arain119/sophia:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf Arain119/sophia:Q4_K_M # Run inference directly in the terminal: llama cli -hf Arain119/sophia: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 Arain119/sophia:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf Arain119/sophia: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 Arain119/sophia:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf Arain119/sophia:Q4_K_M
Use Docker
docker model run hf.co/Arain119/sophia:Q4_K_M
- LM Studio
- Jan
- Ollama
How to use Arain119/sophia with Ollama:
ollama run hf.co/Arain119/sophia:Q4_K_M
- Unsloth Desktop
- Docker Model Runner
How to use Arain119/sophia with Docker Model Runner:
docker model run hf.co/Arain119/sophia:Q4_K_M
- Lemonade
How to use Arain119/sophia with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull Arain119/sophia:Q4_K_M
Run and chat with the model
lemonade run user.sophia-Q4_K_M
List all available models
lemonade list
- Atomic Chat
Arain119
Sophia 1.0.0 — 1B K3-hybrid Chinese chat model (HF remote-code export + native package)
d53adc9 Download model_runtime_control.py from Arain119/sophia: direct link, hf CLI and curl.
- Browser
- Download file 2.89 kB
-
https://huggingface.co/Arain119/sophia/resolve/523bbfded73087b33fa33eb093d7e86b871de9b1/model_runtime_control.py
- Command line
-
hf download hf://Arain119/sophia@523bbfded73087b33fa33eb093d7e86b871de9b1/model_runtime_control.py
-
curl -L -o model_runtime_control.py https://huggingface.co/Arain119/sophia/resolve/523bbfded73087b33fa33eb093d7e86b871de9b1/model_runtime_control.py
2.89 kB
| # Generated by ml.integrations.export.runtime_packager.write_remote_code_bundle. | |
| # Exported for HuggingFace trust_remote_code loading. | |
| # This file is intentionally self-contained. | |
| from __future__ import annotations | |
| from collections.abc import Iterable, Sequence | |
| from typing import Protocol | |
| class _RuntimeArgs(Protocol): | |
| use_cache: bool | |
| def ensure_runtime_batch_capacity(self, batch_size: int) -> int: ... | |
| def ensure_runtime_sequence_capacity(self, max_seq_len: int) -> int: ... | |
| class _AttentionControl(Protocol): | |
| use_cache: bool | |
| def ensure_batch_capacity(self, batch_size: int) -> None: ... | |
| def ensure_sequence_capacity(self, max_seq_len: int) -> None: ... | |
| def rebuild_runtime_buffers(self, max_seq_len: int) -> None: ... | |
| def reset(self) -> None: ... | |
| def refresh_state_buffers(self) -> None: ... | |
| class _RuntimeBlock(Protocol): | |
| attn: _AttentionControl | |
| class RuntimeControlModel(Protocol): | |
| args: _RuntimeArgs | |
| layers: Sequence[_RuntimeBlock] | |
| def runtime_reserve_batch_capacity(self, batch_size: int) -> int: ... | |
| def runtime_reserve_sequence_capacity(self, max_seq_len: int) -> int: ... | |
| def runtime_sequence_capacity(self) -> int: ... | |
| def iter_attn_modules(model: RuntimeControlModel) -> Iterable[_AttentionControl]: | |
| for layer in model.layers: | |
| yield layer.attn | |
| def enable_runtime_cache(model: RuntimeControlModel) -> None: | |
| model.args.use_cache = True | |
| for attn in iter_attn_modules(model): | |
| attn.use_cache = True | |
| def ensure_batch_capacity(model: RuntimeControlModel, batch_size: int) -> None: | |
| required = int(model.runtime_reserve_batch_capacity(batch_size)) | |
| for attn in iter_attn_modules(model): | |
| attn.ensure_batch_capacity(required) | |
| def ensure_sequence_capacity(model: RuntimeControlModel, max_seq_len: int) -> None: | |
| required = int(max_seq_len) | |
| if required <= 0: | |
| raise ValueError(f"max_seq_len must be > 0, got {required}") | |
| if required <= int(model.runtime_sequence_capacity()): | |
| return | |
| required = int(model.runtime_reserve_sequence_capacity(required)) | |
| for attn in iter_attn_modules(model): | |
| attn.ensure_sequence_capacity(required) | |
| def rebuild_runtime_buffers(model: RuntimeControlModel) -> None: | |
| required = int(model.runtime_sequence_capacity()) | |
| for attn in iter_attn_modules(model): | |
| attn.rebuild_runtime_buffers(required) | |
| def reset_runtime_cache(model: RuntimeControlModel) -> None: | |
| for attn in iter_attn_modules(model): | |
| attn.reset() | |
| def refresh_state_buffers(model: RuntimeControlModel) -> None: | |
| for attn in iter_attn_modules(model): | |
| attn.refresh_state_buffers() | |
| __all__ = [ | |
| "RuntimeControlModel", | |
| "enable_runtime_cache", | |
| "ensure_batch_capacity", | |
| "ensure_sequence_capacity", | |
| "rebuild_runtime_buffers", | |
| "refresh_state_buffers", | |
| "reset_runtime_cache", | |
| ] | |