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 decoder_output.py from Arain119/sophia: direct link, hf CLI and curl.
- Browser
- Download file 3.02 kB
-
https://huggingface.co/Arain119/sophia/resolve/main/decoder_output.py
- Command line
-
hf download hf://Arain119/sophia/decoder_output.py
-
curl -L -o decoder_output.py https://huggingface.co/Arain119/sophia/resolve/main/decoder_output.py
3.02 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 collections.abc import Mapping | |
| from typing import Protocol | |
| import torch | |
| from .cache_decode import RuntimeCacheState | |
| class DecoderOutput: | |
| loss: torch.Tensor | None = None | |
| logits: torch.Tensor | None = None | |
| cache: RuntimeCacheState | None = None | |
| DecoderLogitsOutput = tuple[torch.Tensor | None, torch.Tensor | None] | |
| DecoderCachedOutput = tuple[torch.Tensor, RuntimeCacheState] | |
| DecoderFormattedOutput = DecoderOutput | DecoderLogitsOutput | DecoderCachedOutput | |
| class SupportsReturnDict(Protocol): | |
| return_dict: bool | |
| def require_output_loss(output: object, *, context: str) -> torch.Tensor: | |
| loss: object | None | |
| if isinstance(output, Mapping): | |
| loss = output.get("loss") | |
| else: | |
| loss = getattr(output, "loss", None) | |
| if not torch.is_tensor(loss): | |
| raise RuntimeError(f"{context} returned loss=None") | |
| return loss | |
| def require_output_logits(output: object, *, context: str) -> torch.Tensor: | |
| logits: object | None | |
| if isinstance(output, Mapping): | |
| logits = output.get("logits") | |
| else: | |
| logits = getattr(output, "logits", None) | |
| if not torch.is_tensor(logits): | |
| raise RuntimeError(f"{context} returned logits=None") | |
| return logits | |
| def resolve_return_dict( | |
| *, | |
| config: SupportsReturnDict, | |
| return_dict: bool | None, | |
| ) -> bool: | |
| if return_dict is None: | |
| return bool(config.return_dict) | |
| return bool(return_dict) | |
| def format_decoder_output( | |
| *, | |
| loss: torch.Tensor | None, | |
| logits: torch.Tensor | None, | |
| cache: RuntimeCacheState | None = None, | |
| return_dict: bool, | |
| ) -> DecoderFormattedOutput: | |
| if bool(return_dict): | |
| return DecoderOutput( | |
| loss=loss, | |
| logits=logits, | |
| cache=cache, | |
| ) | |
| if cache is not None: | |
| if logits is None: | |
| raise ValueError("cached decode output requires logits") | |
| return logits, cache | |
| return loss, logits | |
| def format_hf_causal_lm_output( | |
| *, | |
| output_cls: type, | |
| loss: torch.Tensor | None, | |
| logits: torch.Tensor | None, | |
| past_key_values: object = None, | |
| return_dict: bool, | |
| ) -> object: | |
| if bool(return_dict): | |
| return output_cls( | |
| loss=loss, | |
| logits=logits, | |
| past_key_values=past_key_values, | |
| ) | |
| if past_key_values is not None: | |
| if logits is None: | |
| raise ValueError("cached decode output requires logits") | |
| return logits, past_key_values | |
| if loss is not None: | |
| return loss, logits | |
| return (logits,) | |
| __all__ = [ | |
| "DecoderOutput", | |
| "DecoderFormattedOutput", | |
| "format_hf_causal_lm_output", | |
| "format_decoder_output", | |
| "require_output_logits", | |
| "require_output_loss", | |
| "resolve_return_dict", | |
| ] | |