Instructions to use rapidfire-ai-inc/Llama-3.2-1B-bnb-4bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use rapidfire-ai-inc/Llama-3.2-1B-bnb-4bit with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="rapidfire-ai-inc/Llama-3.2-1B-bnb-4bit") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("rapidfire-ai-inc/Llama-3.2-1B-bnb-4bit") model = AutoModelForCausalLM.from_pretrained("rapidfire-ai-inc/Llama-3.2-1B-bnb-4bit", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - PEFT
How to use rapidfire-ai-inc/Llama-3.2-1B-bnb-4bit with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use rapidfire-ai-inc/Llama-3.2-1B-bnb-4bit with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "rapidfire-ai-inc/Llama-3.2-1B-bnb-4bit" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "rapidfire-ai-inc/Llama-3.2-1B-bnb-4bit", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/rapidfire-ai-inc/Llama-3.2-1B-bnb-4bit
- SGLang
How to use rapidfire-ai-inc/Llama-3.2-1B-bnb-4bit 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 "rapidfire-ai-inc/Llama-3.2-1B-bnb-4bit" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "rapidfire-ai-inc/Llama-3.2-1B-bnb-4bit", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "rapidfire-ai-inc/Llama-3.2-1B-bnb-4bit" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "rapidfire-ai-inc/Llama-3.2-1B-bnb-4bit", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use rapidfire-ai-inc/Llama-3.2-1B-bnb-4bit with Docker Model Runner:
docker model run hf.co/rapidfire-ai-inc/Llama-3.2-1B-bnb-4bit
rapidfire-ai-inc/Llama-3.2-1B-bnb-4bit
4-bit NF4 quantized version of Llama 3.2 1B for convenient QLoRA training and efficient inference.
TL;DR
- Base model:
meta-llama/Llama-3.2-1B - Quantization: 4-bit bitsandbytes (NF4 + double quant; bfloat16 compute)
- Purpose: Ready-to-use base for QLoRA fine-tuning; also suitable for lightweight inference
- Suggested dtype:
torch.bfloat16compute with 4-bit weights
Quickstart (Transformers + bitsandbytes)
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
import torch
model_id = "rapidfire-ai-inc/Llama-3.2-1B-bnb-4bit"
bnb_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_compute_dtype=torch.bfloat16,
bnb_4bit_use_double_quant=True,
bnb_4bit_quant_type="nf4",
)
tok = AutoTokenizer.from_pretrained(model_id, use_fast=True)
model = AutoModelForCausalLM.from_pretrained(
model_id,
device_map="auto",
quantization_config=bnb_config,
torch_dtype=torch.bfloat16,
)
messages = [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Write a haiku about GPUs."}
]
prompt = tok.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tok(prompt, return_tensors="pt").to(model.device)
out = model.generate(
**inputs,
max_new_tokens=128,
temperature=0.7,
top_p=0.9,
)
print(tok.decode(out[0], skip_special_tokens=True))
BitsAndBytes (4-bit) config
from transformers import BitsAndBytesConfig
import torch
bnb_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_compute_dtype=torch.bfloat16,
bnb_4bit_use_double_quant=True,
bnb_4bit_quant_type="nf4",
)
Intended use & limitations
Use cases. A compact, QLoRA-ready starting point for supervised fine-tuning (SFT) or preference tuning, plus low-memory inference.
Limitations. Inherits all behaviors and restrictions of meta-llama/Llama-3.2-1B. May produce inaccurate or biased content. Do not deploy in high鈥憆isk settings without safeguards.
License. This repository follows the llama3 terms and the upstream model鈥檚 license and acceptable鈥憉se policies.
Notes
- Trained weights are unchanged aside from quantization; no additional fine鈥憈uning was performed.
- Use
apply_chat_templateif the upstream tokenizer provides a chat template. - For best throughput on a single GPU, keep
torch_dtype=torch.bfloat16andload_in_4bit=True.
Citation
@misc{rapidfireai_Llama_3.2_1B_bnb_4bit_bnb4bit_2025,
title = {Llama-3.2-1B-bnb-4bit (RapidFire AI)},
author = {RapidFire AI, Inc.},
year = {2025},
howpublished = {\url{https://huggingface.co/rapidfire-ai-inc/Llama-3.2-1B-bnb-4bit}}
}
- Downloads last month
- 12
Model tree for rapidfire-ai-inc/Llama-3.2-1B-bnb-4bit
Base model
meta-llama/Llama-3.2-1B