Text Generation
Transformers
Safetensors
PyTorch
English
wiola
decoder-only
causal-language-model
research
custom_code
Instructions to use oscowlai/Wiola360M with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use oscowlai/Wiola360M with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="oscowlai/Wiola360M", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("oscowlai/Wiola360M", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use oscowlai/Wiola360M with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "oscowlai/Wiola360M" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "oscowlai/Wiola360M", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/oscowlai/Wiola360M
- SGLang
How to use oscowlai/Wiola360M 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 "oscowlai/Wiola360M" \ --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": "oscowlai/Wiola360M", "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 "oscowlai/Wiola360M" \ --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": "oscowlai/Wiola360M", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use oscowlai/Wiola360M with Docker Model Runner:
docker model run hf.co/oscowlai/Wiola360M
| # coding=utf-8 | |
| """Dual-Stream Feed-Forward (DSFF). | |
| Implements Section IX of the Wiola paper. Two parallel *dense* streams of | |
| different widths and activations are fused by a learned per-dimension gate: | |
| Stream A (narrow, SwiGLU): a = D_A( SiLU(G_A x) * (U_A x) ) | |
| Stream B (wide, GELU): b = D_B( GELU(U_B x) ) | |
| gate: alpha = sigmoid(W_f [a; b]) in (0,1)^d | |
| output: alpha * a + (1 - alpha) * b | |
| Setting ``W_f = 0`` yields ``alpha = 0.5``, reducing DSFF to a simple ensemble | |
| average; DSFF therefore strictly generalises a two-stream ensemble. | |
| """ | |
| import torch | |
| import torch.nn as nn | |
| import torch.nn.functional as F | |
| class DualStreamFeedForward(nn.Module): | |
| def __init__(self, hidden_size: int, narrow_size: int, wide_size: int): | |
| super().__init__() | |
| # Stream A: narrow SwiGLU. | |
| self.gate_a = nn.Linear(hidden_size, narrow_size, bias=False) # G_A | |
| self.up_a = nn.Linear(hidden_size, narrow_size, bias=False) # U_A | |
| self.down_a = nn.Linear(narrow_size, hidden_size, bias=False) # D_A | |
| # Stream B: wide GELU. | |
| self.up_b = nn.Linear(hidden_size, wide_size, bias=False) # U_B | |
| self.down_b = nn.Linear(wide_size, hidden_size, bias=False) # D_B | |
| # Per-dimension fusion gate from concatenated stream outputs. | |
| self.fusion = nn.Linear(2 * hidden_size, hidden_size, bias=False) # W_f | |
| def forward(self, x: torch.Tensor) -> torch.Tensor: | |
| a = self.down_a(F.silu(self.gate_a(x)) * self.up_a(x)) | |
| b = self.down_b(F.gelu(self.up_b(x))) | |
| alpha = torch.sigmoid(self.fusion(torch.cat((a, b), dim=-1))) | |
| return alpha * a + (1.0 - alpha) * b | |