Instructions to use Noumaan/phi3-mini-128k-instruct-4bit-quantized with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Noumaan/phi3-mini-128k-instruct-4bit-quantized with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Noumaan/phi3-mini-128k-instruct-4bit-quantized", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Noumaan/phi3-mini-128k-instruct-4bit-quantized", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("Noumaan/phi3-mini-128k-instruct-4bit-quantized", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use Noumaan/phi3-mini-128k-instruct-4bit-quantized with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Noumaan/phi3-mini-128k-instruct-4bit-quantized" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Noumaan/phi3-mini-128k-instruct-4bit-quantized", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Noumaan/phi3-mini-128k-instruct-4bit-quantized
- SGLang
How to use Noumaan/phi3-mini-128k-instruct-4bit-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 "Noumaan/phi3-mini-128k-instruct-4bit-quantized" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Noumaan/phi3-mini-128k-instruct-4bit-quantized", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "Noumaan/phi3-mini-128k-instruct-4bit-quantized" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Noumaan/phi3-mini-128k-instruct-4bit-quantized", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Noumaan/phi3-mini-128k-instruct-4bit-quantized with Docker Model Runner:
docker model run hf.co/Noumaan/phi3-mini-128k-instruct-4bit-quantized
Model Card for phi3-mini-128k-instruct-4bit-quantized
This model is a 4-bit quantized version of the Phi-3-mini-128k-instruct model, optimized for efficient inference while maintaining performance.
Model Details
Model Description
- Developed by: [Noumaan]
- Model type: Causal Language Model
- Language(s) (NLP): English
- License: [Original model license]
- Finetuned from model: microsoft/Phi-3-mini-128k-instruct
This model is a 4-bit quantized version of the Phi-3-mini-128k-instruct model. It uses the bitsandbytes library for quantization, allowing for reduced memory usage and faster inference times while aiming to maintain most of the original model's performance.
Model Sources
- Repository: [Link to your HuggingFace repo]
- Original Model: https://huggingface.co/microsoft/Phi-3-mini-128k-instruct
Uses
Direct Use
This model can be used for various natural language processing tasks such as text generation, completion, and question-answering. It's particularly suitable for deployment in resource-constrained environments or for applications requiring faster inference times.
Out-of-Scope Use
This model should not be used for any malicious purposes or to generate harmful content. It's not suitable for tasks requiring extremely high precision or for making critical decisions without human oversight.
Bias, Risks, and Limitations
- The quantization process may introduce slight inaccuracies compared to the full-precision model.
- This model inherits any biases present in the original Phi-3-mini-128k-instruct model.
- The model's outputs should be treated as suggestions or starting points, not as definitive or factual information.
Recommendations
Users should be aware of the quantization's impact on model performance and validate the model's outputs for their specific use case. It's recommended to compare results with the full-precision model for critical applications.
How to Get Started with the Model
## How to Get Started with the Model
This model is pre-quantized to 4-bit precision. You can load and use it directly without additional quantization:
```python
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model_name = "your-username/phi3-mini-128k-instruct-4bit-quantized"
model = AutoModelForCausalLM.from_pretrained(
model_name,
device_map="auto",
torch_dtype=torch.float16
)
tokenizer = AutoTokenizer.from_pretrained(model_name)
# Example usage
input_text = "What is the capital of France?"
inputs = tokenizer(input_text, return_tensors="pt")
outputs = model.generate(**inputs, max_new_tokens=50)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
- Downloads last month
- 2
docker model run hf.co/Noumaan/phi3-mini-128k-instruct-4bit-quantized