Text Generation
Transformers
Safetensors
English
qwen3_5
image-text-to-text
Merge
task-vector
dare-ties
layer-weighted
qwen3
qwen35
reasoning
code
bf16
full-precision
vision-encoder
experimental
conversational
Instructions to use KyleHessling1/Qwopus3.6-27B-Fusion-BF16 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use KyleHessling1/Qwopus3.6-27B-Fusion-BF16 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="KyleHessling1/Qwopus3.6-27B-Fusion-BF16") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("KyleHessling1/Qwopus3.6-27B-Fusion-BF16") model = AutoModelForMultimodalLM.from_pretrained("KyleHessling1/Qwopus3.6-27B-Fusion-BF16", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.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=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use KyleHessling1/Qwopus3.6-27B-Fusion-BF16 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "KyleHessling1/Qwopus3.6-27B-Fusion-BF16" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "KyleHessling1/Qwopus3.6-27B-Fusion-BF16", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/KyleHessling1/Qwopus3.6-27B-Fusion-BF16
- SGLang
How to use KyleHessling1/Qwopus3.6-27B-Fusion-BF16 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 "KyleHessling1/Qwopus3.6-27B-Fusion-BF16" \ --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": "KyleHessling1/Qwopus3.6-27B-Fusion-BF16", "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 "KyleHessling1/Qwopus3.6-27B-Fusion-BF16" \ --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": "KyleHessling1/Qwopus3.6-27B-Fusion-BF16", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use KyleHessling1/Qwopus3.6-27B-Fusion-BF16 with Docker Model Runner:
docker model run hf.co/KyleHessling1/Qwopus3.6-27B-Fusion-BF16
File size: 3,850 Bytes
c478f1f | 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 | #!/usr/bin/env python3
"""Layer-weighted delta-scale merge, grounded in the measured weight geometry:
Coder DESCENDS from V2 (late-layer proj->1.0), its delta is ~1.8x v2's magnitude, and in EARLY
layers the coding delta is ANTI-aligned with v2's reasoning (cos<0) => it damaged reasoning/control.
So: W_new = V2 + alpha(L) * (Coder - V2), alpha ramps low (early, protect reasoning) -> high (late,
inject coding). embed/lm_head/norm/mtp/vision are frozen across all 3 -> copied from V2 verbatim.
"""
import os, re, json, gc, sys, argparse
import torch
from safetensors import safe_open
from safetensors.torch import save_file
SSD="/media/kylehessling/Extreme SSD"
V2_PATH=f"{SSD}/Qwopus3.6-27B-v2" # base (reasoning) — also donates embed/lm_head/norm/mtp/vision
CO_PATH=f"{SSD}/Qwopus3.6-27B-Coder" # coder — delta source
SHARD=5_000_000_000
NLAYERS=64
COPY_V2=re.compile(r"(embed_tokens|lm_head|^mtp\.|\.mtp\.|nextn|\.norm\.|vision|visual|image|video|patch_embed|merger)")
LAYER_RE=re.compile(r"\.layers\.(\d+)\.")
def load_index(p):
return {k:os.path.join(p,v) for k,v in json.load(open(f"{p}/model.safetensors.index.json"))["weight_map"].items()}
class ShardWriter:
def __init__(s,o): s.o,s.buf,s.cur,s.i,s.tot,s.wm=o,{},0,0,0,{}; os.makedirs(o,exist_ok=True)
def _flush(s):
if not s.buf: return
s.i+=1; nm=f"model-{s.i:05d}.safetensors"; save_file(s.buf,os.path.join(s.o,nm),metadata={"format":"pt"})
for k in s.buf: s.wm[k]=nm
s.buf,s.cur={},0; gc.collect()
def add(s,n,t): s.buf[n]=t.contiguous(); s.cur+=t.numel()*t.element_size(); s.tot+=1; (s._flush() if s.cur>=SHARD else None)
def finalize(s):
s._flush(); n=s.i
for j in range(1,n+1):
old=f"model-{j:05d}.safetensors"; new=f"model-{j:05d}-of-{n:05d}.safetensors"
os.rename(os.path.join(s.o,old),os.path.join(s.o,new))
for k,v in list(s.wm.items()):
if v==old: s.wm[k]=new
json.dump({"metadata":{"total_size":0},"weight_map":s.wm},open(f"{s.o}/model.safetensors.index.json","w"),indent=2)
def alpha(L, a_early, a_late):
return a_early + (a_late-a_early)*(L/(NLAYERS-1)) # smooth linear ramp by depth
def main():
ap=argparse.ArgumentParser()
ap.add_argument("--out",required=True)
ap.add_argument("--a-early",type=float,default=0.12)
ap.add_argument("--a-late",type=float,default=0.48)
ap.add_argument("--uniform",type=float,default=None,help="if set, constant alpha (control candidate)")
a=ap.parse_args()
iv,ic=load_index(V2_PATH),load_index(CO_PATH)
assert set(iv)==set(ic),"key mismatch"
H={}
def get(i,n):
p=i[n]
if p not in H: H[p]=safe_open(p,"pt")
return H[p].get_tensor(n)
w=ShardWriter(a.out); copied=merged=0
for i,n in enumerate(sorted(iv)):
if COPY_V2.search(n):
w.add(n,get(iv,n)); copied+=1
else:
m=LAYER_RE.search(n); L=int(m.group(1)) if m else NLAYERS//2
al = a.uniform if a.uniform is not None else alpha(L,a.a_early,a.a_late)
v2=get(iv,n).float(); co=get(ic,n).float()
out=(v2 + al*(co-v2)).to(torch.bfloat16)
w.add(n,out); merged+=1
if i%150==0:
print(f" [{i}/{len(iv)}] copied={copied} merged={merged}",flush=True); H.clear(); gc.collect()
w.finalize()
sched = f"uniform {a.uniform}" if a.uniform is not None else f"ramp {a.a_early}->{a.a_late}"
print(f"[merge] DONE ({sched}) copied={copied} merged={merged} -> {a.out}",flush=True)
import shutil
for fn in os.listdir(V2_PATH):
if fn.endswith((".json",".model",".txt")) and "safetensors" not in fn: shutil.copy2(os.path.join(V2_PATH,fn),os.path.join(a.out,fn))
print("[merge] copied config+tokenizer from V2",flush=True)
if __name__=="__main__": main()
|