Text Generation
Transformers
Safetensors
English
qwen3_5_text
stream-llm
multi-stream
parallel-cognition
monitorability
qwen3.5
deltanet
custom_code
Instructions to use JonasGeiping/stream-qwen3.5-27b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use JonasGeiping/stream-qwen3.5-27b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="JonasGeiping/stream-qwen3.5-27b", trust_remote_code=True)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("JonasGeiping/stream-qwen3.5-27b", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("JonasGeiping/stream-qwen3.5-27b", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use JonasGeiping/stream-qwen3.5-27b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "JonasGeiping/stream-qwen3.5-27b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "JonasGeiping/stream-qwen3.5-27b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/JonasGeiping/stream-qwen3.5-27b
- SGLang
How to use JonasGeiping/stream-qwen3.5-27b 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 "JonasGeiping/stream-qwen3.5-27b" \ --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": "JonasGeiping/stream-qwen3.5-27b", "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 "JonasGeiping/stream-qwen3.5-27b" \ --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": "JonasGeiping/stream-qwen3.5-27b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use JonasGeiping/stream-qwen3.5-27b with Docker Model Runner:
docker model run hf.co/JonasGeiping/stream-qwen3.5-27b
Upload channel_embedding.py with huggingface_hub
Browse files- channel_embedding.py +33 -0
channel_embedding.py
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Channel embedding module for multi-stream models."""
|
| 2 |
+
|
| 3 |
+
import torch
|
| 4 |
+
from torch import nn
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
class ChannelEmbedding(nn.Module):
|
| 8 |
+
"""Learnable per-channel embedding added to token hidden states.
|
| 9 |
+
|
| 10 |
+
Args:
|
| 11 |
+
num_channels: Number of channels (streams).
|
| 12 |
+
hidden_size: Model hidden dimension.
|
| 13 |
+
method: "additive" adds embedding to hidden states, "none" is a pass-through.
|
| 14 |
+
"""
|
| 15 |
+
|
| 16 |
+
def __init__(self, num_channels: int, hidden_size: int, method: str = "additive"):
|
| 17 |
+
super().__init__()
|
| 18 |
+
self.method = method
|
| 19 |
+
self.num_channels = num_channels
|
| 20 |
+
if method == "additive":
|
| 21 |
+
self.embedding = nn.Embedding(num_channels, hidden_size)
|
| 22 |
+
elif method == "none":
|
| 23 |
+
pass
|
| 24 |
+
else:
|
| 25 |
+
raise ValueError(f"Unknown channel embedding method: {method}")
|
| 26 |
+
|
| 27 |
+
def forward(
|
| 28 |
+
self, hidden_states: torch.Tensor, channel_ids: torch.LongTensor
|
| 29 |
+
) -> torch.Tensor:
|
| 30 |
+
if self.method == "none":
|
| 31 |
+
return hidden_states
|
| 32 |
+
channel_emb = self.embedding(channel_ids)
|
| 33 |
+
return hidden_states + channel_emb
|