Views
No views yet
bfloat16 for memory efficiency and numerical stability.1import torch
2from transformers import AutoTokenizer, CLIPImageProcessor,AutoModel
3
4device = "cuda" if torch.cuda.is_available() else "cpu"
5model_path = "iamthehimansh/LlamaVision-llama-3.3-1b"
6external_image_path = r"./image/bahubali_poster.jpg"
7
8model = AutoModel.from_pretrained(
9 "iamthehimansh/LlamaVision-llama-3.3-1b",
10 trust_remote_code=True
11)
12# LlamaVisionModel.from_pretrained(model_path)
13model.to(device)
14model.eval()
15
16tokenizer = AutoTokenizer.from_pretrained(model_path)
17image_processor = CLIPImageProcessor.from_pretrained(model_path)
18
19query="Explain this image "
20res= model.genrate_with_vision(external_image_path, query,tokenizer,image_processor)
21print(res)jackyhate/text-to-image-2M