Instructions to use ayoubkirouane/phi-2-arxiv-physics with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ayoubkirouane/phi-2-arxiv-physics with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ayoubkirouane/phi-2-arxiv-physics")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("ayoubkirouane/phi-2-arxiv-physics", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use ayoubkirouane/phi-2-arxiv-physics with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ayoubkirouane/phi-2-arxiv-physics" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ayoubkirouane/phi-2-arxiv-physics", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/ayoubkirouane/phi-2-arxiv-physics
- SGLang
How to use ayoubkirouane/phi-2-arxiv-physics 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 "ayoubkirouane/phi-2-arxiv-physics" \ --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": "ayoubkirouane/phi-2-arxiv-physics", "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 "ayoubkirouane/phi-2-arxiv-physics" \ --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": "ayoubkirouane/phi-2-arxiv-physics", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use ayoubkirouane/phi-2-arxiv-physics with Docker Model Runner:
docker model run hf.co/ayoubkirouane/phi-2-arxiv-physics
Phi-2-arxiv-physics :
Phi-2-arxiv-physics is a small language model (SLM) derived from Microsoft Research's Phi-2, a Transformer-based model with 2.7 billion parameters. Specifically fine-tuned using the innovative QLoRA (Quantized Low-rank Adapters) technique, this model exhibits remarkable capabilities in the domain of physics-related text.
Fine-Tuning:
The model has been fine-tuned using QLoRA, a technique that reduces computational and memory requirements during the fine-tuning process.
This two-stage approach involves quantizing parameters and introducing learnable low-rank adapters, resulting in faster fine-tuning with reduced memory demands.
Data Source:
Phi-2-arxiv-physics is specifically trained on the arXiv-physics dataset, consisting of questions and answers related to physics.
This dataset is sourced from the arXiv repository, encompassing a wide range of topics within the field of physics.
Usage (High-level) :
!pip install -q -U git+https://github.com/huggingface/transformers.git
from transformers import pipeline
pipe = pipeline("text-generation", model="ayoubkirouane/phi-2-arxiv-physics")
## or :
# load it directly
from transformers import AutoModel
model = AutoModel.from_pretrained("ayoubkirouane/phi-2-arxiv-physics")