Team Ai
Modelpublic

logiya-vidhyapathi/llama_quantization_4_bit

sourceHugging Faceapache-2.0updated 8mo agoView on Hugging Face
0likes16downloads
Model Card

Llama-3.1-8B-Instruct โ€“ AWQ 4-bit

This repository contains a 4-bit AWQ quantized version of Llama-3.1-8B-Instruct. The model is optimized for lower memory usage and faster inference with minimal quality loss.


๐Ÿ”น Model Details

  • โ€”Base Model: meta-llama/Llama-3.1-8B-Instruct
  • โ€”Quantization Method: AWQ (Activation-aware Weight Quantization)
  • โ€”Precision: 4-bit
  • โ€”Framework: PyTorch
  • โ€”Quantized Using: LLM Compressor
  • โ€”Intended Use: Text generation, chat, instruction following

๐Ÿ”น Why AWQ?

AWQ reduces model size and VRAM usage by:

  • โ€”Quantizing weights to 4-bit
  • โ€”Preserving important activation ranges
  • โ€”Maintaining better accuracy compared to naive quantization

๐Ÿ”น Hardware Requirements

TypeRequirement
GPU8โ€“10 GB VRAM (recommended)
CPUSupported (slower)
RAM16 GB or more

๐Ÿ”น How to Load the Model

Using Transformers

python
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch

model_id = "your-username/your-model"

tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
    model_id,
    device_map="auto",
    torch_dtype=torch.float16
)

prompt = "Explain transformers in simple words"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)

outputs = model.generate(**inputs, max_new_tokens=200)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))