JAMBA targets the long-context and memory limits of attention-only language models by combining MAMBA-style state-space layers, transformer layers, and joint attention. Its hybrid design aims to retain transformer strengths while improving context-length efficiency. section 12.2.2
A practical JAMBA deployment involves several important trade-offs:
- A 52-billion-parameter mixture-of-experts model can support 140K-token contexts on an 80 GB GPU, outperforming attention-only memory requirements. section 12.2.2
- Fine-tuning exceeds one 80 GB GPU even in half precision, so Accelerate must parallelize training across several GPUs. section 12.2.2
Listing 12.1 Finetuning and inferencing JAMBA
from trl import SFTTrainer
from peft import LoraConfig
from transformers import (
AutoTokenizer,
AutoModelForCausalLM,
TrainingArguments,
)
from transformers import BitsAndBytesConfig
import torch
from datasets import load_dataset
tokenizer = AutoTokenizer.from_pretrained("ai21labs/Jamba-v0.1")
model = AutoModelForCausalLM.from_pretrained(
"ai21labs/Jamba-v0.1", device_map="auto"
)
dataset = load_dataset("Abirate/english_quotes", split="train")
The listing provides a minimal starting point for loading ai21labs/Jamba-v0.1 with Transformers, selecting its tokenizer, model, and training dataset. section 12.2.2
