Instructions to use Satyam-Singh/LLaVa-Large-Language-Virtual-Assistant-v2.1.6 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Satyam-Singh/LLaVa-Large-Language-Virtual-Assistant-v2.1.6 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Satyam-Singh/LLaVa-Large-Language-Virtual-Assistant-v2.1.6")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Satyam-Singh/LLaVa-Large-Language-Virtual-Assistant-v2.1.6") model = AutoModelForCausalLM.from_pretrained("Satyam-Singh/LLaVa-Large-Language-Virtual-Assistant-v2.1.6") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use Satyam-Singh/LLaVa-Large-Language-Virtual-Assistant-v2.1.6 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Satyam-Singh/LLaVa-Large-Language-Virtual-Assistant-v2.1.6" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Satyam-Singh/LLaVa-Large-Language-Virtual-Assistant-v2.1.6", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Satyam-Singh/LLaVa-Large-Language-Virtual-Assistant-v2.1.6
- SGLang
How to use Satyam-Singh/LLaVa-Large-Language-Virtual-Assistant-v2.1.6 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 "Satyam-Singh/LLaVa-Large-Language-Virtual-Assistant-v2.1.6" \ --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": "Satyam-Singh/LLaVa-Large-Language-Virtual-Assistant-v2.1.6", "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 "Satyam-Singh/LLaVa-Large-Language-Virtual-Assistant-v2.1.6" \ --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": "Satyam-Singh/LLaVa-Large-Language-Virtual-Assistant-v2.1.6", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Satyam-Singh/LLaVa-Large-Language-Virtual-Assistant-v2.1.6 with Docker Model Runner:
docker model run hf.co/Satyam-Singh/LLaVa-Large-Language-Virtual-Assistant-v2.1.6
Model Card for LLaVa-8x7B
The LLaVa-8x7B Large Language Model (LLM) is a pretrained generative Sparse Mixture of Experts. The LLaVa-8x7B outperforms Llama 3 70B on most benchmarks we tested.
Warning
This repo contains weights that are compatible with vLLM serving of the model as well as Hugging Face transformers library. It is based on the original LLaVa torrent release, but the file format and parameter names are different. Please note that model cannot (yet) be instantiated with HF.
Run the model
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "Satyam-Singh/LLaVa-Large-Language-Virtual-Assistant-v2.1.6"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id)
text = "Hello my name is"
inputs = tokenizer(text, return_tensors="pt")
outputs = model.generate(**inputs, max_new_tokens=20)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
By default, transformers will load the model in full precision. Therefore you might be interested to further reduce down the memory requirements to run the model through the optimizations we offer in HF ecosystem:
In half-precision
Note float16 precision only works on GPU devices
Click to expand
+ import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "Satyam-Singh/LLaVa-Large-Language-Virtual-Assistant-v2.1.6"
tokenizer = AutoTokenizer.from_pretrained(model_id)
+ model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.float16).to(0)
text = "Hello my name is"
+ inputs = tokenizer(text, return_tensors="pt").to(0)
outputs = model.generate(**inputs, max_new_tokens=20)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
Lower precision using (8-bit & 4-bit) using bitsandbytes
Click to expand
+ import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "Satyam-Singh/LLaVa-Large-Language-Virtual-Assistant-v2.1.6"
tokenizer = AutoTokenizer.from_pretrained(model_id)
+ model = AutoModelForCausalLM.from_pretrained(model_id, load_in_4bit=True)
text = "Hello my name is"
+ inputs = tokenizer(text, return_tensors="pt").to(0)
outputs = model.generate(**inputs, max_new_tokens=20)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
Load the model with Flash Attention 2
Click to expand
+ import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "Satyam-Singh/LLaVa-Large-Language-Virtual-Assistant-v2.1.6"
tokenizer = AutoTokenizer.from_pretrained(model_id)
+ model = AutoModelForCausalLM.from_pretrained(model_id, use_flash_attention_2=True)
text = "Hello my name is"
+ inputs = tokenizer(text, return_tensors="pt").to(0)
outputs = model.generate(**inputs, max_new_tokens=20)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
Notice
LLaVa-Large-Language-Virtual-Assistant-v2.1.6 is a pretrained base model and therefore does not have any moderation mechanisms.
Love From The LLaVa AI & UniVerse Unique AI Team
- Downloads last month
- 6