Text Generation
Transformers
Safetensors
PyTorch
English
pebble_50m
pebble
base-model
mamba
mamba2
hybrid
custom-architecture
custom_code
Run this model with HF Jobs
Run basically-experimental/Pebble-50M-beta on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/basically-experimental/Pebble-50M-beta. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/basically-experimental/Pebble-50M-beta on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/basically-experimental/Pebble-50M-beta. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/basically-experimental/Pebble-50M-beta. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
Instructions to use basically-experimental/Pebble-50M-beta with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use basically-experimental/Pebble-50M-beta with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="basically-experimental/Pebble-50M-beta", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("basically-experimental/Pebble-50M-beta", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use basically-experimental/Pebble-50M-beta with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "basically-experimental/Pebble-50M-beta" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "basically-experimental/Pebble-50M-beta", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/basically-experimental/Pebble-50M-beta
- SGLang
How to use basically-experimental/Pebble-50M-beta 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 "basically-experimental/Pebble-50M-beta" \ --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": "basically-experimental/Pebble-50M-beta", "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 "basically-experimental/Pebble-50M-beta" \ --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": "basically-experimental/Pebble-50M-beta", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use basically-experimental/Pebble-50M-beta with Docker Model Runner:
docker model run hf.co/basically-experimental/Pebble-50M-beta
Update modeling_pebble.py
Browse files96 unmodified lines97989910010110210312 unmodified lines1161171181191201211221231241251261271281295 unmodified lines13513613713813914014114214314414514614714814915015115215315415515615715815916016116216315 unmodified lines17918018118218318496 unmodified linesself.out_proj = nn.Linear(self.d_inner, d_model, bias=False)self.norm = RMSNorm(self.d_inner, eps=config.rms_norm_eps)# Conv1d takes x, B, and C combined (d_inner + 2 * d_state)conv_in_channels = self.d_inner + 2 * d_stateself.conv1d = nn.Conv1d(in_channels=conv_in_channels,12 unmodified linesB, T, C = x.shapexzbc = self.in_proj(x)# Split into x, z, B, C, dtx, z, B_p, C_p, dt = torch.split(xzbc,[self.d_inner, self.d_inner, self.d_state, self.d_state, self.nheads],dim=-1)# Apply conv1d to x, B, C combinedxbc = torch.cat([x, B_p, C_p], dim=-1)xbc = xbc.transpose(1, 2)xbc = self.conv1d(xbc)[:, :, :T]5 unmodified linesdim=-1)# Activationx = F.silu(x)# Normx = self.norm(x)z = self.norm(z)# Discretizationdt = F.softplus(dt + self.dt_bias)A = -torch.exp(self.A_log)# Reshape for multi-head SSMx = x.view(B, T, self.nheads, self.headdim)z = z.view(B, T, self.nheads, self.headdim)# B and C are (B, T, d_state) -> (B, T, 1, 1, d_state) to broadcast across headsB_p = B_p.view(B, T, 1, 1, self.d_state)C_p = C_p.view(B, T, 1, 1, self.d_state)# A is (nheads,) -> (1, nheads, 1, 1)A = A.view(1, self.nheads, 1, 1)# SSM Scan (Naive loop)h = torch.zeros(B, self.nheads, self.d_state, self.headdim, device=x.device)ys = []15 unmodified linesD = self.D.view(1, 1, self.nheads, 1)y = y + (x * D).view(B, T, self.d_inner)out = y * zout = self.out_proj(out)return out96 unmodified lines97989910010110212 unmodified lines1151161171181191201211221231241251265 unmodified lines13213313413513613713813914014114214314414514614714814915015115 unmodified lines16716816917017117217396 unmodified linesself.out_proj = nn.Linear(self.d_inner, d_model, bias=False)self.norm = RMSNorm(self.d_inner, eps=config.rms_norm_eps)conv_in_channels = self.d_inner + 2 * d_stateself.conv1d = nn.Conv1d(in_channels=conv_in_channels,12 unmodified linesB, T, C = x.shapexzbc = self.in_proj(x)x, z, B_p, C_p, dt = torch.split(xzbc,[self.d_inner, self.d_inner, self.d_state, self.d_state, self.nheads],dim=-1)xbc = torch.cat([x, B_p, C_p], dim=-1)xbc = xbc.transpose(1, 2)xbc = self.conv1d(xbc)[:, :, :T]5 unmodified linesdim=-1)x = F.silu(x)x = self.norm(x)z = self.norm(z)dt = F.softplus(dt + self.dt_bias)A = -torch.exp(self.A_log)# Reshape x for multi-head SSMx = x.view(B, T, self.nheads, self.headdim)B_p = B_p.view(B, T, 1, 1, self.d_state)C_p = C_p.view(B, T, 1, 1, self.d_state)A = A.view(1, self.nheads, 1, 1)h = torch.zeros(B, self.nheads, self.d_state, self.headdim, device=x.device)ys = []15 unmodified linesD = self.D.view(1, 1, self.nheads, 1)y = y + (x * D).view(B, T, self.d_inner)# z is already (B, T, d_inner), so it multiplies perfectly!out = y * zout = self.out_proj(out)return out
modeling_pebble.py+2-13