liuhaotian/LLaVA-Instruct-150K
Preview • Updated • 7.25k • 600
How to use RaviNaik/Llava-Phi2 with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("image-text-to-text", model="RaviNaik/Llava-Phi2") # Load model directly
from transformers import AutoModelForCausalLM
model = AutoModelForCausalLM.from_pretrained("RaviNaik/Llava-Phi2", dtype="auto")How to use RaviNaik/Llava-Phi2 with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "RaviNaik/Llava-Phi2"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "RaviNaik/Llava-Phi2",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/RaviNaik/Llava-Phi2
How to use RaviNaik/Llava-Phi2 with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "RaviNaik/Llava-Phi2" \
--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": "RaviNaik/Llava-Phi2",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'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 "RaviNaik/Llava-Phi2" \
--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": "RaviNaik/Llava-Phi2",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use RaviNaik/Llava-Phi2 with Docker Model Runner:
docker model run hf.co/RaviNaik/Llava-Phi2
This is a multimodal implementation of Phi2 model inspired by LlaVA-Phi.
Use the code below to get started with the model.
git clone https://github.com/zhuyiche/llava-phi.git
cd llava-phi
conda create -n llava_phi python=3.10 -y
conda activate llava_phi
pip install --upgrade pip # enable PEP 660 support
pip install -e .
python llava_phi/eval/run_llava_phi.py --model-path="RaviNaik/Llava-Phi2" \
--image-file="https://huggingface.co/RaviNaik/Llava-Phi2/resolve/main/people.jpg?download=true" \
--query="How many people are there in the image?"
This implementation is based on wonderful work done by:
LlaVA-Phi
Llava
Phi2