Visual Question Answering
Transformers
Safetensors
qwen2
text-generation
multimodal
llava
text-generation-inference
Run this model with HF Jobs
Run AI-Safeguard/Ivy-VL-llava on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/AI-Safeguard/Ivy-VL-llava. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/AI-Safeguard/Ivy-VL-llava on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use AI-Safeguard/Ivy-VL-llava with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use AI-Safeguard/Ivy-VL-llava with Transformers:
# Use a pipeline as a high-level helper # Warning: Pipeline type "visual-question-answering" is no longer supported in transformers v5. # You must load the model directly (see below) or downgrade to v4.x with: # pip install "transformers<5.0.0" from transformers import pipeline pipe = pipeline("visual-question-answering", model="AI-Safeguard/Ivy-VL-llava")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("AI-Safeguard/Ivy-VL-llava") model = AutoModelForCausalLM.from_pretrained("AI-Safeguard/Ivy-VL-llava", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Improve language tag (#3)
Browse files- Improve language tag (df7c3ebdc71ce58b78d1ced1d45363a471327215)
Co-authored-by: Loïck BOURDOIS <lbourdois@users.noreply.huggingface.co>
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130---license: apache-2.0base_model:- Qwen/Qwen2.5-3B-Instruct- google/siglip-so400m-patch14-384tags:- multimodal- llavalanguage:- en- zhpipeline_tag: visual-question-answeringlibrary_name: transformers---<code>Ivy-VL</code> is a lightweight multimodal model with only 3B parameters.It accepts both image and text inputs to generate text outputs.Thanks to its lightweight design, it can be deployed on edge devices such as AI glasses and smartphones, offering low memory usage and high speed while maintaining strong performance on multimodal tasks. Some well-known small models include [PaliGemma 3B](https://huggingface.co/google/paligemma-3b-mix-448), [Moondream2](https://huggingface.co/vikhyatk/moondream2), [Qwen2-VL-2B](https://huggingface.co/Qwen/Qwen2-VL-2B), [InternVL2-2B](https://huggingface.co/OpenGVLab/InternVL2-2B), and [InternVL2_5-2B](https://huggingface.co/OpenGVLab/InternVL2_5-2B). Ivy-VL outperforms them on multiple benchmarks.# Model Summary:* Developed: AI Safeguard, CMU, Standford* Model type: Multi-modal model (image+text)* Language: Engligh and Chinese* License: Apache 2.0* Architecture: Based on LLaVA-One-Vision* LLM: Qwen/Qwen2.5-3B-Instruct* Vision Encoder: google/siglip-so400m-patch14-384* Notebook demo: [Ivy-VL-demo.ipynb](https://colab.research.google.com/drive/1D5_8sDRcP1HKlWtlqTH7s64xG8OH9NH0?usp=sharing)# Evaluation:Most of the performance data comes from the VLMEvalKit leaderboard or the original papers. We conducted evaluations using VLMEvalKit. Due to differences in environments and the LLMs used for evaluation, there may be slight variations in performance.# How to use:```python# pip install git+https://github.com/LLaVA-VL/LLaVA-NeXT.gitfrom llava.model.builder import load_pretrained_modelfrom llava.mm_utils import process_images, tokenizer_image_tokenfrom llava.constants import IMAGE_TOKEN_INDEX, DEFAULT_IMAGE_TOKENfrom llava.conversation import conv_templatesfrom PIL import Imageimport requestsimport copyimport torchimport warningswarnings.filterwarnings("ignore")pretrained = "AI-Safeguard/Ivy-VL-llava"model_name = "llava_qwen"device = "cuda"device_map = "auto"tokenizer, model, image_processor, max_length = load_pretrained_model(pretrained, None, model_name, device_map=device_map) # Add any other thing you want to pass in llava_model_argsmodel.eval()# load image from urlurl = "https://github.com/haotian-liu/LLaVA/blob/1a91fc274d7c35a9b50b3cb29c4247ae5837ce39/images/llava_v1_5_radar.jpg?raw=true"image = Image.open(requests.get(url, stream=True).raw)# load image from local environment# url = "./local_image.jpg"# image = Image.open(url)image_tensor = process_images([image], image_processor, model.config)image_tensor = [_image.to(dtype=torch.float16, device=device) for _image in image_tensor]conv_template = "qwen_1_5" # Make sure you use correct chat template for different modelsquestion = DEFAULT_IMAGE_TOKEN + "\nWhat is shown in this image?"conv = copy.deepcopy(conv_templates[conv_template])conv.append_message(conv.roles[0], question)conv.append_message(conv.roles[1], None)prompt_question = conv.get_prompt()input_ids = tokenizer_image_token(prompt_question, tokenizer, IMAGE_TOKEN_INDEX, return_tensors="pt").unsqueeze(0).to(device)image_sizes = [image.size]cont = model.generate(input_ids,images=image_tensor,image_sizes=image_sizes,do_sample=False,temperature=0,max_new_tokens=4096,)text_outputs = tokenizer.batch_decode(cont, skip_special_tokens=True)print(text_outputs)```# Future Plan:* We plan to release more versions of LLMs in different sizes.* We will focus on improving the performance of the video modality.# Contact:Feel free to contact us if you have any questions or suggestions📧:* Email (Ivy Zhang): ivy.zhang@ai-safeguard.org# Citation:If you find our work helpful, please consider citing our Model:```plaintext@misc{ivy2024ivy-vl,title={Ivy-VL:Compact Vision-Language Models Achieving SOTA with Optimal Data},url={https://huggingface.co/AI-Safeguard/Ivy-VL-llava},author={Ivy Zhang,Wei Peng,Jenny N,Theresa Yu and David Qiu},month={December},year={2024}}```123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141---license: apache-2.0base_model:- Qwen/Qwen2.5-3B-Instruct- google/siglip-so400m-patch14-384tags:- multimodal- llavalanguage:- zho- eng- fra- spa- por- deu- ita- rus- jpn- kor- vie- tha- arapipeline_tag: visual-question-answeringlibrary_name: transformers---<code>Ivy-VL</code> is a lightweight multimodal model with only 3B parameters.It accepts both image and text inputs to generate text outputs.Thanks to its lightweight design, it can be deployed on edge devices such as AI glasses and smartphones, offering low memory usage and high speed while maintaining strong performance on multimodal tasks. Some well-known small models include [PaliGemma 3B](https://huggingface.co/google/paligemma-3b-mix-448), [Moondream2](https://huggingface.co/vikhyatk/moondream2), [Qwen2-VL-2B](https://huggingface.co/Qwen/Qwen2-VL-2B), [InternVL2-2B](https://huggingface.co/OpenGVLab/InternVL2-2B), and [InternVL2_5-2B](https://huggingface.co/OpenGVLab/InternVL2_5-2B). Ivy-VL outperforms them on multiple benchmarks.# Model Summary:* Developed: AI Safeguard, CMU, Standford* Model type: Multi-modal model (image+text)* Language: Engligh and Chinese* License: Apache 2.0* Architecture: Based on LLaVA-One-Vision* LLM: Qwen/Qwen2.5-3B-Instruct* Vision Encoder: google/siglip-so400m-patch14-384* Notebook demo: [Ivy-VL-demo.ipynb](https://colab.research.google.com/drive/1D5_8sDRcP1HKlWtlqTH7s64xG8OH9NH0?usp=sharing)# Evaluation:Most of the performance data comes from the VLMEvalKit leaderboard or the original papers. We conducted evaluations using VLMEvalKit. Due to differences in environments and the LLMs used for evaluation, there may be slight variations in performance.# How to use:```python# pip install git+https://github.com/LLaVA-VL/LLaVA-NeXT.gitfrom llava.model.builder import load_pretrained_modelfrom llava.mm_utils import process_images, tokenizer_image_tokenfrom llava.constants import IMAGE_TOKEN_INDEX, DEFAULT_IMAGE_TOKENfrom llava.conversation import conv_templatesfrom PIL import Imageimport requestsimport copyimport torchimport warningswarnings.filterwarnings("ignore")pretrained = "AI-Safeguard/Ivy-VL-llava"model_name = "llava_qwen"device = "cuda"device_map = "auto"tokenizer, model, image_processor, max_length = load_pretrained_model(pretrained, None, model_name, device_map=device_map) # Add any other thing you want to pass in llava_model_argsmodel.eval()# load image from urlurl = "https://github.com/haotian-liu/LLaVA/blob/1a91fc274d7c35a9b50b3cb29c4247ae5837ce39/images/llava_v1_5_radar.jpg?raw=true"image = Image.open(requests.get(url, stream=True).raw)# load image from local environment# url = "./local_image.jpg"# image = Image.open(url)image_tensor = process_images([image], image_processor, model.config)image_tensor = [_image.to(dtype=torch.float16, device=device) for _image in image_tensor]conv_template = "qwen_1_5" # Make sure you use correct chat template for different modelsquestion = DEFAULT_IMAGE_TOKEN + "\nWhat is shown in this image?"conv = copy.deepcopy(conv_templates[conv_template])conv.append_message(conv.roles[0], question)conv.append_message(conv.roles[1], None)prompt_question = conv.get_prompt()input_ids = tokenizer_image_token(prompt_question, tokenizer, IMAGE_TOKEN_INDEX, return_tensors="pt").unsqueeze(0).to(device)image_sizes = [image.size]cont = model.generate(input_ids,images=image_tensor,image_sizes=image_sizes,do_sample=False,temperature=0,max_new_tokens=4096,)text_outputs = tokenizer.batch_decode(cont, skip_special_tokens=True)print(text_outputs)```# Future Plan:* We plan to release more versions of LLMs in different sizes.* We will focus on improving the performance of the video modality.# Contact:Feel free to contact us if you have any questions or suggestions📧:* Email (Ivy Zhang): ivy.zhang@ai-safeguard.org# Citation:If you find our work helpful, please consider citing our Model:```plaintext@misc{ivy2024ivy-vl,title={Ivy-VL:Compact Vision-Language Models Achieving SOTA with Optimal Data},url={https://huggingface.co/AI-Safeguard/Ivy-VL-llava},author={Ivy Zhang,Wei Peng,Jenny N,Theresa Yu and David Qiu},month={December},year={2024}}```
README.md+140-129