Instructions to use HeshamHaroon/falcon-rw-1b-4bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use HeshamHaroon/falcon-rw-1b-4bit with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="HeshamHaroon/falcon-rw-1b-4bit", trust_remote_code=True)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("HeshamHaroon/falcon-rw-1b-4bit", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("HeshamHaroon/falcon-rw-1b-4bit", trust_remote_code=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use HeshamHaroon/falcon-rw-1b-4bit with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "HeshamHaroon/falcon-rw-1b-4bit" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "HeshamHaroon/falcon-rw-1b-4bit", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/HeshamHaroon/falcon-rw-1b-4bit
- SGLang
How to use HeshamHaroon/falcon-rw-1b-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 "HeshamHaroon/falcon-rw-1b-4bit" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "HeshamHaroon/falcon-rw-1b-4bit", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "HeshamHaroon/falcon-rw-1b-4bit" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "HeshamHaroon/falcon-rw-1b-4bit", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use HeshamHaroon/falcon-rw-1b-4bit with Docker Model Runner:
docker model run hf.co/HeshamHaroon/falcon-rw-1b-4bit
GPTQ Algorithm with auto-gptq Integration
Model Description
The GPTQ algorithm, developed by Frantar et al., is designed to compress transformer-based language models into fewer bits with minimal performance degradation. The auto-gptq library, based on the GPTQ algorithm, has been seamlessly integrated into the 🤗 transformers, enabling users to load and work with models quantized using the GPTQ algorithm.
Features
- Quantization: Compress transformer-based language models with minimal performance loss.
- Integration with 🤗 transformers: Directly load models quantized with the GPTQ algorithm.
- Flexibility: Offers two scenarios for users:
- Quantize a language model from scratch.
- Load a pre-quantized model from the 🤗 Hub.
- Calibration: Uses model inference to calibrate the quantized weights, ensuring optimal performance.
- Custom Dataset Support: Users can quantize models using either a supported dataset or a custom dataset.
Intended Use
This integration is intended for users who want to compress their transformer-based language models without significant performance loss. It's especially useful for deployment scenarios where model size is a constraint.
Limitations and Considerations
- The quality of quantization may vary based on the dataset used for calibration. It's recommended to use a dataset closely related to the model's domain for best results.
- While the GPTQ algorithm minimizes performance degradation, some loss in performance is expected, especially at lower bit quantizations.
Training Data
The GPTQ algorithm requires calibration data for optimal quantization. Users can either use supported datasets like "c4", "wikitext2", etc., or provide a custom dataset for calibration.
Evaluation Results
Performance after quantization may vary based on the dataset used for calibration and the bit precision chosen for quantization. It's recommended to evaluate the quantized model on relevant tasks to ensure it meets the desired performance criteria.
References
- Frantar et al., "GPTQ: Accurate Post-Training Quantization for Generative Pre-trained Transformers"
- AutoGPTQ GitHub Repository
- Downloads last month
- 3