Text Generation
Transformers
Safetensors
Japanese
English
looped_gdn
gated-deltanet
linear-attention
looped-transformer
weight-sharing
distillation
custom_code
conversational
Instructions to use summerAIO/Looped-qwen-pre2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use summerAIO/Looped-qwen-pre2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="summerAIO/Looped-qwen-pre2", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("summerAIO/Looped-qwen-pre2", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use summerAIO/Looped-qwen-pre2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "summerAIO/Looped-qwen-pre2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "summerAIO/Looped-qwen-pre2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/summerAIO/Looped-qwen-pre2
- SGLang
How to use summerAIO/Looped-qwen-pre2 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 "summerAIO/Looped-qwen-pre2" \ --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": "summerAIO/Looped-qwen-pre2", "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 "summerAIO/Looped-qwen-pre2" \ --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": "summerAIO/Looped-qwen-pre2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use summerAIO/Looped-qwen-pre2 with Docker Model Runner:
docker model run hf.co/summerAIO/Looped-qwen-pre2
summerMC/Looped-Qwen-pre2
j-llm/Qwen3.5-2B-SpeedX2 (ๅ
จๅฑค Gated DeltaNet) ใฎ 24 ๅฑคใ
็ฉบ้ใใผใธใใฆ้ใฟๅ
ฑๆใใ2 ้ใซใผใใซใใ Looped GDN (ๅๅพฉในใใใๆฏ LoRA ไปใ)ใๆๅธซ Qwen/Qwen3.5-2B ใใ่ธ็ใ
for t in range(6): # ๅคๅดใซใผใ
h = RoPEๆณจๅ
ฅ(h) # ไฝ็ฝฎใฎๅๆณจๅ
ฅ + ใซใผใๆฎตๅใ่พผใฟ
for k in range(loops[t]): # ๅ
ๅดใซใผใ (ใฒใผใไปใ) loops = [4, 4, 4, 4, 4, 4]
h = h + g_k(h) * (GDN_t(h) - h) # GDN_t = ๅ
ใฎ 4 ๅฑคใๅนณๅใใผใธใใๅ
ฑๆใใญใใฏ
ไฝฟใๆน (transformers)
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
repo = "summerMC/Looped-Qwen-pre"
tok = AutoTokenizer.from_pretrained(repo)
model = AutoModelForCausalLM.from_pretrained(repo, trust_remote_code=True, dtype=torch.bfloat16).cuda().eval()
ids = tok.apply_chat_template([{"role": "user", "content": "ๆฅๆฌใฎ้ฆ้ฝใฏใฉใ๏ผ"}], add_generation_prompt=True,
return_tensors="pt", return_dict=True, enable_thinking=False)["input_ids"].cuda()
out = model.generate(ids, max_new_tokens=128, do_sample=True, temperature=0.7, top_p=0.9, repetition_penalty=1.1)
print(tok.decode(out[0, ids.shape[1]:], skip_special_tokens=True))
pip install -U transformers flash-linear-attention ๆจๅฅจ (GDN ้ซ้ใซใผใใซ)ใ
ใใกใคใซ
| ใใกใคใซ | ๅ ๅฎน |
|---|---|
modeling_looped_gdn.py / configuration_looped_gdn.py |
transformers ็จใซในใฟใ ใณใผใ (trust_remote_code) |
looped_gdn.py |
ใขใใซๆฌไฝใป็ฉบ้ใใผใธๅคๆ (python looped_gdn.py --src j-llm/Qwen3.5-2B-SpeedX2 --groups 6) |
scripts/colab_looped_distill.py |
่ธ็ในใฏใชใใ (Colab ใซ่ฒผใใ ใ) |
scripts/infer_looped_gdn.py |
ๆจ่ซ / ๅฏพ่ฉฑในใฏใชใใ |
scripts/colab_ast_transplant.py |
้ซๅบฆใช็ฉบ้็งปๆค (ๆดปๆง่ๆ ฎ RegMean + DP ๅฏๅค้ทๅๅฒ + ๆดปๆง่ๆ ฎ LoRA) |
scripts/test_looped_gdn.py |
ๅไฝใในใ |
looped_config.json |
ๆงๅฝขๅผใฎ่จญๅฎ (LoopedGDNForCausalLM.load ็จ) |
ๅญฆ็ฟ
- Stage 1: ใฐใซใผใๅไฝ hidden ่ธ็ (็ธๅฏพ MSE + ใณใตใคใณ) / Stage 2: ๆๅธซ logits KL + hidden ๆๅคฑ
- ใใผใฟ: C4 (ๆฅๆฌ่ชใป่ฑ่ช)
ๆณจๆ
่ธ็ใซใใ่ฟไผผใงๆๅธซใใๆง่ฝใฏไฝไธใใพใใใฉใคใปใณในใฏๅ ใขใใซ (Qwen/Qwen3.5-2B) ใซๅพใใพใใ ๅ ใขใใซ: Qwen Team / ๅ จ GDN ๅ: summerMC, j-llm
- Downloads last month
- 644