Run a Chatgpt-like Chatbot on a Single GPU with ROCm
Vicuna-13B can run on a single AMD GPU under ROCm by quantizing it to 4 bits with GPTQ, shrinking GPU memory use from over 28GB in fp16 to about 7.5GB so it fits on a 16GB Radeon RX6900XT. Token generation is memory-bandwidth bound, so quantization costs little latency or perplexity. The guide covers ROCm and Docker setup, downloading or producing a GPTQ 4-bit model (including applying Vicuna delta weights to LLaMA), building the HIPified dequant+matmul kernels, and serving the model through FastChat's Gradio web UI. It compares fp16 and 4-bit variants on MI210 and RX6900XT.
Related posts
- AMD + 🤗: Large Language Models Out-of-the-Box Acceleration with AMD GPU
Hugging Face easyNoviceHugging Face Transformers now runs all models and tasks on AMD Instinct GPUs with no code changes versus NVIDIA, backed by ROCm support for Flash Attention v2, vLLM Paged Attention, DeepSpeed, GPTQ via AutoGPTQ, ONNX Runtime's ROCMExecutionProvider, and Optimum-Benchmark. Text Generation Inference gains initial MI210/MI250 support through a ROCm Docker image, with GeMM kernel tuning to reach performance parity. Benchmarks show one MI250 (two 64 GB ROCm devices) delivering over 2.33x the decode throughput and half the prefill latency of an A100 at large batch sizes. Its 128 GB memory also fits Llama 70B workloads that run out of memory on two A100-80GBs.
- Hugging Face on AMD Instinct MI300 GPU
Hugging Face easyNoviceHugging Face's transformers and text-generation-inference (TGI) now run on AMD Instinct MI300X GPUs with no code changes, backed by a Kubernetes-scheduled CI pipeline that runs tens of thousands of unit tests on MI250 and MI300 hardware. TGI optimizations for MI300 include Flash Attention v2, Paged Attention, GPTQ/AWQ kernels, fused kernels, and PyTorch's ROCm TunableOp. TunableOp tunes GEMMs during server warmup and gives an 8-10% decode latency gain on small inputs. On Llama 3 70B, MI300X on Azure delivers 2-3x faster time to first token and 2x faster decoding than MI250, and roughly 2x faster LoRA fine-tuning. Its 192 GB HBM3 also fits the full ~140 GB fp16 model on a single GPU.
- (LoRA) Fine-Tuning FLUX.1-dev on Consumer Hardware
Hugging Face hardMasterFLUX.1-dev can be LoRA fine-tuned on a single consumer GPU by combining QLoRA (4-bit NF4 base transformer via bitsandbytes), 8-bit AdamW, gradient checkpointing, cached VAE latents and precomputed CLIP/T5 text embeddings, so that only the quantized transformer plus adapters sit in GPU memory. On an RTX 4090, a rank-4 LoRA at 512x768 peaked around 9 GB VRAM, compared with 26 GB for BF16 LoRA and an estimated ~120 GB for full fine-tuning, and 700 steps took about 41 minutes to learn Alphonse Mucha's style. The guide includes the diffusers training script settings, an embedding precompute script, FP8 training with torchao for faster runs on compatible hardware, and options for loading or merging the trained adapters at inference.
- Making LLMs lighter with AutoGPTQ and transformers
Hugging Face mediumAdeptAutoGPTQ is now integrated into Hugging Face Transformers (via Optimum), letting users quantize and run LLMs at 8, 4, 3 or 2 bits with the GPTQ post-training method. GPTQ needs a calibration dataset and quantizes only the weights: int4 weights are dequantized on the fly in a fused kernel while compute stays in fp16. That gives nearly 4x memory savings with negligible accuracy loss at 4-bit. On an A100 at batch size 1, Llama-2-7B with the exllama kernel dropped peak memory from about 29 GB to 10.5 GB with slightly better per-token latency than fp16. Text-Generation-Inference can now serve a 70B model on a single 80GB GPU and PEFT adapters can be fine-tuned on top, but the kernels slow down at larger batch sizes and W4A8 or Triton kernels remain open work.
- A Chatbot on your Laptop: Phi-2 on Intel Meteor Lake
Hugging Face mediumAdeptMicrosoft's 2.7B-parameter Phi-2 can run as a usable local chatbot on a mid-range Intel Core Ultra 7 155H (Meteor Lake) laptop once its weights are quantized to 4-bit with OpenVINO through Hugging Face's Optimum Intel library. The walkthrough covers Meteor Lake's CPU, iGPU (Xe Vector Engines with DP4a) and NPU, then shows code using OVWeightQuantizationConfig with bits=4, group_size=128 and ratio=0.8, where 80% of weights go to 4-bit and the rest to 8-bit. Lowering ratio or group size improves accuracy but costs model size and latency. Generation quality and speed are shown only through demo videos, with no measured benchmarks.