Qwen3-8B-hybrid-OC

A hybrid model developed by Openchip by applying proprietary linearization approach LayerBoost to the Qwen3-8B.

Details about LayerBoost approach are available on arXiv: https://arxiv.org/pdf/2604.22050v2

Setup

Before using this model, install the following system dependencies:

apt-get update
apt-get install -y --no-install-recommends \
    build-essential

After that, install the requirements

transformers==4.56.2
accelerate==1.11.0
peft==0.18.0
torch==2.10
flash-attn @ https://github.com/mjun0812/flash-attention-prebuild-wheels/releases/download/v0.7.12/flash_attn-2.8.3+cu128torch2.10-cp312-cp312-linux_x86_64.whl

Example Usage

Login to Huggigface

hf auth login

Use the model

from transformers import AutoModelForCausalLM, AutoTokenizer
import torch

model_id = "openchip-sw/Qwen3-8B-LayerBoost"

if not torch.cuda.is_available():
    raise RuntimeError("CUDA GPU is required")

tokenizer = AutoTokenizer.from_pretrained(model_id)

model = AutoModelForCausalLM.from_pretrained(
    model_id,
    trust_remote_code=True,
    device_map={"": "cuda:0"},  # Load directly onto GPU 0
    torch_dtype=torch.bfloat16,  # Use float16 if your GPU lacks BF16 support
    low_cpu_mem_usage=True,
)

model.eval()

prompt = (
    "Give me a list of European countries accompanied by their capitals."
)

eval_inputs = tokenizer(prompt, return_tensors="pt").to("cuda:0")

with torch.inference_mode():
    eval_tokens = model.generate(
        **eval_inputs,
        max_new_tokens=128,
        do_sample=False,
        use_cache=True,
    )

generated_tokens = eval_tokens[0, eval_inputs["input_ids"].shape[1]:]
out_text = tokenizer.decode(generated_tokens, skip_special_tokens=True)

print("Generated text:", out_text)
Downloads last month
362
Safetensors
Model size
8B params
Tensor type
BF16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Paper for openchip-sw/Qwen3-8B-LayerBoost