Instructions to use afrideva/stablelm-3b-4e1t-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use afrideva/stablelm-3b-4e1t-GGUF with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="afrideva/stablelm-3b-4e1t-GGUF")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("afrideva/stablelm-3b-4e1t-GGUF", dtype="auto") - llama-cpp-python
How to use afrideva/stablelm-3b-4e1t-GGUF with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="afrideva/stablelm-3b-4e1t-GGUF", filename="stablelm-3b-4e1t.q2_k.gguf", )
output = llm( "Once upon a time,", max_tokens=512, echo=True ) print(output)
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use afrideva/stablelm-3b-4e1t-GGUF with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf afrideva/stablelm-3b-4e1t-GGUF:Q4_K_M # Run inference directly in the terminal: llama-cli -hf afrideva/stablelm-3b-4e1t-GGUF:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf afrideva/stablelm-3b-4e1t-GGUF:Q4_K_M # Run inference directly in the terminal: llama-cli -hf afrideva/stablelm-3b-4e1t-GGUF:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf afrideva/stablelm-3b-4e1t-GGUF:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf afrideva/stablelm-3b-4e1t-GGUF:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf afrideva/stablelm-3b-4e1t-GGUF:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf afrideva/stablelm-3b-4e1t-GGUF:Q4_K_M
Use Docker
docker model run hf.co/afrideva/stablelm-3b-4e1t-GGUF:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use afrideva/stablelm-3b-4e1t-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "afrideva/stablelm-3b-4e1t-GGUF" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "afrideva/stablelm-3b-4e1t-GGUF", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/afrideva/stablelm-3b-4e1t-GGUF:Q4_K_M
- SGLang
How to use afrideva/stablelm-3b-4e1t-GGUF 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 "afrideva/stablelm-3b-4e1t-GGUF" \ --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": "afrideva/stablelm-3b-4e1t-GGUF", "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 "afrideva/stablelm-3b-4e1t-GGUF" \ --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": "afrideva/stablelm-3b-4e1t-GGUF", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Ollama
How to use afrideva/stablelm-3b-4e1t-GGUF with Ollama:
ollama run hf.co/afrideva/stablelm-3b-4e1t-GGUF:Q4_K_M
- Unsloth Studio
How to use afrideva/stablelm-3b-4e1t-GGUF with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for afrideva/stablelm-3b-4e1t-GGUF to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for afrideva/stablelm-3b-4e1t-GGUF to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for afrideva/stablelm-3b-4e1t-GGUF to start chatting
- Docker Model Runner
How to use afrideva/stablelm-3b-4e1t-GGUF with Docker Model Runner:
docker model run hf.co/afrideva/stablelm-3b-4e1t-GGUF:Q4_K_M
- Lemonade
How to use afrideva/stablelm-3b-4e1t-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull afrideva/stablelm-3b-4e1t-GGUF:Q4_K_M
Run and chat with the model
lemonade run user.stablelm-3b-4e1t-GGUF-Q4_K_M
List all available models
lemonade list
stabilityai/stablelm-3b-4e1t-GGUF
Quantized GGUF model files for stablelm-3b-4e1t from stabilityai
** StableLM support currently requires using this llama.cpp fork by Galunid. Quantized and tested with the stablelm-support branch, commit a00bb06 **
StableLM support pull request: https://github.com/ggerganov/llama.cpp/pull/3586
| Name | Quant method | Size |
|---|---|---|
| stablelm-3b-4e1t.q2_k.gguf | q2_k | 1.20 GB |
| stablelm-3b-4e1t.q3_k_m.gguf | q3_k_m | 1.39 GB |
| stablelm-3b-4e1t.q4_k_m.gguf | q4_k_m | 1.71 GB |
| stablelm-3b-4e1t.q5_k_m.gguf | q5_k_m | 1.99 GB |
| stablelm-3b-4e1t.q6_k.gguf | q6_k | 2.30 GB |
| stablelm-3b-4e1t.q8_0.gguf | q8_0 | 2.97 GB |
Original Model Card:
StableLM-3B-4E1T
Model Description
StableLM-3B-4E1T is a 3 billion parameter decoder-only language model pre-trained on 1 trillion tokens of diverse English and code datasets for 4 epochs.
Usage
Get started generating text with StableLM-3B-4E1T by using the following code snippet:
from transformers import AutoModelForCausalLM, AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("stabilityai/stablelm-3b-4e1t")
model = AutoModelForCausalLM.from_pretrained(
"stabilityai/stablelm-3b-4e1t",
trust_remote_code=True,
torch_dtype="auto",
)
model.cuda()
inputs = tokenizer("The weather is always wonderful", return_tensors="pt").to("cuda")
tokens = model.generate(
**inputs,
max_new_tokens=64,
temperature=0.75,
top_p=0.95,
do_sample=True,
)
print(tokenizer.decode(tokens[0], skip_special_tokens=True))
Model Details
- Developed by: Stability AI
- Model type:
StableLM-3B-4E1Tmodels are auto-regressive language models based on the transformer decoder architecture. - Language(s): English
- Library: GPT-NeoX
- License: Model checkpoints are licensed under the Creative Commons license (CC BY-SA-4.0). Under this license, you must give credit to Stability AI, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the Stability AI endorses you or your use.
- Contact: For questions and comments about the model, please email
lm@stability.ai
Model Architecture
The model is a decoder-only transformer similar to the LLaMA (Touvron et al., 2023) architecture with the following modifications:
| Parameters | Hidden Size | Layers | Heads | Sequence Length |
|---|---|---|---|---|
| 2,795,443,200 | 2560 | 32 | 32 | 4096 |
- Position Embeddings: Rotary Position Embeddings (Su et al., 2021) applied to the first 25% of head embedding dimensions for improved throughput following Black et al. (2022).
- Normalization: LayerNorm (Ba et al., 2016) with learned bias terms as opposed to RMSNorm (Zhang & Sennrich, 2019).
- Tokenizer: GPT-NeoX (Black et al., 2022).
Training
For complete dataset and training details, please see the StableLM-3B-4E1T Technical Report.
Training Dataset
The dataset is comprised of a filtered mixture of open-source large-scale datasets available on the HuggingFace Hub: Falcon RefinedWeb extract (Penedo et al., 2023), RedPajama-Data (Together Computer., 2023) and The Pile (Gao et al., 2020) both without the Books3 subset, and StarCoder (Li et al., 2023).
- Given the large amount of web data, we recommend fine-tuning the base StableLM-3B-4E1T for your downstream tasks.
Training Procedure
The model is pre-trained on the aforementioned datasets in bfloat16 precision, optimized with AdamW, and trained using the NeoX tokenizer with a vocabulary size of 50,257. We outline the complete hyperparameters choices in the project's GitHub repository - config.
Training Infrastructure
Hardware:
StableLM-3B-4E1Twas trained on the Stability AI cluster across 256 NVIDIA A100 40GB GPUs (AWS P4d instances). Training began on August 23, 2023, and took approximately 30 days to complete.Software: We use a fork of
gpt-neox(EleutherAI, 2021), train under 2D parallelism (Data and Tensor Parallel) with ZeRO-1 (Rajbhandari et al., 2019), and rely on flash-attention as well as SwiGLU and Rotary Embedding kernels from FlashAttention-2 (Dao et al., 2023)
Use and Limitations
Intended Use
The model is intended to be used as a foundational base model for application-specific fine-tuning. Developers must evaluate and fine-tune the model for safe performance in downstream applications.
Limitations and Bias
As a base model, this model may exhibit unreliable, unsafe, or other undesirable behaviors that must be corrected through evaluation and fine-tuning prior to deployment. The pre-training dataset may have contained offensive or inappropriate content, even after applying data cleansing filters, which can be reflected in the model-generated text. We recommend that users exercise caution when using these models in production systems. Do not use the models if they are unsuitable for your application, or for any applications that may cause deliberate or unintentional harm to others.
How to Cite
@misc{StableLM-3B-4E1T,
url={[https://huggingface.co/stabilityai/stablelm-3b-4e1t](https://huggingface.co/stabilityai/stablelm-3b-4e1t)},
title={StableLM 3B 4E1T},
author={Tow, Jonathan and Bellagente, Marco and Mahan, Dakota and Riquelme, Carlos}
}
- Downloads last month
- 2,106
2-bit
3-bit
4-bit
5-bit
6-bit
8-bit
Model tree for afrideva/stablelm-3b-4e1t-GGUF
Base model
stabilityai/stablelm-3b-4e1t