Text Generation
Transformers
Safetensors
English
gpt2
quantized
text-generation-inference
4-bit precision
bitsandbytes
Instructions to use iduryodhanrao/my-quantized-llm with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use iduryodhanrao/my-quantized-llm with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="iduryodhanrao/my-quantized-llm")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("iduryodhanrao/my-quantized-llm") model = AutoModelForCausalLM.from_pretrained("iduryodhanrao/my-quantized-llm", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use iduryodhanrao/my-quantized-llm with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "iduryodhanrao/my-quantized-llm" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "iduryodhanrao/my-quantized-llm", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/iduryodhanrao/my-quantized-llm
- SGLang
How to use iduryodhanrao/my-quantized-llm 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 "iduryodhanrao/my-quantized-llm" \ --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": "iduryodhanrao/my-quantized-llm", "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 "iduryodhanrao/my-quantized-llm" \ --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": "iduryodhanrao/my-quantized-llm", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use iduryodhanrao/my-quantized-llm with Docker Model Runner:
docker model run hf.co/iduryodhanrao/my-quantized-llm
my-quantized-llm
This is a quantized version of an LLM model, optimized for efficient inference.
Model Details
- Quantization: 4-bit or 8-bit using bitsandbytes
- Framework: Transformers
- Use Case: Text generation with reduced memory footprint
Usage
Load the model locally
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model_name = "iduryodhanrao/my-quantized-llm"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(
model_name,
device_map="auto",
trust_remote_code=True
)
prompt = "Hello, how are you?"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=50)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
Inference API
You can also use the Hugging Face Inference API:
import requests
API_URL = "https://api-inference.huggingface.co/models/iduryodhanrao/my-quantized-llm"
headers = {"Authorization": "Bearer YOUR_HF_TOKEN"}
def query(payload):
response = requests.post(API_URL, headers=headers, json=payload)
return response.json()
output = query({"inputs": "The future of AI is"})
print(output)
Limitations
- This model is quantized and may have slightly reduced accuracy compared to the original model
- Designed for efficient inference rather than fine-tuning
License
Licensed under Apache 2.0
- Downloads last month
- 10