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
Update configuration_pebble.py
Browse files- configuration_pebble.py +29 -28
configuration_pebble.py
CHANGED
|
@@ -6,35 +6,36 @@ class PebbleConfig(PretrainedConfig):
|
|
| 6 |
def __init__(
|
| 7 |
self,
|
| 8 |
vocab_size=2048,
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
bos_token_id=1,
|
| 21 |
-
eos_token_id=1,
|
| 22 |
**kwargs,
|
| 23 |
):
|
| 24 |
self.vocab_size = vocab_size
|
| 25 |
-
self.
|
| 26 |
-
self.
|
| 27 |
-
self.
|
| 28 |
-
self.
|
| 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 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
def __init__(
|
| 7 |
self,
|
| 8 |
vocab_size=2048,
|
| 9 |
+
hidden_size=608,
|
| 10 |
+
intermediate_size=2432,
|
| 11 |
+
num_hidden_layers=8,
|
| 12 |
+
num_attention_heads=8,
|
| 13 |
+
block_pattern="mmma|mmma",
|
| 14 |
+
hybrid_ratio="3:1 mamba2:attention",
|
| 15 |
+
max_position_embeddings=2048,
|
| 16 |
+
rms_norm_eps=1e-6,
|
| 17 |
+
tie_word_embeddings=True,
|
| 18 |
+
mamba2=None,
|
| 19 |
+
attention=None,
|
|
|
|
|
|
|
| 20 |
**kwargs,
|
| 21 |
):
|
| 22 |
self.vocab_size = vocab_size
|
| 23 |
+
self.hidden_size = hidden_size
|
| 24 |
+
self.intermediate_size = intermediate_size
|
| 25 |
+
self.num_hidden_layers = num_hidden_layers
|
| 26 |
+
self.num_attention_heads = num_attention_heads
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
self.block_pattern = block_pattern
|
| 28 |
+
self.hybrid_ratio = hybrid_ratio
|
| 29 |
+
self.max_position_embeddings = max_position_embeddings
|
| 30 |
+
self.rms_norm_eps = rms_norm_eps
|
| 31 |
+
self.tie_word_embeddings = tie_word_embeddings
|
| 32 |
+
|
| 33 |
+
# Default dictionaries if not provided in config.json
|
| 34 |
+
self.mamba2 = mamba2 or {
|
| 35 |
+
"d_state": 128, "d_conv": 4, "expand": 2,
|
| 36 |
+
"headdim": 64, "use_mem_eff_path": True
|
| 37 |
+
}
|
| 38 |
+
self.attention = attention or {
|
| 39 |
+
"rope_theta": 10000.0, "is_causal": True
|
| 40 |
+
}
|
| 41 |
+
super().__init__(**kwargs)
|