thomas-yanxin commited on
Commit
ea482c6
1 Parent(s): dc5d1ec

Upload 3 files

Browse files
Files changed (3) hide show
  1. README.md +95 -3
  2. Sunsimiao-V-logo.jpg +0 -0
  3. test.png +0 -0
README.md CHANGED
@@ -1,3 +1,95 @@
1
- ---
2
- license: mit
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!-- <h1 align="center">🌿Sunsimiao-V(孙思邈): 多模态医疗大模型</h1> -->
2
+ <div align=center><img src ="./images/Sunsimiao-V-logo.jpg"/></div>
3
+
4
+ <h3 align="center">慧眼明医路,守护健康途</h3>
5
+
6
+ <p align="center">
7
+ <a href="https://github.com/thomas-yanxin/Sunsimiao-V"><img src="https://img.shields.io/badge/GitHub-24292e" alt="github"></a>
8
+ <a href="https://huggingface.co/collections/thomas-yanxin/sunsimiao-v-6641e52e2803b4fe0d88f451"><img src="https://img.shields.io/badge/-HuggingFace-yellow" alt="HuggingFace"></a>
9
+ <a href="https://www.modelscope.cn/models/thomas/Sunsimiao-V-Phi3/summary"><img src="https://img.shields.io/badge/ModelScope-blueviolet" alt="modelscope"></a>
10
+ <a href="https://wisemodel.cn/models/thomas/Sunsimiao-V-Phi3/intro"><img src="https://img.shields.io/badge/WiseModel-561253" alt="WiseModel"></a>
11
+ </p>
12
+
13
+ <div align="center">
14
+
15
+ [![GitHub license](https://img.shields.io/github/license/thomas-yanxin/Sunsimiao-V
16
+ )](https://github.com/thomas-yanxin/Sunsimiao-V/blob/main/LICENSE)
17
+ [![GitHub Stars](https://img.shields.io/github/stars/thomas-yanxin/Sunsimiao-V)](https://github.com/thomas-yanxin/Sunsimiao-V/stargazers)
18
+ [![GitHub Forks](https://img.shields.io/github/forks/thomas-yanxin/Sunsimiao-V)](https://github.com/thomas-yanxin/Sunsimiao-V/fork)
19
+ [![GitHub Contributors](https://img.shields.io/github/contributors/thomas-yanxin/Sunsimiao-V)](https://github.com/thomas-yanxin/Sunsimiao-V/graphs/contributors)
20
+ </div>
21
+
22
+
23
+
24
+ ## 模型列表
25
+ | 模型名称 | 模型参数 | 🤗 HuggingFace 下载 | 🤖 ModelScope 下载 | ✡️ WiseModel 下载 |
26
+ | :----: | :----: | :----: | :----: | :----: |
27
+ | Sunsimiao-V-Phi3 | 4B | [thomas-yanxin/Sunsimiao-V-Phi3](https://huggingface.co/thomas-yanxin/Sunsimiao-V-Phi3) | [thomas/Sunsimiao-V-Phi3](https://www.modelscope.cn/models/thomas/Sunsimiao-V-Phi3/summary) | [thomas/Sunsimiao-V-Phi3](https://wisemodel.cn/models/thomas/Sunsimiao-V-Phi3/intro) |
28
+
29
+ ## 快速开始
30
+
31
+ - Chat by pipeline
32
+
33
+ ```Python
34
+ from transformers import pipeline
35
+ from PIL import Image
36
+ import requests
37
+
38
+ model_id = "thomas-yanxin/Sunsimiao-V-Phi3"
39
+ pipe = pipeline("image-to-text", model=model_id, device=0)
40
+
41
+ image = Image.open('./images/test.png')
42
+ prompt = "<|user|>\n<image>\nWhat appears unusual in the image?<|end|>\n<|assistant|>\n"
43
+
44
+ outputs = pipe(image, prompt=prompt, generate_kwargs={"max_new_tokens": 200})
45
+ print(outputs)
46
+
47
+ >>> What appears unusual in the image? Airspace opacity
48
+ ```
49
+
50
+ - Chat by pure transformers
51
+ ```Python
52
+ import requests
53
+ from PIL import Image
54
+
55
+ import torch
56
+ from transformers import AutoProcessor, LlavaForConditionalGeneration
57
+
58
+ model_id = "xtuner/llava-phi-3-mini-hf"
59
+
60
+ prompt = "<|user|>\n<image>\nWhat are these?<|end|>\n<|assistant|>\n"
61
+ image_file = "http://images.cocodataset.org/val2017/000000039769.jpg"
62
+
63
+ model = LlavaForConditionalGeneration.from_pretrained(
64
+ model_id,
65
+ torch_dtype=torch.float16,
66
+ low_cpu_mem_usage=True,
67
+ ).to(0)
68
+
69
+ processor = AutoProcessor.from_pretrained(model_id)
70
+
71
+
72
+ raw_image = Image.open(requests.get(image_file, stream=True).raw)
73
+ inputs = processor(prompt, raw_image, return_tensors='pt').to(0, torch.float16)
74
+
75
+ output = model.generate(**inputs, max_new_tokens=200, do_sample=False)
76
+ print(processor.decode(output[0][2:], skip_special_tokens=True))
77
+
78
+ ```
79
+
80
+ ## 结果对比
81
+ | 图片 | thomas-yanxin/Sunsimiao-V-Phi3 | Qwen-VL-Max | HuggingFaceH4/vsft-llava-1.5-7b-hf-trl |
82
+ | :----: | :----: | :----: | :----: |
83
+ | ![](./images/test.png) | Airspace opacity | The image is an X-ray of a human chest, and it shows some abnormalities. The lungs appear to be filled with black shadows, which could indicate the presence of fluid or other substances that should not normally be there. This suggests that the person may have a medical condition affecting their respiratory system. However, without further information or a professional diagnosis, it's impossible to determine the exact cause of these abnormalities. It's important to note that this is just a visual observation based on the image provided, and any medical diagnosis would require additional testing and evaluation by a qualified healthcare provider. | In the image, the unusual aspect is the presence of a wire or a line going through the center of the lungs. This is not a typical feature of a lung image, as lungs are typically depicted without any foreign objects or lines. The wire or line could be an artifact or an unintended element in the image, or it might represent a medical condition or intervention that has affected the lung tissue. |
84
+
85
+
86
+
87
+ ## 🙇‍ ‍致谢
88
+ ```
89
+ @misc{2023xtuner,
90
+ title={XTuner: A Toolkit for Efficiently Fine-tuning LLM},
91
+ author={XTuner Contributors},
92
+ howpublished = {\url{https://github.com/InternLM/xtuner}},
93
+ year={2023}
94
+ }
95
+ ```
Sunsimiao-V-logo.jpg ADDED
test.png ADDED