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_dir.py from Arain119/sophia: direct link, hf CLI and curl.
- Browser
- Download file 2.61 kB
-
https://huggingface.co/Arain119/sophia/resolve/394c875663ffe708f08ac49e705d826e73de585a/model_dir.py
- Command line
-
hf download hf://Arain119/sophia@394c875663ffe708f08ac49e705d826e73de585a/model_dir.py
-
curl -L -o model_dir.py https://huggingface.co/Arain119/sophia/resolve/394c875663ffe708f08ac49e705d826e73de585a/model_dir.py
2.61 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. | |
| """Local exported-model directory helpers.""" | |
| from __future__ import annotations | |
| import importlib.util | |
| import os | |
| from collections.abc import Callable | |
| import torch | |
| from .sophia_decoder import SophiaDecoder | |
| from ml.integrations.adapters.hf.tokenizer import load_local_tokenizer | |
| GradientCheckpointingFn = Callable[..., None] | |
| def local_export_load_kwargs() -> dict[str, object]: | |
| kwargs: dict[str, object] = { | |
| "dtype": torch.float32, | |
| "local_files_only": True, | |
| } | |
| if importlib.util.find_spec("accelerate") is not None: | |
| kwargs["low_cpu_mem_usage"] = True | |
| return kwargs | |
| load_local_export_tokenizer = load_local_tokenizer | |
| def load_trainable_decoder_from_export_dir( | |
| *, | |
| export_dir: str, | |
| device: torch.device, | |
| base_dtype: torch.dtype, | |
| gradient_checkpointing: bool, | |
| gradient_checkpointing_exclude_first: int, | |
| gradient_checkpointing_exclude_last: int, | |
| apply_gradient_checkpointing_fn: GradientCheckpointingFn, | |
| ) -> SophiaDecoder: | |
| model = SophiaDecoder.from_pretrained( | |
| os.path.abspath(str(export_dir)), | |
| device=device, | |
| dtype=base_dtype, | |
| ) | |
| model.train(True) | |
| config = getattr(model, "config", None) | |
| if config is not None: | |
| config.return_logits_in_train = True | |
| config.use_cache = False | |
| exclude_first = int(gradient_checkpointing_exclude_first) | |
| exclude_last = int(gradient_checkpointing_exclude_last) | |
| if min(exclude_first, exclude_last) < 0: | |
| raise ValueError("gradient checkpoint exclusion counts must be >= 0") | |
| if not bool(gradient_checkpointing) and (exclude_first or exclude_last): | |
| raise ValueError( | |
| "gradient checkpoint exclusions require gradient_checkpointing=1" | |
| ) | |
| if bool(gradient_checkpointing) and exclude_first + exclude_last >= int( | |
| model.config.n_layers | |
| ): | |
| raise ValueError( | |
| "gradient checkpoint exclusions must leave at least one checkpointed layer" | |
| ) | |
| model.apply_runtime_recipe_knobs( | |
| loss_chunk_size=int(model.config.loss_chunk_size), | |
| gradient_checkpointing_exclude_first=exclude_first, | |
| gradient_checkpointing_exclude_last=exclude_last, | |
| ) | |
| apply_gradient_checkpointing_fn(model, enabled=bool(gradient_checkpointing)) | |
| return model | |
| __all__ = [ | |
| "load_local_export_tokenizer", | |
| "load_trainable_decoder_from_export_dir", | |
| "local_export_load_kwargs", | |
| ] | |