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_config.py from Arain119/sophia: direct link, hf CLI and curl.
- Browser
- Download file 2.86 kB
-
https://huggingface.co/Arain119/sophia/resolve/523bbfded73087b33fa33eb093d7e86b871de9b1/model_config.py
- Command line
-
hf download hf://Arain119/sophia@523bbfded73087b33fa33eb093d7e86b871de9b1/model_config.py
-
curl -L -o model_config.py https://huggingface.co/Arain119/sophia/resolve/523bbfded73087b33fa33eb093d7e86b871de9b1/model_config.py
2.86 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 dataclasses import dataclass | |
| from .semantics import canonicalize_model_values, validate_model_values | |
| class ModelArgs: | |
| """Torch-free runtime configuration for Sophia Hybrid.""" | |
| vocab_size: int = 65536 | |
| dim: int = 1536 | |
| n_layers: int = 28 | |
| num_heads: int = 16 | |
| head_dim: int = 128 | |
| ffn_hidden: int = 3968 | |
| kda_decay_rank: int = 128 | |
| kda_output_gate_rank: int = 128 | |
| kda_output_gate_full_rank: bool = True | |
| kda_decay_lower_bound: float = -5.0 | |
| kda_dt_min: float = 1e-3 | |
| kda_dt_max: float = 1e-1 | |
| kda_dt_floor: float = 1e-4 | |
| kda_a_log_init: float = 0.0 | |
| mla_q_rank: int = 384 | |
| mla_kv_rank: int = 128 | |
| short_conv_kernel: int = 4 | |
| attn_res_block_size: int = 4 | |
| situ_gate_softcap: float = 4.0 | |
| situ_up_softcap: float = 25.0 | |
| norm_eps: float = 1e-5 | |
| max_seq_len: int = 4096 | |
| max_batch_size: int = 4 | |
| dropout: float = 0.0 | |
| initializer_range: float = 0.02 | |
| kda_backend: str = "auto" | |
| use_cache: bool = True | |
| def __post_init__(self) -> None: | |
| normalized = canonicalize_model_values(vars(self)) | |
| for name, value in normalized.items(): | |
| if hasattr(self, name): | |
| setattr(self, name, value) | |
| validate_model_values(normalized) | |
| def attention_inner_dim(self) -> int: | |
| return int(self.num_heads) * int(self.head_dim) | |
| def layer_type(self, layer_idx: int) -> str: | |
| return "mla" if int(layer_idx) % 4 == 3 else "kda" | |
| def ensure_runtime_batch_capacity(self, batch_size: int) -> int: | |
| required = int(batch_size) | |
| if required <= 0: | |
| raise ValueError(f"batch_size must be > 0, got {required}") | |
| self.max_batch_size = max(int(self.max_batch_size), required) | |
| return int(self.max_batch_size) | |
| def runtime_batch_capacity(self) -> int: | |
| return int(self.max_batch_size) | |
| def ensure_runtime_sequence_capacity(self, max_seq_len: int) -> int: | |
| required = int(max_seq_len) | |
| if required <= 0: | |
| raise ValueError(f"max_seq_len must be > 0, got {required}") | |
| configured = int(self.max_seq_len) | |
| if required > configured: | |
| raise ValueError( | |
| "runtime sequence capacity cannot exceed configured max_seq_len: " | |
| f"required={required} configured={configured}" | |
| ) | |
| return configured | |
| def runtime_sequence_capacity(self) -> int: | |
| return int(self.max_seq_len) | |
| def runtime_max_seq_len(self) -> int: | |
| return self.runtime_sequence_capacity() | |
| def runtime_layer_count(self) -> int: | |
| return int(self.n_layers) | |