Views
No views yet
1from transformers import LlavaForConditionalGeneration, AutoProcessor
2from PIL import Image
3
4model = LlavaForConditionalGeneration.from_pretrained("kkk5/CIM-LLaVA1.5-7B", torch_dtype="auto", device_map="auto")
5processor = AutoProcessor.from_pretrained("kkk5/CIM-LLaVA1.5-7B")
6
7image = Image.open("your_image.jpg").convert("RGB")
8messages = [{"role": "user", "content": [
9 {"type": "image"},
10 {"type": "text", "text": "Caption this image as accurately as possible, without speculation. Describe what you see."},
11]}]
12
13text = processor.apply_chat_template(messages, add_generation_prompt=True)
14inputs = processor(images=image, text=text, return_tensors="pt").to(model.device)
15
16output_ids = model.generate(**inputs, max_new_tokens=1024)
17output_text = processor.batch_decode(output_ids[:, inputs.input_ids.shape[1]:], skip_special_tokens=True)[0]
18print(output_text)1@inproceedings{jia2026cross,
2 title = {Cross-modal Identity Mapping: Minimizing Information Loss in Modality Conversion via Reinforcement Learning},
3 author = {Jia, Haonan and Dong, Shichao and Dong, Xin and Sun, Zenghui and Wang, Jin and Lan, Jinsong and Zhu, Xiaoyong and Zheng, Bo and Zhang, Kaifu},
4 booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
5 pages = {766--777},
6 year = {2026}
7}