Instructions to use liuhaotian/llava-v1.5-13b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use liuhaotian/llava-v1.5-13b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="liuhaotian/llava-v1.5-13b")# Load model directly from transformers import AutoProcessor, AutoModelForCausalLM processor = AutoProcessor.from_pretrained("liuhaotian/llava-v1.5-13b") model = AutoModelForCausalLM.from_pretrained("liuhaotian/llava-v1.5-13b", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use liuhaotian/llava-v1.5-13b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "liuhaotian/llava-v1.5-13b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "liuhaotian/llava-v1.5-13b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/liuhaotian/llava-v1.5-13b
- SGLang
How to use liuhaotian/llava-v1.5-13b 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 "liuhaotian/llava-v1.5-13b" \ --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": "liuhaotian/llava-v1.5-13b", "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 "liuhaotian/llava-v1.5-13b" \ --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": "liuhaotian/llava-v1.5-13b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use liuhaotian/llava-v1.5-13b with Docker Model Runner:
docker model run hf.co/liuhaotian/llava-v1.5-13b
Commit ·
7a80ad4
1
Parent(s): 006818f
Create train
Browse files
train
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import sagemaker
|
| 2 |
+
import boto3
|
| 3 |
+
from sagemaker.huggingface import HuggingFace
|
| 4 |
+
|
| 5 |
+
try:
|
| 6 |
+
role = sagemaker.get_execution_role()
|
| 7 |
+
except ValueError:
|
| 8 |
+
iam = boto3.client('iam')
|
| 9 |
+
role = iam.get_role(RoleName='sagemaker_execution_role')['Role']['Arn']
|
| 10 |
+
|
| 11 |
+
hyperparameters = {
|
| 12 |
+
'model_name_or_path':'liuhaotian/llava-v1.5-13b',
|
| 13 |
+
'output_dir':'/opt/ml/model'
|
| 14 |
+
# add your remaining hyperparameters
|
| 15 |
+
# more info here https://github.com/huggingface/transformers/tree/v4.26.0/examples/pytorch/language-modeling
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
# git configuration to download our fine-tuning script
|
| 19 |
+
git_config = {'repo': 'https://github.com/huggingface/transformers.git','branch': 'v4.26.0'}
|
| 20 |
+
|
| 21 |
+
# creates Hugging Face estimator
|
| 22 |
+
huggingface_estimator = HuggingFace(
|
| 23 |
+
entry_point='run_mlm.py',
|
| 24 |
+
source_dir='./examples/pytorch/language-modeling',
|
| 25 |
+
instance_type='ml.p3.2xlarge',
|
| 26 |
+
instance_count=1,
|
| 27 |
+
role=role,
|
| 28 |
+
git_config=git_config,
|
| 29 |
+
transformers_version='4.26.0',
|
| 30 |
+
pytorch_version='1.13.1',
|
| 31 |
+
py_version='py39',
|
| 32 |
+
hyperparameters = hyperparameters
|
| 33 |
+
)
|
| 34 |
+
|
| 35 |
+
# starting the train job
|
| 36 |
+
huggingface_estimator.fit()
|