Instructions to use SweatyCrayfish/llama-3-8b-quantized with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use SweatyCrayfish/llama-3-8b-quantized with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="SweatyCrayfish/llama-3-8b-quantized")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("SweatyCrayfish/llama-3-8b-quantized") model = AutoModelForCausalLM.from_pretrained("SweatyCrayfish/llama-3-8b-quantized") - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use SweatyCrayfish/llama-3-8b-quantized with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "SweatyCrayfish/llama-3-8b-quantized" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "SweatyCrayfish/llama-3-8b-quantized", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/SweatyCrayfish/llama-3-8b-quantized
- SGLang
How to use SweatyCrayfish/llama-3-8b-quantized 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 "SweatyCrayfish/llama-3-8b-quantized" \ --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": "SweatyCrayfish/llama-3-8b-quantized", "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 "SweatyCrayfish/llama-3-8b-quantized" \ --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": "SweatyCrayfish/llama-3-8b-quantized", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use SweatyCrayfish/llama-3-8b-quantized with Docker Model Runner:
docker model run hf.co/SweatyCrayfish/llama-3-8b-quantized
4-bit Quantized Llama 3 Model
Description
This repository hosts the 4-bit quantized version of the Llama 3 model. Optimized for reduced memory usage and faster inference, this model is suitable for deployment in environments where computational resources are limited.
Model Details
- Model Type: Transformer-based language model.
- Quantization: 4-bit precision.
- Advantages:
- Memory Efficiency: Reduces memory usage significantly, allowing deployment on devices with limited RAM.
- Inference Speed: Accelerates inference times, depending on the hardware's ability to process low-bit computations.
How to Use
To utilize this model efficiently, follow the steps below:
Loading the Quantized Model
Load the model with specific parameters to ensure it utilizes 4-bit precision:
from transformers import AutoModelForCausalLM
model_4bit = AutoModelForCausalLM.from_pretrained("SweatyCrayfish/llama-3-8b-quantized", device_map="auto", load_in_4bit=True)
Adjusting Precision of Components
Adjust the precision of other components, which are by default converted to torch.float16:
import torch
from transformers import AutoModelForCausalLM
model_4bit = AutoModelForCausalLM.from_pretrained("SweatyCrayfish/llama-3-8b-quantized", load_in_4bit=True, torch_dtype=torch.float32)
print(model_4bit.model.decoder.layers[-1].final_layer_norm.weight.dtype)
Citation
Original repository and citations: @article{llama3modelcard, title={Llama 3 Model Card}, author={AI@Meta}, year={2024}, url = {https://github.com/meta-llama/llama3/blob/main/MODEL_CARD.md} }
- Downloads last month
- 22