Text Generation
Transformers
Safetensors
PyTorch
English
pebble_25m
pebble
language-model
base-model
small-language-model
custom-code
mamba2
hybrid
custom_code
Instructions to use basically-ai/Pebble-25M with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use basically-ai/Pebble-25M with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="basically-ai/Pebble-25M", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("basically-ai/Pebble-25M", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use basically-ai/Pebble-25M with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "basically-ai/Pebble-25M" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "basically-ai/Pebble-25M", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/basically-ai/Pebble-25M
- SGLang
How to use basically-ai/Pebble-25M 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-ai/Pebble-25M" \ --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-ai/Pebble-25M", "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-ai/Pebble-25M" \ --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-ai/Pebble-25M", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use basically-ai/Pebble-25M with Docker Model Runner:
docker model run hf.co/basically-ai/Pebble-25M
Create configuration_pebble.py
Browse files- configuration_pebble.py +40 -0
configuration_pebble.py
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from transformers import PretrainedConfig
|
| 2 |
+
|
| 3 |
+
class PebbleConfig(PretrainedConfig):
|
| 4 |
+
model_type = "pebble_25m"
|
| 5 |
+
|
| 6 |
+
def __init__(
|
| 7 |
+
self,
|
| 8 |
+
vocab_size=2048,
|
| 9 |
+
d_model=608,
|
| 10 |
+
n_blocks=8,
|
| 11 |
+
n_heads=8,
|
| 12 |
+
att_hidden=2432,
|
| 13 |
+
rope_theta=10000.0,
|
| 14 |
+
seq_len=2048,
|
| 15 |
+
mamba_d_state=128,
|
| 16 |
+
mamba_d_conv=4,
|
| 17 |
+
mamba_expand=2,
|
| 18 |
+
mamba_headdim=64,
|
| 19 |
+
block_pattern="3:1 mamba:attn",
|
| 20 |
+
bos_token_id=1,
|
| 21 |
+
eos_token_id=1,
|
| 22 |
+
**kwargs,
|
| 23 |
+
):
|
| 24 |
+
self.vocab_size = vocab_size
|
| 25 |
+
self.d_model = d_model
|
| 26 |
+
self.n_blocks = n_blocks
|
| 27 |
+
self.n_heads = n_heads
|
| 28 |
+
self.att_hidden = att_hidden
|
| 29 |
+
self.rope_theta = rope_theta
|
| 30 |
+
self.seq_len = seq_len
|
| 31 |
+
self.mamba_d_state = mamba_d_state
|
| 32 |
+
self.mamba_d_conv = mamba_d_conv
|
| 33 |
+
self.mamba_expand = mamba_expand
|
| 34 |
+
self.mamba_headdim = mamba_headdim
|
| 35 |
+
self.block_pattern = block_pattern
|
| 36 |
+
super().__init__(
|
| 37 |
+
bos_token_id=bos_token_id,
|
| 38 |
+
eos_token_id=eos_token_id,
|
| 39 |
+
**kwargs,
|
| 40 |
+
)
|