Instructions to use liuhaotian/llava-336px-pretrain-vicuna-7b-v1.3 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use liuhaotian/llava-336px-pretrain-vicuna-7b-v1.3 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="liuhaotian/llava-336px-pretrain-vicuna-7b-v1.3")# Load model directly from transformers import AutoProcessor, AutoModelForCausalLM processor = AutoProcessor.from_pretrained("liuhaotian/llava-336px-pretrain-vicuna-7b-v1.3") model = AutoModelForCausalLM.from_pretrained("liuhaotian/llava-336px-pretrain-vicuna-7b-v1.3", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use liuhaotian/llava-336px-pretrain-vicuna-7b-v1.3 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "liuhaotian/llava-336px-pretrain-vicuna-7b-v1.3" # 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-336px-pretrain-vicuna-7b-v1.3", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/liuhaotian/llava-336px-pretrain-vicuna-7b-v1.3
- SGLang
How to use liuhaotian/llava-336px-pretrain-vicuna-7b-v1.3 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-336px-pretrain-vicuna-7b-v1.3" \ --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-336px-pretrain-vicuna-7b-v1.3", "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-336px-pretrain-vicuna-7b-v1.3" \ --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-336px-pretrain-vicuna-7b-v1.3", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use liuhaotian/llava-336px-pretrain-vicuna-7b-v1.3 with Docker Model Runner:
docker model run hf.co/liuhaotian/llava-336px-pretrain-vicuna-7b-v1.3
Error loading model
Hi there! I'm trying to download this model using the code provided by "Use in Transformers".
from transformers import AutoProcessor, AutoModelForCausalLM
processor = AutoProcessor.from_pretrained("liuhaotian/llava-336px-pretrain-vicuna-13b-v1.3")
model = AutoModelForCausalLM.from_pretrained("liuhaotian/llava-336px-pretrain-vicuna-13b-v1.3")
I'm currently getting an error when I run this code:
OSError: liuhaotian/llava-336px-pretrain-vicuna-13b-v1.3 does not appear to have a file named preprocessor_config.json. Checkout 'https://huggingface.co/liuhaotian/llava-336px-pretrain-vicuna-13b-v1.3/main' for available files.
When I just run this line model = AutoModelForCausalLM.from_pretrained("liuhaotian/llava-336px-pretrain-vicuna-13b-v1.3"), I get this error:
ValueError: Unrecognized configuration class <class 'transformers.models.llava.configuration_llava.LlavaConfig'> for this kind of AutoModel: AutoModelForCausalLM.
Model type should be one of BartConfig, BertConfig, BertGenerationConfig, BigBirdConfig, BigBirdPegasusConfig, BioGptConfig, BlenderbotConfig, BlenderbotSmallConfig, BloomConfig, CamembertConfig, LlamaConfig, CodeGenConfig, CpmAntConfig, CTRLConfig, Data2VecTextConfig, ElectraConfig, ErnieConfig, FalconConfig, FuyuConfig, GitConfig, GPT2Config, GPT2Config, GPTBigCodeConfig, GPTNeoConfig, GPTNeoXConfig, GPTNeoXJapaneseConfig, GPTJConfig, LlamaConfig, MarianConfig, MBartConfig, MegaConfig, MegatronBertConfig, MistralConfig, MixtralConfig, MptConfig, MusicgenConfig, MvpConfig, OpenLlamaConfig, OpenAIGPTConfig, OPTConfig, PegasusConfig, PersimmonConfig, PhiConfig, PLBartConfig, ProphetNetConfig, QDQBertConfig, ReformerConfig, RemBertConfig, RobertaConfig, RobertaPreLayerNormConfig, RoCBertConfig, RoFormerConfig, RwkvConfig, Speech2Text2Config, TransfoXLConfig, TrOCRConfig, WhisperConfig, XGLMConfig, XLMConfig, XLMProphetNetConfig, XLMRobertaConfig, XLMRobertaXLConfig, XLNetConfig, XmodConfig.
I'm using transformers version 4.36.2.
Any thoughts on what might be going wrong here and how to fix it?
Thanks in advance for the help!
Update that I tried updating my transformers version to the following commit: pip install git+https://github.com/huggingface/transformers.git@cae78c46, but am now getting the following error:
File "/home/kopsahlong/miniconda3/envs/test2/lib/python3.10/site-packages/transformers/models/auto/configuration_auto.py", line 926, in from_pretrained
config_class = CONFIG_MAPPING[config_dict["model_type"]]
File "/home/kopsahlong/miniconda3/envs/test2/lib/python3.10/site-packages/transformers/models/auto/configuration_auto.py", line 632, in __getitem__
raise KeyError(key)
KeyError: 'llava'
this is just a pretrained projector and is not the full model.
if you want to use the latest transformers to directly load the model, please use : https://huggingface.co/llava-hf/llava-1.5-7b-hf or https://huggingface.co/llava-hf/llava-1.5-13b-hf
otherwise, use our code base and https://huggingface.co/collections/liuhaotian/llava-15-653aac15d994e992e2677a7e
thanks.