Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

QuantLLM is a Python library designed for developers, researchers, and teams who want to fine-tune and deploy large language models (LLMs) efficiently using 4-bit and 8-bit quantization techniques.

NotificationsYou must be signed in to change notification settings

codewithdark-git/QuantLLM

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PyPI DownloadsPyPI - Version

📌 Overview

QuantLLM is a Python library designed for efficient model quantization using the GGUF (GGML Universal Format) method. It provides a robust framework for converting and deploying large language models with minimal memory footprint and optimal performance. Key capabilities include:

  • Memory-efficient GGUF quantization with multiple precision options (2-bit to 8-bit)
  • Chunk-based processing for handling large models
  • Comprehensive benchmarking tools
  • Detailed progress tracking with memory statistics
  • Easy model export and deployment

🎯 Key Features

FeatureDescription
✅ Multiple GGUF TypesSupport for various GGUF quantization types (Q2_K to Q8_0) with different precision-size tradeoffs
✅ Memory OptimizationChunk-based processing and CPU offloading for efficient handling of large models
✅ Progress TrackingDetailed layer-wise progress with memory statistics and ETA
✅ Benchmarking ToolsComprehensive benchmarking suite for performance evaluation
✅ Hardware OptimizationAutomatic device selection and memory management
✅ Easy DeploymentSimple conversion to GGUF format for deployment
✅ Flexible ConfigurationCustomizable quantization parameters and processing options

🚀 Getting Started

Installation

Basic installation:

pip install quantllm

With GGUF support (recommended):

pip install quantllm[gguf]

Quick Example

fromquantllmimportQuantLLMfromtransformersimportAutoTokenizer# Load tokenizer and prepare datamodel_name="facebook/opt-125m"tokenizer=AutoTokenizer.from_pretrained(model_name)calibration_text= ["Example text for calibration."]*10calibration_data=tokenizer(calibration_text,return_tensors="pt",padding=True)["input_ids"]# Quantize modelquantized_model,benchmark_results=QuantLLM.quantize_from_pretrained(model_name_or_path=model_name,bits=4,# Quantization bits (2-8)group_size=32,# Group size for quantizationquant_type="Q4_K_M",# GGUF quantization typecalibration_data=calibration_data,benchmark=True,# Run benchmarksbenchmark_input_shape=(1,32))# Save and convert to GGUFQuantLLM.save_quantized_model(model=quantized_model,output_path="quantized_model")QuantLLM.convert_to_gguf(model=quantized_model,output_path="model.gguf")

For detailed usage examples and API documentation, please refer to our:

💻 Hardware Requirements

Minimum Requirements

  • CPU: 4+ cores
  • RAM: 16GB+
  • Storage: 10GB+ free space
  • Python: 3.10+

Recommended for Large Models

  • CPU: 8+ cores
  • RAM: 32GB+
  • GPU: NVIDIA GPU with 8GB+ VRAM
  • CUDA: 11.7+
  • Storage: 20GB+ free space

GGUF Quantization Types

TypeBitsDescriptionUse Case
Q2_K2Extreme compressionSize-critical deployment
Q3_K_S3Small sizeLimited storage
Q4_K_M4Balanced qualityGeneral use
Q5_K_M5Higher qualityQuality-sensitive tasks
Q8_08Best qualityAccuracy-critical tasks

🔄 Version Compatibility

QuantLLMPythonPyTorchTransformersCUDA
1.2.0≥3.10≥2.0.0≥4.30.0≥11.7

🗺 Roadmap

  • Support for more GGUF model architectures
  • Enhanced benchmarking capabilities
  • Multi-GPU processing support
  • Advanced memory optimization techniques
  • Integration with more deployment platforms
  • Custom quantization kernels

🤝 Contributing

We welcome contributions! Please see ourCONTRIBUTE.md for guidelines and setup instructions.

📝 License

This project is licensed under the MIT License - see theLICENSE file for details.

🙏 Acknowledgments

📫 Contact & Support

About

QuantLLM is a Python library designed for developers, researchers, and teams who want to fine-tune and deploy large language models (LLMs) efficiently using 4-bit and 8-bit quantization techniques.

Topics

Resources

Stars

Watchers

Forks

Sponsor this project

    Packages

    No packages published

    Contributors2

    •  
    •  

    Languages


    [8]ページ先頭

    ©2009-2025 Movatter.jp