Text Generation
Transformers
recurrent_qwen
recurrent-depth
latent-reasoning
qwen2.5
research
custom_code
Instructions to use mshapiro123/recurrent-qwen2.5-0.5b-full-block with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use mshapiro123/recurrent-qwen2.5-0.5b-full-block with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="mshapiro123/recurrent-qwen2.5-0.5b-full-block", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("mshapiro123/recurrent-qwen2.5-0.5b-full-block", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use mshapiro123/recurrent-qwen2.5-0.5b-full-block with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "mshapiro123/recurrent-qwen2.5-0.5b-full-block" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mshapiro123/recurrent-qwen2.5-0.5b-full-block", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/mshapiro123/recurrent-qwen2.5-0.5b-full-block
- SGLang
How to use mshapiro123/recurrent-qwen2.5-0.5b-full-block 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 "mshapiro123/recurrent-qwen2.5-0.5b-full-block" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mshapiro123/recurrent-qwen2.5-0.5b-full-block", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "mshapiro123/recurrent-qwen2.5-0.5b-full-block" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mshapiro123/recurrent-qwen2.5-0.5b-full-block", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use mshapiro123/recurrent-qwen2.5-0.5b-full-block with Docker Model Runner:
docker model run hf.co/mshapiro123/recurrent-qwen2.5-0.5b-full-block
Render architecture figure in model card
Browse files- .gitattributes +1 -0
- README.md +1 -1
- figure1_architecture_comparison.png +3 -0
.gitattributes
CHANGED
|
@@ -3,3 +3,4 @@
|
|
| 3 |
*.md text eol=lf
|
| 4 |
*.py text eol=lf
|
| 5 |
LICENSE text eol=lf
|
|
|
|
|
|
| 3 |
*.md text eol=lf
|
| 4 |
*.py text eol=lf
|
| 5 |
LICENSE text eol=lf
|
| 6 |
+
figure1_architecture_comparison.png filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
|
@@ -15,7 +15,7 @@ The full-block recurrent-depth retrofit of Qwen2.5-0.5B-Instruct: the deep-chara
|
|
| 15 |
|
| 16 |
## Architecture
|
| 17 |
|
| 18 |
-
, a weight-tied Recurrent Block (layers 6-17), and a Coda (layers 18-23). The block executes T times per pass, and a trained split re-entry bridge combines the carried state with the re-injected Prelude output under an identity-biased gate on loops 2 through T. At T = 1 the recurrent additions are bypassed and the model reproduces the base computation exactly. Trained parameters: the 12-layer block plus the bridge, 180,556,929 forward-active. The recurrent wrapper is custom architecture code: load with `trust_remote_code=True`, using the modeling code shipped in this repository.
|
| 21 |
|
|
|
|
| 15 |
|
| 16 |
## Architecture
|
| 17 |
|
| 18 |
+

|
| 19 |
|
| 20 |
The 24-layer base model is split into a Prelude (layers 0-5), a weight-tied Recurrent Block (layers 6-17), and a Coda (layers 18-23). The block executes T times per pass, and a trained split re-entry bridge combines the carried state with the re-injected Prelude output under an identity-biased gate on loops 2 through T. At T = 1 the recurrent additions are bypassed and the model reproduces the base computation exactly. Trained parameters: the 12-layer block plus the bridge, 180,556,929 forward-active. The recurrent wrapper is custom architecture code: load with `trust_remote_code=True`, using the modeling code shipped in this repository.
|
| 21 |
|
figure1_architecture_comparison.png
ADDED
|
Git LFS Details
|