Text Generation
Transformers
Safetensors
English
qwen3_5_text
qwen3.5
tinyllama
riscv
int4
in-weights
compiled-weights
exact-arithmetic
qwenti
conversational
Instructions to use OpceanAI/qwenti-inference with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use OpceanAI/qwenti-inference with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="OpceanAI/qwenti-inference") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("OpceanAI/qwenti-inference") model = AutoModelForCausalLM.from_pretrained("OpceanAI/qwenti-inference", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use OpceanAI/qwenti-inference with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "OpceanAI/qwenti-inference" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "OpceanAI/qwenti-inference", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/OpceanAI/qwenti-inference
- SGLang
How to use OpceanAI/qwenti-inference 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 "OpceanAI/qwenti-inference" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "OpceanAI/qwenti-inference", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "OpceanAI/qwenti-inference" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "OpceanAI/qwenti-inference", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use OpceanAI/qwenti-inference with Docker Model Runner:
docker model run hf.co/OpceanAI/qwenti-inference
File size: 2,638 Bytes
2049fc8 | 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 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | import sys
sys.path.insert(0, "/tmp/opencode/tl")
import importlib
import numpy as np
import export_full as E
GREEDY_FLOAT = [4612, 2619, 260, 647, 31844, 635, 393, 260, 1496, 2789, 3557, 21075, 31843, 1100,
4838, 289, 826, 351, 600, 17360, 1086, 31843, 1591, 1124, 31844, 700, 2815, 260,
1421, 3476, 288, 600, 2103, 31843, 1100, 393, 900, 6055, 291, 2598]
def q_grid(w, grid=13):
w = w.astype(np.float32)
best = None
for c in np.linspace(0.5, 1.0, grid):
s = np.abs(w).max(-1, keepdims=True) * c / 7.0
s[s == 0] = 1e-12
q = np.clip(np.round(w / s), -8, 7)
e = ((q * s - w) ** 2).sum(-1, keepdims=True)
if best is None:
best = (q, s, e)
else:
m = e < best[2]
best = (np.where(m, q, best[0]), np.where(m, s, best[1]), np.minimum(e, best[2]))
return best[0], best[1][..., 0]
def q_diffuse(w, grid=13):
q, s = q_grid(w)
q = q.copy().astype(np.float32)
w = w.astype(np.float32)
for i in range(w.shape[0]):
order = np.argsort(-np.abs(w[i]))
buf = w[i].copy()
for j in order:
v = np.clip(np.round(buf[j] / s[i]), -8, 7)
q[i, j] = v
err = buf[j] - v * s[i]
if j + 1 < len(buf):
buf = buf + 0.0
q[i] = np.clip(np.round(w[i] / s[i]), -8, 7)
return q.astype(np.int8), s
def q_gptq(w, grid=13, damp=0.01):
"""column-wise error feedback with an identity Hessian approximation (no calibration needed)"""
w = w.astype(np.float64)
q, s = q_grid(w)
sr = s.astype(np.float64)
H = np.eye(w.shape[1])
for i in range(w.shape[0]):
W = w[i].copy()
for j in range(w.shape[1]):
qq = np.clip(np.round(W[j] / sr[i]), -8, 7)
q[i, j] = qq
err = (W[j] - qq * sr[i]) / H[j, j]
W = W - err * H[j]
return q.astype(np.int8), s
def run(tag, quant):
E.quantize = quant
for m in list(sys.modules):
if m in ("mirror3",):
del sys.modules[m]
import mirror3 as M
M.ATT_C, M.PKSH, M.SILU_SH, M.SILU_RND = 66572, 0, 11, False
M.build_tables()
st = M.State()
tok = 1
out = []
for pos in range(40):
lg = M.step(tok, pos, st)
tok = int(lg.argmax())
out.append(tok)
n = 0
for a, b in zip(out, GREEDY_FLOAT):
if a != b:
break
n += 1
print(f"{tag:22s} coinciden {n}/40 tokens: {out[:4]}...{out[36:]}", flush=True)
run("grid (actual)", q_grid)
run("difusion de error", q_diffuse)
run("GPTQ identidad", q_gptq)
|