Text Generation
Transformers
Safetensors
Mongolian
rdt
traditional-mongolian
recurrent-depth-transformer
mamba
causal-lm
custom-code
custom_code
Instructions to use Montlok/DoL-1.2-Base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Montlok/DoL-1.2-Base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Montlok/DoL-1.2-Base", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("Montlok/DoL-1.2-Base", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Montlok/DoL-1.2-Base with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Montlok/DoL-1.2-Base" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Montlok/DoL-1.2-Base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Montlok/DoL-1.2-Base
- SGLang
How to use Montlok/DoL-1.2-Base with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "Montlok/DoL-1.2-Base" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Montlok/DoL-1.2-Base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "Montlok/DoL-1.2-Base" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Montlok/DoL-1.2-Base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Montlok/DoL-1.2-Base with Docker Model Runner:
docker model run hf.co/Montlok/DoL-1.2-Base
File size: 1,534 Bytes
431ffa3 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | # -*- coding: utf-8 -*-
"""Byte-fallback helpers shared by tokenizer tracks."""
from __future__ import annotations
from Tokenizer.unified.encoded import EncodedToken
def byte_token(byte: int) -> str:
return f"<0x{byte:02X}>"
def is_byte_token(token: str) -> bool:
return token.startswith("<0x") and token.endswith(">") and len(token) == 6
def decode_byte_token(token: str) -> int:
return int(token[3:5], 16)
def encode_byte_fallback(
text: str,
vocab: dict[str, int],
unk_id: int,
base_start: int = 0,
track: str = "misc",
) -> list[EncodedToken]:
tokens: list[EncodedToken] = []
for rel_pos, ch in enumerate(text):
direct = vocab.get(ch)
start = base_start + rel_pos
end = start + 1
if direct is not None:
tokens.append(EncodedToken(direct, ch, track, start, end))
continue
# ``surrogatepass`` keeps encoding from raising on lone surrogates
# (U+D800–U+DFFF), which appear in scraped/raw web text. A strict
# ``encode`` would raise UnicodeEncodeError and abort the whole shard;
# decode mirrors this with ``errors="replace"``.
for byte in ch.encode("utf-8", "surrogatepass"):
tok = byte_token(byte)
tokens.append(EncodedToken(vocab.get(tok, unk_id), tok, track, start, end))
return tokens
def decode_bytes(byte_tokens: list[str]) -> str:
return bytes(decode_byte_token(token) for token in byte_tokens).decode(
"utf-8", errors="replace"
)
|