StudentWen commited on
Commit
3b89774
1 Parent(s): 63963f0

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +25 -0
README.md CHANGED
@@ -22,6 +22,31 @@ If you find this model helpful, please *like* this model and star us on https://
22
 
23
  * **多模态指令数据**:指令微调阶段,数据主要来自[LLava](https://github.com/haotian-liu/LLaVA), [LRV-Instruction](https://github.com/FuxiaoLiu/LRV-Instruction), [LLaVAR](https://github.com/SALT-NLP/LLaVAR),[LVIS-INSTRUCT4V](https://github.com/X2FD/LVIS-INSTRUCT4V)等开源项目,我们也对其中部分数据进行了翻译,在此真诚的感谢他们为开源所做出的贡献!
24
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  ### [MME Benchmark](https://github.com/BradyFU/Awesome-Multimodal-Large-Language-Models/tree/Evaluation)
26
  | Category | Score |
27
  |------------------------|-------|
 
22
 
23
  * **多模态指令数据**:指令微调阶段,数据主要来自[LLava](https://github.com/haotian-liu/LLaVA), [LRV-Instruction](https://github.com/FuxiaoLiu/LRV-Instruction), [LLaVAR](https://github.com/SALT-NLP/LLaVAR),[LVIS-INSTRUCT4V](https://github.com/X2FD/LVIS-INSTRUCT4V)等开源项目,我们也对其中部分数据进行了翻译,在此真诚的感谢他们为开源所做出的贡献!
24
 
25
+ ### 模型使用
26
+ ``` python
27
+ import torch
28
+ from transformers import AutoModelForCausalLM, AutoTokenizer
29
+ model_dir = '/path/to_finetuned_model/'
30
+ img_path = 'you_image_path'
31
+ tokenizer = AutoTokenizer.from_pretrained(model_dir, trust_remote_code=True)
32
+ model = AutoModelForCausalLM.from_pretrained(model_dir, trust_remote_code=True).eval()
33
+ model.generation_config = GenerationConfig.from_pretrained(model_dir, trust_remote_code=True)
34
+ question = '详细描述一下这张图'
35
+
36
+ query = tokenizer.from_list_format([
37
+ {'image': img_path}, # Either a local path or an url
38
+ {'text': question},
39
+ ])
40
+ response, history = model.chat(tokenizer, query=query, history=None)
41
+ print(response)
42
+
43
+ #or
44
+ query = f'<img>{img_path}</img>\n{question}'
45
+ response, history = model.chat(tokenizer, query=query, history=None)
46
+ print(response)
47
+ ```
48
+
49
+
50
  ### [MME Benchmark](https://github.com/BradyFU/Awesome-Multimodal-Large-Language-Models/tree/Evaluation)
51
  | Category | Score |
52
  |------------------------|-------|