Text Generation
Transformers
English
qwen2
sakthai
tool-calling
instruct
lora
yarn
long-context
128k

SakThai Context 7B — 128K Extended

A context-extended version of Nanthasit/sakthai-context-7b-merged, adapted to 128K tokens using YaRN (Yet another RoPE extensioN method).

Context Window

Property Original Extended
max_position_embeddings 32,768 131,072
YaRN factor — 4.0x
RoPE theta 1,000,000 1,000,000

Method

  • Base model: Nanthasit/sakthai-context-7b-merged (Qwen2.5-7B-Instruct + tool-calling LoRA)
  • Extension: YaRN with factor=4.0, original_max_position_embeddings=32768
  • Approach: Config-only — no training required. Qwen2.5 supports YaRN natively.
  • Deployment: Use with vLLM, TGI, or transformers. Note: vLLM uses static YaRN — scaling factor is fixed, so short-context accuracy (<32K) has a minor trade-off. Use the 32K main branch for fast tool-calling, and this 128K branch for heavy document retrieval.

Usage

from transformers import AutoModelForCausalLM, AutoTokenizer

model = AutoModelForCausalLM.from_pretrained(
    "Nanthasit/sakthai-context-7b-128k",
    torch_dtype="bfloat16",
    device_map="auto",
)
tokenizer = AutoTokenizer.from_pretrained("Nanthasit/sakthai-context-7b-128k")

# Use with long prompts up to 128K tokens
prompt = "Your long document here..."
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=512)

References

Downloads last month
227
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for Nanthasit/sakthai-context-7b-128k

Base model

Qwen/Qwen2.5-7B
Adapter
(1)
this model

Datasets used to train Nanthasit/sakthai-context-7b-128k

Papers for Nanthasit/sakthai-context-7b-128k