finalf0 commited on
Commit
d6b3c68
1 Parent(s): 205b025

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +40 -1
README.md CHANGED
@@ -1,3 +1,42 @@
 
 
 
1
 
2
  ## MiniCPM-Llama3-V 2.5
3
- See [here](https://huggingface.co/openbmb/MiniCPM-Llama3-V-2_5) for more detail.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ pipeline_tag: visual-question-answering
3
+ ---
4
 
5
  ## MiniCPM-Llama3-V 2.5
6
+ More detail about [MiniCPM-Llama3-V 2.5](https://huggingface.co/openbmb/MiniCPM-Llama3-V-2_5).
7
+
8
+ ## Usage
9
+ Inference using Huggingface transformers on NVIDIA GPUs. Requirements tested on python 3.10:
10
+ ```
11
+ Pillow==10.1.0
12
+ torch==2.1.2
13
+ torchvision==0.16.2
14
+ transformers==4.40.0
15
+ sentencepiece==0.1.99
16
+ accelerate==0.30.1
17
+ bitsandbytes==0.43.1
18
+ ```
19
+
20
+ ```python
21
+ # test.py
22
+ import torch
23
+ from PIL import Image
24
+ from transformers import AutoModel, AutoTokenizer
25
+
26
+ model = AutoModel.from_pretrained('openbmb/MiniCPM-Llama3-V-2_5-int4', trust_remote_code=True)
27
+ tokenizer = AutoTokenizer.from_pretrained('openbmb/MiniCPM-Llama3-V-2_5-int4', trust_remote_code=True)
28
+ model.eval()
29
+
30
+ image = Image.open('xx.jpg').convert('RGB')
31
+ question = 'What is in the image?'
32
+ msgs = [{'role': 'user', 'content': question}]
33
+
34
+ res = model.chat(
35
+ image=image,
36
+ msgs=msgs,
37
+ tokenizer=tokenizer,
38
+ sampling=True,
39
+ temperature=0.7
40
+ )
41
+ print(res)
42
+ ```