Instructions to use afrideva/stablelm-2-1_6b-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use afrideva/stablelm-2-1_6b-GGUF with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf afrideva/stablelm-2-1_6b-GGUF:Q4_K_M # Run inference directly in the terminal: llama cli -hf afrideva/stablelm-2-1_6b-GGUF:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf afrideva/stablelm-2-1_6b-GGUF:Q4_K_M # Run inference directly in the terminal: llama cli -hf afrideva/stablelm-2-1_6b-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-2-1_6b-GGUF:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf afrideva/stablelm-2-1_6b-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-2-1_6b-GGUF:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf afrideva/stablelm-2-1_6b-GGUF:Q4_K_M
Use Docker
docker model run hf.co/afrideva/stablelm-2-1_6b-GGUF:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use afrideva/stablelm-2-1_6b-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "afrideva/stablelm-2-1_6b-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-2-1_6b-GGUF", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/afrideva/stablelm-2-1_6b-GGUF:Q4_K_M
- Ollama
How to use afrideva/stablelm-2-1_6b-GGUF with Ollama:
ollama run hf.co/afrideva/stablelm-2-1_6b-GGUF:Q4_K_M
- Unsloth Desktop
- Docker Model Runner
How to use afrideva/stablelm-2-1_6b-GGUF with Docker Model Runner:
docker model run hf.co/afrideva/stablelm-2-1_6b-GGUF:Q4_K_M
- Lemonade
How to use afrideva/stablelm-2-1_6b-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull afrideva/stablelm-2-1_6b-GGUF:Q4_K_M
Run and chat with the model
lemonade run user.stablelm-2-1_6b-GGUF-Q4_K_M
List all available models
lemonade list
- Atomic Chat
stabilityai/stablelm-2-1_6b-GGUF
Quantized GGUF model files for stablelm-2-1_6b from stabilityai
| Name | Quant method | Size |
|---|---|---|
| stablelm-2-1_6b.fp16.gguf | fp16 | 3.29 GB |
| stablelm-2-1_6b.q2_k.gguf | q2_k | 694.16 MB |
| stablelm-2-1_6b.q3_k_m.gguf | q3_k_m | 857.71 MB |
| stablelm-2-1_6b.q4_k_m.gguf | q4_k_m | 1.03 GB |
| stablelm-2-1_6b.q5_k_m.gguf | q5_k_m | 1.19 GB |
| stablelm-2-1_6b.q6_k.gguf | q6_k | 1.35 GB |
| stablelm-2-1_6b.q8_0.gguf | q8_0 | 1.75 GB |
Original Model Card:
Stable LM 2 1.6B
Model Description
Stable LM 2 1.6B is a 1.6 billion parameter decoder-only language model pre-trained on 2 trillion tokens of diverse multilingual and code datasets for two epochs.
Usage
Get started generating text with Stable LM 2 1.6B by using the following code snippet:
from transformers import AutoModelForCausalLM, AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("stabilityai/stablelm-2-1_6b", trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
"stabilityai/stablelm-2-1_6b",
trust_remote_code=True,
torch_dtype="auto",
)
model.cuda()
inputs = tokenizer("The weather is always wonderful", return_tensors="pt").to(model.device)
tokens = model.generate(
**inputs,
max_new_tokens=64,
temperature=0.70,
top_p=0.95,
do_sample=True,
)
print(tokenizer.decode(tokens[0], skip_special_tokens=True))
Run with Flash Attention 2 ⚡️
Click to expand
from transformers import AutoModelForCausalLM, AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("stabilityai/stablelm-2-1_6b", trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
"stabilityai/stablelm-2-1_6b",
trust_remote_code=True,
torch_dtype="auto",
attn_implementation="flash_attention_2",
)
model.cuda()
inputs = tokenizer("The weather is always wonderful", return_tensors="pt").to(model.device)
tokens = model.generate(
**inputs,
max_new_tokens=64,
temperature=0.70,
top_p=0.95,
do_sample=True,
)
print(tokenizer.decode(tokens[0], skip_special_tokens=True))
Model Details
- Developed by: Stability AI
- Model type:
Stable LM 2 1.6Bmodels are auto-regressive language models based on the transformer decoder architecture. - Language(s): English
- Library: GPT-NeoX
- License: Stability AI Non-Commercial Research Community License. If you'd like to use this model for commercial products or purposes, please contact us here to learn more.
- 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 |
|---|---|---|---|---|
| 1,644,417,024 | 2048 | 24 | 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).
- Biases: We remove all bias terms from the model except for attention Q,K,V projections (Bai et al., 2023).
- Tokenizer: We use Arcade100k, a BPE tokenizer extended from OpenAI's
tiktoken.cl100k_base. We split digits into individual tokens following findings by Liu & Low (2023).
Training
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). We further supplement our training with multi-lingual data from CulturaX (Nguyen et al., 2023) and, in particular, from its OSCAR corpora, as well as restructured data in the style of Yuan & Liu (2022).
- Given the large amount of web data, we recommend fine-tuning the base
Stable LM 2 1.6Bfor 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 100,352. We outline the complete hyperparameters choices in the project's GitHub repository - config*. The final checkpoint of pre-training, before cooldown, is provided in the global_step420000 branch.
Training Infrastructure
Hardware:
Stable LM 2 1.6Bwas trained on the Stability AI cluster across 512 NVIDIA A100 40GB GPUs (AWS P4d instances).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-2-1.6B,
url={[https://huggingface.co/stabilityai/stablelm-2-1.6b](https://huggingface.co/stabilityai/stablelm-2-1.6b)},
title={Stable LM 2 1.6B},
author={Stability AI Language Team}
}
- Downloads last month
- 505
Model tree for afrideva/stablelm-2-1_6b-GGUF
Base model
stabilityai/stablelm-2-1_6b