Downloads · 30 days
21
1% of all-time downloads
nota-ai/phiva-4b-hf
phiva-4b-hf is a image-text-to-text model from nota-ai. Use it for the image-text-to-text task on the model card, and read the license before you ship it in a product. It is set up for transformers.
The vision-language model published in this repository was developed by combining several modules (e.g., vision encoder, language model). Commercial use of any modifications, additions, or newly trained parameters mad…
Downloads · 30 days
21
1% of all-time downloads
All-time downloads
2.2K
Public
Parameters
3.9B
7.8 GB on disk
Likes
3
Public
Click a slice to open those files.
.safetensors7.8 GB · 100%
From the Hugging Face model README
import requests
from PIL import Image
import torch
from transformers import AutoProcessor, LlavaForConditionalGeneration
model_id = "nota-ai/phiva-4b-hf"
prompt = "USER: <image>\nWhat are these?\nASSISTANT:"
image_file = "http://images.cocodataset.org/val2017/000000039769.jpg"
model = LlavaForConditionalGeneration.from_pretrained(
model_id,
torch_dtype=torch.float16,
low_cpu_mem_usage=True,
attn_implementation="eager"
).to(0)
processor = AutoProcessor.from_pretrained(model_id)
raw_image = Image.open(requests.get(image_file, stream=True).raw)
inputs = processor(prompt, raw_image, return_tensors='pt').to(0, torch.float16)
output = model.generate(**inputs, max_new_tokens=200, do_sample=False)
print(processor.decode(output[0][inputs['input_ids'].shape[-1]:], skip_special_tokens=True))
The vision-language model published in this repository was developed by combining several modules (e.g., vision encoder, language model). Commercial use of any modifications, additions, or newly trained parameters made to combine these modules is not allowed. However, commercial use of the unmodified modules is allowed under their respective licenses. If you wish to use the individual modules commercially, you may refer to their original repositories and licenses provided below.
Vision encoder (license) link : Model, License