BoyuNLP commited on
Commit
3bbba47
β€’
1 Parent(s): af273c1
This view is limited to 50 files because it contains too many changes. Β  See raw diff
Files changed (50) hide show
  1. LICENSE +201 -0
  2. __pycache__/app.cpython-311.pyc +0 -0
  3. app.py +113 -0
  4. controller.log +81 -0
  5. data/prompts/complex_reasoning/000_caps.txt +18 -0
  6. data/prompts/complex_reasoning/000_conv.txt +5 -0
  7. data/prompts/complex_reasoning/001_caps.txt +18 -0
  8. data/prompts/complex_reasoning/001_conv.txt +5 -0
  9. data/prompts/complex_reasoning/002_caps.txt +7 -0
  10. data/prompts/complex_reasoning/002_conv.txt +5 -0
  11. data/prompts/complex_reasoning/system_message.txt +10 -0
  12. data/prompts/conversation/000_caps.txt +5 -0
  13. data/prompts/conversation/000_conv.txt +29 -0
  14. data/prompts/conversation/001_caps.txt +5 -0
  15. data/prompts/conversation/001_conv.txt +37 -0
  16. data/prompts/conversation/system_message.txt +12 -0
  17. data/prompts/detail_description/000_caps.txt +18 -0
  18. data/prompts/detail_description/000_conv.txt +3 -0
  19. data/prompts/detail_description/001_caps.txt +18 -0
  20. data/prompts/detail_description/001_conv.txt +5 -0
  21. data/prompts/detail_description/002_caps.txt +15 -0
  22. data/prompts/detail_description/002_conv.txt +3 -0
  23. data/prompts/detail_description/system_message.txt +7 -0
  24. docs/Customize_Component.md +20 -0
  25. docs/Data.md +29 -0
  26. docs/LLaVA_Bench.md +31 -0
  27. docs/LLaVA_from_LLaMA2.md +29 -0
  28. docs/LoRA.md +46 -0
  29. docs/MODEL_ZOO.md +136 -0
  30. docs/ScienceQA.md +53 -0
  31. gradio_web_server.log +0 -0
  32. llava/__init__.py +2 -0
  33. llava/__pycache__/__init__.cpython-311.pyc +0 -0
  34. llava/__pycache__/constants.cpython-311.pyc +0 -0
  35. llava/__pycache__/conversation.cpython-311.pyc +0 -0
  36. llava/__pycache__/mm_utils.cpython-311.pyc +0 -0
  37. llava/__pycache__/utils.cpython-311.pyc +0 -0
  38. llava/constants.py +13 -0
  39. llava/conversation.py +418 -0
  40. llava/eval/Roboto-Black.ttf +0 -0
  41. llava/eval/Roboto-BlackItalic.ttf +0 -0
  42. llava/eval/Roboto-Bold.ttf +0 -0
  43. llava/eval/Roboto-BoldItalic.ttf +0 -0
  44. llava/eval/Roboto-Italic.ttf +0 -0
  45. llava/eval/Roboto-Light.ttf +0 -0
  46. llava/eval/Roboto-LightItalic.ttf +0 -0
  47. llava/eval/Roboto-Medium.ttf +0 -0
  48. llava/eval/Roboto-MediumItalic.ttf +0 -0
  49. llava/eval/Roboto-Regular.ttf +0 -0
  50. llava/eval/Roboto-Thin.ttf +0 -0
LICENSE ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
__pycache__/app.cpython-311.pyc ADDED
Binary file (4.79 kB). View file
 
app.py ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import sys
2
+ import os
3
+ import argparse
4
+ import time
5
+ import subprocess
6
+
7
+
8
+ # subprocess.check_call([sys.executable, '-m', 'pip', 'install', '-e','.'])
9
+
10
+ import llava.serve.gradio_web_server as gws
11
+
12
+ # Execute the pip install command with additional options
13
+
14
+
15
+ subprocess.check_call([sys.executable, '-m', 'pip', 'install', 'flash-attn', '--no-build-isolation', '-U'])
16
+
17
+
18
+ def start_controller():
19
+ print("Starting the controller")
20
+ controller_command = [
21
+ sys.executable,
22
+ "-m",
23
+ "llava.serve.controller",
24
+ "--host",
25
+ "0.0.0.0",
26
+ "--port",
27
+ "10000",
28
+ ]
29
+ print(controller_command)
30
+ return subprocess.Popen(controller_command)
31
+
32
+
33
+ def start_worker(model_path: str, bits=4):
34
+ print(f"Starting the model worker for the model {model_path}")
35
+ model_name = model_path.strip("/").split("/")[-1]
36
+ assert bits in [4, 8, 16], "It can be only loaded with 16-bit, 8-bit, and 4-bit."
37
+ if bits != 16:
38
+ model_name += f"-{bits}bit"
39
+ worker_command = [
40
+ sys.executable,
41
+ "-m",
42
+ "llava.serve.model_worker",
43
+ "--host",
44
+ "0.0.0.0",
45
+ "--controller",
46
+ "http://localhost:10000",
47
+ "--model-path",
48
+ model_path,
49
+ "--model-name",
50
+ 'llava-v1.5-UGround_v1',
51
+ "--use-flash-attn",
52
+ ]
53
+ if bits != 16:
54
+ worker_command += [f"--load-{bits}bit"]
55
+ print(worker_command)
56
+ return subprocess.Popen(worker_command)
57
+
58
+
59
+ if __name__ == "__main__":
60
+ parser = argparse.ArgumentParser()
61
+ parser.add_argument("--host", type=str, default="0.0.0.0")
62
+ parser.add_argument("--port", type=int)
63
+ parser.add_argument("--controller-url", type=str, default="http://localhost:10000")
64
+ parser.add_argument("--concurrency-count", type=int, default=1)
65
+ parser.add_argument("--model-list-mode", type=str, default="reload", choices=["once", "reload"])
66
+ parser.add_argument("--share", action="store_true")
67
+ parser.add_argument("--moderate", action="store_true")
68
+ parser.add_argument("--embed", action="store_true")
69
+ gws.args = parser.parse_args()
70
+ gws.models = []
71
+
72
+ gws.title_markdown += """
73
+ This is a demo for UGround from *Navigating the Digital World as Humans Do: Universal Visual Grounding for GUI Agents*. We load the 4bit model by default.
74
+ """
75
+
76
+ print(f"args: {gws.args}")
77
+
78
+ # model_path = os.getenv("model", "osunlp/UGround")
79
+ model_path = "osunlp/UGround"
80
+ # "osunlp/UGround"
81
+ bits = int(os.getenv("bits", 4))
82
+ concurrency_count = int(os.getenv("concurrency_count", 1))
83
+
84
+ controller_proc = start_controller()
85
+ worker_proc = start_worker(model_path, bits=bits)
86
+
87
+ # Wait for worker and controller to start
88
+ time.sleep(10)
89
+
90
+ exit_status = 0
91
+ try:
92
+ demo = gws.build_demo(embed_mode=False, cur_dir='./', concurrency_count=concurrency_count)
93
+ demo.queue(
94
+ status_update_rate=10,
95
+ api_open=False
96
+ ).launch(
97
+ server_name=gws.args.host,
98
+ server_port=gws.args.port,
99
+ share=gws.args.share
100
+ )
101
+
102
+ except Exception as e:
103
+ print(e)
104
+ exit_status = 1
105
+ finally:
106
+ worker_proc.kill()
107
+ controller_proc.kill()
108
+
109
+ sys.exit(exit_status)
110
+
111
+
112
+ #preload_from_hub:
113
+ # - "osunlp/UGround"
controller.log ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 2024-10-09 14:33:33 | INFO | controller | args: Namespace(host='0.0.0.0', port=10000, dispatch_method='shortest_queue')
2
+ 2024-10-09 14:33:33 | INFO | controller | Init controller
3
+ 2024-10-09 14:33:33 | ERROR | stderr | INFO: Started server process [67560]
4
+ 2024-10-09 14:33:33 | ERROR | stderr | INFO: Waiting for application startup.
5
+ 2024-10-09 14:33:33 | ERROR | stderr | INFO: Application startup complete.
6
+ 2024-10-09 14:33:33 | ERROR | stderr | INFO: Uvicorn running on http://0.0.0.0:10000 (Press CTRL+C to quit)
7
+ 2024-10-09 14:34:27 | ERROR | stderr | INFO: Shutting down
8
+ 2024-10-09 14:34:27 | ERROR | stderr | INFO: Waiting for application shutdown.
9
+ 2024-10-09 14:34:27 | ERROR | stderr | INFO: Application shutdown complete.
10
+ 2024-10-09 14:34:27 | ERROR | stderr | INFO: Finished server process [67560]
11
+ 2024-10-09 14:34:36 | INFO | controller | args: Namespace(host='0.0.0.0', port=10000, dispatch_method='shortest_queue')
12
+ 2024-10-09 14:34:36 | INFO | controller | Init controller
13
+ 2024-10-09 14:34:36 | ERROR | stderr | INFO: Started server process [67981]
14
+ 2024-10-09 14:34:36 | ERROR | stderr | INFO: Waiting for application startup.
15
+ 2024-10-09 14:34:36 | ERROR | stderr | INFO: Application startup complete.
16
+ 2024-10-09 14:34:36 | ERROR | stderr | INFO: Uvicorn running on http://0.0.0.0:10000 (Press CTRL+C to quit)
17
+ 2024-10-09 14:38:20 | ERROR | stderr | INFO: Shutting down
18
+ 2024-10-09 14:38:21 | ERROR | stderr | INFO: Waiting for application shutdown.
19
+ 2024-10-09 14:38:21 | ERROR | stderr | INFO: Application shutdown complete.
20
+ 2024-10-09 14:38:21 | ERROR | stderr | INFO: Finished server process [67981]
21
+ 2024-10-09 14:38:29 | INFO | controller | args: Namespace(host='0.0.0.0', port=10000, dispatch_method='shortest_queue')
22
+ 2024-10-09 14:38:29 | INFO | controller | Init controller
23
+ 2024-10-09 14:38:29 | ERROR | stderr | INFO: Started server process [68570]
24
+ 2024-10-09 14:38:29 | ERROR | stderr | INFO: Waiting for application startup.
25
+ 2024-10-09 14:38:29 | ERROR | stderr | INFO: Application startup complete.
26
+ 2024-10-09 14:38:29 | ERROR | stderr | INFO: Uvicorn running on http://0.0.0.0:10000 (Press CTRL+C to quit)
27
+ 2024-10-09 14:39:53 | INFO | controller | args: Namespace(host='0.0.0.0', port=10000, dispatch_method='shortest_queue')
28
+ 2024-10-09 14:39:53 | INFO | controller | Init controller
29
+ 2024-10-09 14:39:53 | ERROR | stderr | INFO: Started server process [68631]
30
+ 2024-10-09 14:39:53 | ERROR | stderr | INFO: Waiting for application startup.
31
+ 2024-10-09 14:39:53 | ERROR | stderr | INFO: Application startup complete.
32
+ 2024-10-09 14:39:53 | ERROR | stderr | INFO: Uvicorn running on http://0.0.0.0:10000 (Press CTRL+C to quit)
33
+ 2024-10-09 14:39:59 | INFO | stdout | INFO: 127.0.0.1:58494 - "GET / HTTP/1.1" 404 Not Found
34
+ 2024-10-09 14:40:33 | INFO | controller | args: Namespace(host='0.0.0.0', port=10000, dispatch_method='shortest_queue')
35
+ 2024-10-09 14:40:33 | INFO | controller | Init controller
36
+ 2024-10-09 14:40:33 | ERROR | stderr | INFO: Started server process [68681]
37
+ 2024-10-09 14:40:33 | ERROR | stderr | INFO: Waiting for application startup.
38
+ 2024-10-09 14:40:33 | ERROR | stderr | INFO: Application startup complete.
39
+ 2024-10-09 14:40:33 | ERROR | stderr | INFO: Uvicorn running on http://0.0.0.0:10000 (Press CTRL+C to quit)
40
+ 2024-10-09 14:40:41 | INFO | stdout | INFO: 127.0.0.1:58574 - "GET / HTTP/1.1" 404 Not Found
41
+ 2024-10-09 14:47:47 | ERROR | stderr | INFO: Shutting down
42
+ 2024-10-09 14:47:48 | ERROR | stderr | INFO: Waiting for application shutdown.
43
+ 2024-10-09 14:47:48 | ERROR | stderr | INFO: Application shutdown complete.
44
+ 2024-10-09 14:47:48 | ERROR | stderr | INFO: Finished server process [68681]
45
+ 2024-10-09 14:47:54 | INFO | controller | args: Namespace(host='0.0.0.0', port=10000, dispatch_method='shortest_queue')
46
+ 2024-10-09 14:47:54 | INFO | controller | Init controller
47
+ 2024-10-09 14:47:54 | ERROR | stderr | INFO: Started server process [69107]
48
+ 2024-10-09 14:47:54 | ERROR | stderr | INFO: Waiting for application startup.
49
+ 2024-10-09 14:47:54 | ERROR | stderr | INFO: Application startup complete.
50
+ 2024-10-09 14:47:54 | ERROR | stderr | INFO: Uvicorn running on http://0.0.0.0:10000 (Press CTRL+C to quit)
51
+ 2024-10-09 14:48:02 | INFO | stdout | INFO: 127.0.0.1:59180 - "GET / HTTP/1.1" 404 Not Found
52
+ 2024-10-09 14:50:56 | INFO | controller | args: Namespace(host='0.0.0.0', port=10000, dispatch_method='shortest_queue')
53
+ 2024-10-09 14:50:56 | INFO | controller | Init controller
54
+ 2024-10-09 14:50:56 | ERROR | stderr | INFO: Started server process [69357]
55
+ 2024-10-09 14:50:56 | ERROR | stderr | INFO: Waiting for application startup.
56
+ 2024-10-09 14:50:56 | ERROR | stderr | INFO: Application startup complete.
57
+ 2024-10-09 14:50:56 | ERROR | stderr | INFO: Uvicorn running on http://0.0.0.0:10000 (Press CTRL+C to quit)
58
+ 2024-10-09 14:51:43 | INFO | controller | args: Namespace(host='0.0.0.0', port=10000, dispatch_method='shortest_queue')
59
+ 2024-10-09 14:51:43 | INFO | controller | Init controller
60
+ 2024-10-09 14:51:43 | ERROR | stderr | INFO: Started server process [69433]
61
+ 2024-10-09 14:51:43 | ERROR | stderr | INFO: Waiting for application startup.
62
+ 2024-10-09 14:51:43 | ERROR | stderr | INFO: Application startup complete.
63
+ 2024-10-09 14:51:43 | ERROR | stderr | INFO: Uvicorn running on http://0.0.0.0:10000 (Press CTRL+C to quit)
64
+ 2024-10-09 14:53:04 | INFO | controller | args: Namespace(host='0.0.0.0', port=10000, dispatch_method='shortest_queue')
65
+ 2024-10-09 14:53:04 | INFO | controller | Init controller
66
+ 2024-10-09 14:53:04 | ERROR | stderr | INFO: Started server process [69542]
67
+ 2024-10-09 14:53:04 | ERROR | stderr | INFO: Waiting for application startup.
68
+ 2024-10-09 14:53:04 | ERROR | stderr | INFO: Application startup complete.
69
+ 2024-10-09 14:53:04 | ERROR | stderr | INFO: Uvicorn running on http://0.0.0.0:10000 (Press CTRL+C to quit)
70
+ 2024-10-09 14:53:57 | INFO | controller | args: Namespace(host='0.0.0.0', port=10000, dispatch_method='shortest_queue')
71
+ 2024-10-09 14:53:57 | INFO | controller | Init controller
72
+ 2024-10-09 14:53:57 | ERROR | stderr | INFO: Started server process [69660]
73
+ 2024-10-09 14:53:57 | ERROR | stderr | INFO: Waiting for application startup.
74
+ 2024-10-09 14:53:57 | ERROR | stderr | INFO: Application startup complete.
75
+ 2024-10-09 14:53:57 | ERROR | stderr | INFO: Uvicorn running on http://0.0.0.0:10000 (Press CTRL+C to quit)
76
+ 2024-10-09 14:54:37 | INFO | controller | args: Namespace(host='0.0.0.0', port=10000, dispatch_method='shortest_queue')
77
+ 2024-10-09 14:54:37 | INFO | controller | Init controller
78
+ 2024-10-09 14:54:37 | ERROR | stderr | INFO: Started server process [69742]
79
+ 2024-10-09 14:54:37 | ERROR | stderr | INFO: Waiting for application startup.
80
+ 2024-10-09 14:54:37 | ERROR | stderr | INFO: Application startup complete.
81
+ 2024-10-09 14:54:37 | ERROR | stderr | INFO: Uvicorn running on http://0.0.0.0:10000 (Press CTRL+C to quit)
data/prompts/complex_reasoning/000_caps.txt ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ A man wearing multiple neck ties making a goofy face.
2
+ A man in a white shirt wearing very many ties.
3
+ a man with ties on poses for a picture
4
+ A man wearing multiple ties on his neck.
5
+ A young man smiles while wearing several ties.
6
+
7
+ tie: [0.574, 0.298, 0.752, 0.704]
8
+ tie: [0.464, 0.339, 0.639, 0.789]
9
+ tie: [0.349, 0.363, 0.563, 0.732]
10
+ tie: [0.259, 0.255, 0.668, 0.805]
11
+ person: [0.019, 0.065, 0.962, 0.988]
12
+ person: [0.0, 0.24, 0.214, 1.0]
13
+ tie: [0.316, 0.778, 0.443, 0.867]
14
+ tie: [0.386, 0.707, 0.496, 0.801]
15
+ tie: [0.251, 0.354, 0.402, 0.747]
16
+ tie: [0.44, 0.318, 0.63, 0.397]
17
+ tie: [0.566, 0.33, 0.655, 0.543]
18
+ tie: [0.25, 0.409, 0.359, 0.556]
data/prompts/complex_reasoning/000_conv.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ Question:
2
+ What is unusual about this photo?
3
+ ===
4
+ Answer:
5
+ In the photo, the man is wearing a total of ten ties around his neck. This is considered unusual because it is not common for someone to wear multiple ties at once. In a typical setting, a person would wear only one tie. The man's goofy facial expression also adds to the unconventional and humorous nature of the image.
data/prompts/complex_reasoning/001_caps.txt ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ A group of people standing outside of a black vehicle with various luggage.
2
+ Luggage surrounds a vehicle in an underground parking area
3
+ People try to fit all of their luggage in an SUV.
4
+ The sport utility vehicle is parked in the public garage, being packed for a trip
5
+ Some people with luggage near a van that is transporting it.
6
+
7
+ person: [0.681, 0.242, 0.774, 0.694]
8
+ person: [0.63, 0.222, 0.686, 0.516]
9
+ person: [0.444, 0.233, 0.487, 0.34]
10
+ backpack: [0.384, 0.696, 0.485, 0.914]
11
+ backpack: [0.755, 0.413, 0.846, 0.692]
12
+ suitcase: [0.758, 0.413, 0.845, 0.69]
13
+ suitcase: [0.1, 0.497, 0.173, 0.579]
14
+ bicycle: [0.282, 0.363, 0.327, 0.442]
15
+ car: [0.786, 0.25, 0.848, 0.322]
16
+ car: [0.783, 0.27, 0.827, 0.335]
17
+ car: [0.86, 0.254, 0.891, 0.3]
18
+ car: [0.261, 0.101, 0.787, 0.626]
data/prompts/complex_reasoning/001_conv.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ Question:
2
+ What challenges do these people face?
3
+ ===
4
+ Answer:
5
+ In the image, a group of people is standing outside a black SUV in a parking area, surrounded by various pieces of luggage, including suitcases and backpacks. They are facing the challenge of fitting all their luggage into the black SUV. There are multiple suitcases and backpacks to be packed, which suggests that the group has a significant amount of belongings to accommodate. They might have to strategize and arrange the luggage efficiently to ensure that everything fits properly into the vehicle. Additionally, they need to consider the comfort of the passengers and visibility while driving, so the placement of the luggage must not obstruct the driver's view or make the passengers uncomfortable during the trip.
data/prompts/complex_reasoning/002_caps.txt ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ There is a movie theater that displays the show times above the doors.
2
+ A red fire hydrant is deep in the snow.
3
+ The fire hydrant is in the snow near a recently plowed sidewalk.
4
+ This city has had a very hard winter with snow.
5
+ A hotel for dogs in the snow in winter.
6
+
7
+ fire hydrant: [0.326, 0.612, 0.426, 0.72]
data/prompts/complex_reasoning/002_conv.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ Question:
2
+ What challenges might this city face?
3
+ ===
4
+ Answer:
5
+ The city faces challenges due to the harsh winter conditions and heavy snowfall. In the image, a red fire hydrant is almost buried deep in the snow, which indicates the significant amount of snow the city has experienced. This can lead to various challenges such as difficulties in transportation, increased risk of accidents, and disruptions to daily life. For example, the recently plowed sidewalk near the fire hydrant shows that the city has to constantly clear snow from roads and sidewalks to maintain access and safety for pedestrians and vehicles. Moreover, emergency services, like firefighters, might face challenges accessing crucial equipment, such as fire hydrants, during emergencies due to the snow accumulation. This highlights the importance of effective snow management strategies and preparedness in such cities to minimize the impact of harsh winter conditions on residents and essential services.
data/prompts/complex_reasoning/system_message.txt ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ You are an AI visual assistant that can analyze a single image. You receive five sentences, each describing the same image you are observing. In addition, specific object locations within the image are given, along with detailed coordinates. These coordinates are in the form of bounding boxes, represented as (x1, y1, x2, y2) with floating numbers ranging from 0 to 1. These values correspond to the top left x, top left y, bottom right x, and bottom right y.
2
+
3
+ The task is to use the provided caption and bounding box information, create a plausible question about the image, and provide the answer in detail.
4
+
5
+ Create complex questions beyond describing the scene.
6
+ To answer such questions, one should require first understanding the visual content, then based on the background knowledge or reasoning, either explain why the things are happening that way, or provide guides and help to user's request. Make the question challenging by not including the visual content details in the question so that the user needs to reason about that first.
7
+
8
+ Instead of directly mentioning the bounding box coordinates, utilize this data to explain the scene using natural language. Include details like object counts, position of the objects, relative position between the objects.
9
+
10
+ When using the information from the caption and coordinates, directly explain the scene, and do not mention that the information source is the caption or the bounding box. Always answer as if you are directly looking at the image.
data/prompts/conversation/000_caps.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ There is a movie theater that displays the show times above the doors.
2
+ A red fire hydrant is deep in the snow.
3
+ The fire hydrant is in the snow near a recently plowed sidewalk.
4
+ This city has had a very hard winter with snow.
5
+ A hotel for dogs in the snow in winter.
data/prompts/conversation/000_conv.txt ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Question:
2
+ What color is the fire hydrant in the image?
3
+ ===
4
+ Answer:
5
+ The fire hydrant in the image is red.
6
+ ===
7
+ Question:
8
+ Is the fire hydrant fully covered by snow or partially visible?
9
+ ===
10
+ Answer:
11
+ The fire hydrant is partially visible, with a significant portion of it covered by the deep snow.
12
+ ===
13
+ Question:
14
+ What is the condition of the sidewalk near the fire hydrant?
15
+ ===
16
+ Answer:
17
+ The sidewalk near the fire hydrant has been recently plowed, so it is relatively clear of snow compared to the surrounding area.
18
+ ===
19
+ Question:
20
+ What does the image suggest about the winter season in the city?
21
+ ===
22
+ Answer:
23
+ The image suggests that the winter season in the city has been quite harsh and challenging. The significant snow accumulation seen in the image indicates that the city has experienced heavy snowfall, which can lead to various difficulties and disruptions for its residents.
24
+
25
+ For instance, the deep snow covering the fire hydrant could potentially hinder its accessibility in case of emergencies, which poses safety concerns. The recently plowed sidewalk implies that the city's maintenance crews have been actively working to keep the walkways clear and safe for pedestrians, but the sheer amount of snowfall might make it difficult to keep up with the continuous snow removal efforts.
26
+
27
+ Furthermore, such extreme winter conditions can impact transportation, leading to traffic issues, delays in public transit, and increased risks of accidents due to slippery roads. It can also cause problems for businesses and schools, as people might face challenges commuting to work or attending classes. Additionally, the heavy snow can put extra strain on infrastructure, such as roofs and power lines, increasing the likelihood of structural damage or power outages.
28
+
29
+ In conclusion, the image of the red fire hydrant deep in the snow and the recently plowed sidewalk suggest that the city has faced a particularly severe winter season, with substantial snowfall that has likely caused various challenges and disruptions for its residents and infrastructure.
data/prompts/conversation/001_caps.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ A man is skiing in the open snow covered hills
2
+ A skier is making his way into the snow.
3
+ A skier on the foothills of a huge mountain range.
4
+ A skier looks at mountains while standing near a trail sign.
5
+ a single person skiing by an area with a lot of bushes
data/prompts/conversation/001_conv.txt ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Question:
2
+ What is the skier doing?
3
+ ===
4
+ Answer:
5
+ The skier is skiing in the snow-covered hills, making his way through the snow and enjoying the beautiful mountain scenery. They are also standing near a trail sign, which indicates their location on the mountain.
6
+ ===
7
+ Question:
8
+ Are there any other people or skiers visible in the image?
9
+ ===
10
+ Answer:
11
+ No, there is only a single person skiing in the image, and they are surrounded by an area with a lot of bushes.
12
+ ===
13
+ Question:
14
+ What kind of skiing is the person doing? Cross-country or downhill?
15
+ ===
16
+ Answer:
17
+ Based on what I can see in the photo, it is not possible to definitively determine whether the skier is doing cross-country or downhill skiing. However, given the presence of a trail sign and the fact that they are skiing in the foothills, it is more likely that the skier is engaged in cross-country skiing. Downhill skiing typically takes place on more steep slopes and involves ski lifts, whereas cross-country skiing often occurs on relatively flatter terrain with marked trails.
18
+ ===
19
+ Question:
20
+ Can you explain cross-country and downhill skiing a bit more?
21
+ ===
22
+ Answer:
23
+ Cross-country skiing and downhill skiing are two distinct types of skiing, each with its own techniques, equipment, and terrain preferences.
24
+
25
+ 1. Cross-Country Skiing:
26
+ Also known as Nordic skiing, cross-country skiing involves traversing relatively flat terrain or gentle slopes using skis and poles. It is a popular recreational and competitive sport that focuses on endurance, balance, and aerobic fitness. Cross-country skiers use their own locomotion to move across snow-covered terrain, rather than relying on ski lifts or other forms of assistance.
27
+ There are two main techniques in cross-country skiing:
28
+ - Classic: This technique involves skiing in parallel tracks, using a forward-and-backward gliding motion while keeping the skis parallel to each other. The skier uses their poles to propel themselves forward.
29
+ - Skate skiing: This technique is similar to ice skating, where the skier pushes off one ski at an angle and glides on the other. It requires a smooth, groomed surface and is typically faster than the classic technique.
30
+ Cross-country ski equipment consists of lightweight skis, boots, bindings, and poles. The boots are more flexible than those used in downhill skiing, allowing for better ankle movement and control.
31
+
32
+ 2. Downhill Skiing:
33
+ Also known as alpine skiing, downhill skiing involves descending slopes at high speeds using skis and poles for balance and control. This sport is more focused on speed, technique, and navigating challenging terrain, including steep slopes, moguls, and even jumps.
34
+ Downhill skiing can be further categorized into several disciplines, such as slalom, giant slalom, super-G, and downhill racing. Each discipline has its own set of rules, courses, and ski equipment.
35
+ Downhill ski equipment includes heavier and stiffer skis, boots, bindings, and poles than those used in cross-country skiing. The boots are more rigid to provide better support and control during high-speed descents and sharp turns.
36
+
37
+ In summary, cross-country skiing is an endurance-based sport that involves traveling across flat or gently sloping terrain, while downhill skiing is focused on speed and technique as skiers navigate steeper slopes and challenging terrain. Both sports require specialized equipment and techniques, but they offer different experiences and challenges to participants.
data/prompts/conversation/system_message.txt ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ You are an AI visual assistant, and you are seeing a single image. What you see are provided with five sentences, describing the same image you are looking at. Answer all questions as you are seeing the image.
2
+
3
+ Design a conversation between you and a person asking about this photo. The answers should be in a tone that a visual AI assistant is seeing the image and answering the question.
4
+ Ask diverse questions and give corresponding answers.
5
+
6
+ Include questions asking about the visual content of the image, including the object types, counting the objects, object actions, object locations, relative positions between objects, etc. Only include questions that have definite answers:
7
+ (1) one can see the content in the image that the question asks about and can answer confidently;
8
+ (2) one can determine confidently from the image that it is not in the image.
9
+ Do not ask any question that cannot be answered confidently.
10
+
11
+ Also include complex questions that are relevant to the content in the image, for example, asking about background knowledge of the objects in the image, asking to discuss about events happening in the image, etc. Again, do not ask about uncertain details.
12
+ Provide detailed answers when answering complex questions. For example, give detailed examples or reasoning steps to make the content more convincing and well-organized. You can include multiple paragraphs if necessary.
data/prompts/detail_description/000_caps.txt ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ A harbor filled with lots of boats next to a building.
2
+ A bicycle parked in front of several boats at a dock.
3
+ A red bicycle in front of a line of docked white yachts
4
+ A bike sits before boats which sit before a long building.
5
+ A bicycle is a convenient means of land transportation when you live on a boat.
6
+
7
+ bicycle: [0.287, 0.641, 0.507, 0.874]
8
+ bicycle: [0.566, 0.667, 0.63, 0.731]
9
+ boat: [0.318, 0.579, 0.575, 0.724]
10
+ boat: [0.704, 0.607, 0.818, 0.727]
11
+ boat: [0.818, 0.601, 0.942, 0.744]
12
+ boat: [0.002, 0.53, 0.243, 0.71]
13
+ boat: [0.541, 0.611, 0.668, 0.731]
14
+ person: [0.778, 0.527, 0.797, 0.57]
15
+ cup: [0.708, 0.733, 0.724, 0.758]
16
+ boat: [0.236, 0.532, 0.404, 0.64]
17
+ boat: [0.81, 0.632, 0.836, 0.676]
18
+ boat: [0.957, 0.526, 1.0, 0.752]
data/prompts/detail_description/000_conv.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ It is a harbor filled with numerous boats of various sizes docked next to a long building. Among the boats, there are a few white yachts lined up, standing out from the rest. There is a red bicycle prominently parked in front of the line of docked boats, serving as a convenient means of land transportation for those living on the boats. Another bicycle can be seen further back in the scene, near the middle of the harbor.
2
+
3
+ A person is visible near the right side of the harbor, possibly enjoying the view or attending to their boat. Additionally, there is a cup placed on a surface near the middle of the scene.
data/prompts/detail_description/001_caps.txt ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ A group of people standing outside of a black vehicle with various luggage.
2
+ Luggage surrounds a vehicle in an underground parking area
3
+ People try to fit all of their luggage in an SUV.
4
+ The sport utility vehicle is parked in the public garage, being packed for a trip
5
+ Some people with luggage near a van that is transporting it.
6
+
7
+ person: [0.681, 0.242, 0.774, 0.694]
8
+ person: [0.63, 0.222, 0.686, 0.516]
9
+ person: [0.444, 0.233, 0.487, 0.34]
10
+ backpack: [0.384, 0.696, 0.485, 0.914]
11
+ backpack: [0.755, 0.413, 0.846, 0.692]
12
+ suitcase: [0.758, 0.413, 0.845, 0.69]
13
+ suitcase: [0.1, 0.497, 0.173, 0.579]
14
+ bicycle: [0.282, 0.363, 0.327, 0.442]
15
+ car: [0.786, 0.25, 0.848, 0.322]
16
+ car: [0.783, 0.27, 0.827, 0.335]
17
+ car: [0.86, 0.254, 0.891, 0.3]
18
+ car: [0.261, 0.101, 0.787, 0.626]
data/prompts/detail_description/001_conv.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ The image is an underground parking area with a black sport utility vehicle (SUV) parked. There are three people in the scene, with one person standing closer to the left side of the vehicle, another person in the middle, and the third person on the right side. They are all working together to pack their luggage into the SUV for a trip.
2
+
3
+ In the parking area, various luggage items are scattered around the vehicle. There are two backpacks, one located near the left rear wheel and the other closer to the right side of the vehicle. Additionally, there are two suitcases, one on the right side of the car and another further away near the center of the parking area. A bicycle can also be seen on the left side of the vehicle.
4
+
5
+ Other cars are parked around the main SUV, with one car positioned behind it and slightly to the left, another behind and slightly to the right, and the third car further behind on the right side.
data/prompts/detail_description/002_caps.txt ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ A man holds a Wii-mote above his head while another looks on.
2
+ A guy and his friend are playing Nintendo Wii.
3
+ A young man is holding a video game remote over his head.
4
+ two men standing in a room while one plays with a wii mote
5
+ Some guys standing and playing a video game.
6
+
7
+ couch: [0.697, 0.759, 0.995, 1.0]
8
+ dining table: [0.426, 0.755, 1.0, 0.987]
9
+ person: [0.082, 0.252, 0.342, 1.0]
10
+ person: [0.399, 0.085, 0.742, 0.982]
11
+ remote: [0.477, 0.135, 0.516, 0.187]
12
+ sink: [0.016, 0.501, 0.063, 0.52]
13
+ potted plant: [0.798, 0.384, 0.888, 0.645]
14
+ refrigerator: [0.305, 0.389, 0.414, 0.547]
15
+ chair: [0.72, 0.509, 0.858, 0.725]
data/prompts/detail_description/002_conv.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ The image shows two men standing in a room, engaged in playing a video game on a Nintendo Wii console. One of the men is holding a Wii remote above his head with enthusiasm, while the other man looks on, likely enjoying the friendly competition.
2
+
3
+ The room appears to be a living space with a couch located in the background and a dining table nearby. A potted plant can be seen placed close to the couch, and a chair is situated in the middle of the room. The room also features a kitchen area with a sink and a refrigerator visible in the background.
data/prompts/detail_description/system_message.txt ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ You are an AI visual assistant that can analyze a single image. You receive five sentences, each describing the same image you are observing. In addition, specific object locations within the image are given, along with detailed coordinates. These coordinates are in the form of bounding boxes, represented as (x1, y1, x2, y2) with floating numbers ranging from 0 to 1. These values correspond to the top left x, top left y, bottom right x, and bottom right y.
2
+
3
+ Using the provided caption and bounding box information, describe the scene in a detailed manner.
4
+
5
+ Instead of directly mentioning the bounding box coordinates, utilize this data to explain the scene using natural language. Include details like object counts, position of the objects, relative position between the objects.
6
+
7
+ When using the information from the caption and coordinates, directly explain the scene, and do not mention that the information source is the caption or the bounding box. Always answer as if you are directly looking at the image.
docs/Customize_Component.md ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Customize Components in LLaVA
2
+
3
+ This is an initial guide on how to replace the LLMs, visual encoders, etc. with your choice of components.
4
+
5
+ ## LLM
6
+
7
+ It is quite simple to swap out LLaMA to any other LLMs. You can refer to our implementation of [`llava_llama.py`](https://raw.githubusercontent.com/haotian-liu/LLaVA/main/llava/model/language_model/llava_llama.py) for an example of how to replace the LLM.
8
+
9
+ Although it may seem that it still needs ~100 lines of code, most of them are copied from the original `llama.py` from HF. The only part that is different is to insert some lines for processing the multimodal inputs.
10
+
11
+ In `forward` function, you can see that we call `self.prepare_inputs_labels_for_multimodal` to process the multimodal inputs. This function is defined in `LlavaMetaForCausalLM` and you just need to insert it into the `forward` function of your LLM.
12
+
13
+ In `prepare_inputs_for_generation` function, you can see that we add `images` to the `model_inputs`. This is because we need to pass the images to the LLM during generation.
14
+
15
+ These are basically all the changes you need to make to replace the LLM.
16
+
17
+ ## Visual Encoder
18
+
19
+ You can check out [`clip_encoder.py`](https://github.com/haotian-liu/LLaVA/blob/main/llava/model/multimodal_encoder/clip_encoder.py) on how we implement the CLIP visual encoder.
20
+
docs/Data.md ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## Data
2
+
3
+ | Data file name | Size |
4
+ | --- | ---: |
5
+ | [llava_instruct_150k.json](https://huggingface.co/datasets/liuhaotian/LLaVA-Instruct-150K/blob/main/llava_instruct_150k.json) | 229 MB |
6
+ | [llava_instruct_80k.json](https://huggingface.co/datasets/liuhaotian/LLaVA-Instruct-150K/blob/main/llava_instruct_80k.json) | 229 MB |
7
+ | [conversation_58k.json](https://huggingface.co/datasets/liuhaotian/LLaVA-Instruct-150K/blob/main/conversation_58k.json) | 126 MB |
8
+ | [detail_23k.json](https://huggingface.co/datasets/liuhaotian/LLaVA-Instruct-150K/blob/main/detail_23k.json) | 20.5 MB |
9
+ | [complex_reasoning_77k.json](https://huggingface.co/datasets/liuhaotian/LLaVA-Instruct-150K/blob/main/complex_reasoning_77k.json) | 79.6 MB |
10
+
11
+ ### Pretraining Dataset
12
+ The pretraining dataset used in this release is a subset of CC-3M dataset, filtered with a more balanced concept coverage distribution. Please see [here](https://huggingface.co/datasets/liuhaotian/LLaVA-CC3M-Pretrain-595K) for a detailed description of the dataset structure and how to download the images.
13
+
14
+ If you already have CC-3M dataset on your disk, the image names follow this format: `GCC_train_000000000.jpg`. You may edit the `image` field correspondingly if necessary.
15
+
16
+ | Data | Chat File | Meta Data | Size |
17
+ | --- | --- | --- | ---: |
18
+ | CC-3M Concept-balanced 595K | [chat.json](https://huggingface.co/datasets/liuhaotian/LLaVA-CC3M-Pretrain-595K/blob/main/chat.json) | [metadata.json](https://huggingface.co/datasets/liuhaotian/LLaVA-CC3M-Pretrain-595K/blob/main/metadata.json) | 211 MB
19
+ | LAION/CC/SBU BLIP-Caption Concept-balanced 558K | [blip_laion_cc_sbu_558k.json](https://huggingface.co/datasets/liuhaotian/LLaVA-Pretrain/blob/main/blip_laion_cc_sbu_558k.json) | [metadata.json](#) | 181 MB
20
+
21
+ **Important notice**: Upon the request from the community, as ~15% images of the original CC-3M dataset are no longer accessible, we upload [`images.zip`](https://huggingface.co/datasets/liuhaotian/LLaVA-CC3M-Pretrain-595K/blob/main/images.zip) for better reproducing our work in research community. It must not be used for any other purposes. The use of these images must comply with the CC-3M license. This may be taken down at any time when requested by the original CC-3M dataset owner or owners of the referenced images.
22
+
23
+ ### GPT-4 Prompts
24
+
25
+ We provide our prompts and few-shot samples for GPT-4 queries, to better facilitate research in this domain. Please check out the [`prompts`](playground/data/prompts) folder for three kinds of questions: conversation, detail description, and complex reasoning.
26
+
27
+ They are organized in a format of `system_message.txt` for system message, pairs of `abc_caps.txt` for few-shot sample user input, and `abc_conv.txt` for few-shot sample reference output.
28
+
29
+ Note that you may find them in different format. For example, `conversation` is in `jsonl`, and detail description is answer-only. The selected format in our preliminary experiments works slightly better than a limited set of alternatives that we tried: `jsonl`, more natural format, answer-only. If interested, you may try other variants or conduct more careful study in this. Contributions are welcomed!
docs/LLaVA_Bench.md ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LLaVA-Bench [[Download](https://huggingface.co/datasets/liuhaotian/llava-bench-in-the-wild)]
2
+
3
+ **-Introduction-** Large commercial multimodal chatbots have been released in this week, including
4
+ - [Multimodal Bing-Chat by Microsoft](https://blogs.bing.com/search/july-2023/Bing-Chat-Enterprise-announced,-multimodal-Visual-Search-rolling-out-to-Bing-Chat) (July 18, 2023)
5
+ - [Multimodal Bard by Google](https://bard.google.com/).
6
+
7
+ These chatbots are presumably supported by proprietary large multimodal models (LMM). Compared with the open-source LMM such as LLaVA, proprietary LMM represent the scaling success upperbound of the current SoTA techniques. They share the goal of developing multimodal chatbots that follow human intents to complete various daily-life visual tasks in the wild. While it remains less unexplored how to evaluate multimodal chat ability, it provides useful feedback to study open-source LMMs against the commercial multimodal chatbots. In addition to the *LLaVA-Bench (COCO)* dataset we used to develop the early versions of LLaVA, we are releasing [*LLaVA-Bench (In-the-Wild)*](https://huggingface.co/datasets/liuhaotian/llava-bench-in-the-wild) to the community for the public use.
8
+
9
+ ## LLaVA-Bench (In-the-Wild *[Ongoing work]*)
10
+
11
+ To evaluate the model's capability in more challenging tasks and generalizability to novel domains, we collect a diverse set of 24 images with 60 questions in total, including indoor and outdoor scenes, memes, paintings, sketches, etc, and associate each image with a highly-detailed and manually-curated description and a proper selection of questions. Such design also assesses the model's robustness to different prompts. In this release, we also categorize questions into three categories: conversation (simple QA), detailed description, and complex reasoning. We continue to expand and improve the diversity of the LLaVA-Bench (In-the-Wild). We manually query Bing-Chat and Bard to get the responses.
12
+
13
+ ### Results
14
+
15
+ The score is measured by comparing against a reference answer generated by text-only GPT-4. It is generated by feeding the question, along with the ground truth image annotations as the context. A text-only GPT-4 evaluator rates both answers. We query GPT-4 by putting the reference answer first, and then the answer generated by the candidate model. We upload images at their original resolution to Bard and Bing-Chat to obtain the results.
16
+
17
+ | Approach | Conversation | Detail | Reasoning | Overall |
18
+ |----------------|--------------|--------|-----------|---------|
19
+ | Bard-0718 | 83.7 | 69.7 | 78.7 | 77.8 |
20
+ | Bing-Chat-0629 | 59.6 | 52.2 | 90.1 | 71.5 |
21
+ | LLaVA-13B-v1-336px-0719 (beam=1) | 64.3 | 55.9 | 81.7 | 70.1 |
22
+ | LLaVA-13B-v1-336px-0719 (beam=5) | 68.4 | 59.9 | 84.3 | 73.5 |
23
+
24
+ Note that Bard sometimes refuses to answer questions about images containing humans, and Bing-Chat blurs the human faces in the images. We also provide the benchmark score for the subset without humans.
25
+
26
+ | Approach | Conversation | Detail | Reasoning | Overall |
27
+ |----------------|--------------|--------|-----------|---------|
28
+ | Bard-0718 | 94.9 | 74.3 | 84.3 | 84.6 |
29
+ | Bing-Chat-0629 | 55.8 | 53.6 | 93.5 | 72.6 |
30
+ | LLaVA-13B-v1-336px-0719 (beam=1) | 62.2 | 56.4 | 82.2 | 70.0 |
31
+ | LLaVA-13B-v1-336px-0719 (beam=5) | 65.6 | 61.7 | 85.0 | 73.6 |
docs/LLaVA_from_LLaMA2.md ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LLaVA (based on Llama 2 LLM, Preview)
2
+
3
+ *NOTE: This is a technical preview. We are still running hyperparameter search, and will release the final model soon. If you'd like to contribute to this, please contact us.*
4
+
5
+ :llama: **-Introduction-** [Llama 2 is an open-source LLM released by Meta AI](https://about.fb.com/news/2023/07/llama-2/) today (July 18, 2023). Compared with its early version [Llama 1](https://ai.meta.com/blog/large-language-model-llama-meta-ai/), Llama 2 is more favored in ***stronger language performance***, ***longer context window***, and importantly ***commercially usable***! While Llama 2 is changing the LLM market landscape in the language space, its multimodal ability remains unknown. We quickly develop the LLaVA variant based on the latest Llama 2 checkpoints, and release it to the community for the public use.
6
+
7
+ You need to apply for and download the lastest Llama 2 checkpoints to start your own training (apply [here](https://ai.meta.com/resources/models-and-libraries/llama-downloads/))
8
+
9
+
10
+ ## Training
11
+
12
+ Please checkout [`pretrain.sh`](https://github.com/haotian-liu/LLaVA/blob/main/scripts/pretrain.sh), [`finetune.sh`](https://github.com/haotian-liu/LLaVA/blob/main/scripts/finetune.sh), [`finetune_lora.sh`](https://github.com/haotian-liu/LLaVA/blob/main/scripts/finetune_lora.sh).
13
+
14
+ ## LLaVA (based on Llama 2), What is different?
15
+
16
+ :volcano: How is the new LLaVA based on Llama 2 different from Llama 1? The comparisons of the training process are described:
17
+ - **Pre-training**. The pre-trained base LLM is changed from Llama 1 to Llama 2
18
+ - **Language instruction-tuning**. The previous LLaVA model starts with Vicuna, which is instruct tuned on ShareGPT data from Llama 1; The new LLaVA model starts with Llama 2 Chat, which is an instruct tuned checkpoint on dialogue data from Llama 2.
19
+ - **Multimodal instruction-tuning**. The same LLaVA-Lighting process is applied.
20
+
21
+
22
+ ### Results
23
+
24
+ - Llama 2 is better at following the instructions of role playing; Llama 2 fails in following the instructions of translation
25
+ - The quantitative evaluation on [LLaVA-Bench](https://github.com/haotian-liu/LLaVA/blob/main/docs/LLaVA_Bench.md) demonstrates on-par performance between Llama 2 and Llama 1 in LLaVA's multimodal chat ability.
26
+
27
+
28
+ <img src="../images/llava_example_cmp.png" width="100%">
29
+
docs/LoRA.md ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LLaVA (LoRA, Preview)
2
+
3
+ NOTE: This is a technical preview, and is not yet ready for production use. We are still running hyperparameter search for the LoRA model, and will release the final model soon. If you'd like to contribute to this, please contact us.
4
+
5
+ You need latest code base for LoRA support (instructions [here](https://github.com/haotian-liu/LLaVA#upgrade-to-latest-code-base))
6
+
7
+ ## Demo (Web UI)
8
+
9
+ Please execute each of the command below one by one (after the previous one has finished). The commands are the same as launching other demos except for an additional `--model-base` flag to specify the base model to use. Please make sure the base model corresponds to the LoRA checkpoint that you are using. For this technical preview, you need Vicuna v1.1 (7B) checkpoint (if you do not have that already, follow the instructions [here](https://github.com/lm-sys/FastChat#vicuna-weights)).
10
+
11
+ #### Launch a controller
12
+ ```Shell
13
+ python -m llava.serve.controller --host 0.0.0.0 --port 10000
14
+ ```
15
+
16
+ #### Launch a gradio web server.
17
+ ```Shell
18
+ python -m llava.serve.gradio_web_server --controller http://localhost:10000 --model-list-mode reload
19
+ ```
20
+ You just launched the Gradio web interface. Now, you can open the web interface with the URL printed on the screen. You may notice that there is no model in the model list. Do not worry, as we have not launched any model worker yet. It will be automatically updated when you launch a model worker.
21
+
22
+ #### Launch a model worker
23
+ ```Shell
24
+ python -m llava.serve.model_worker --host 0.0.0.0 --controller http://localhost:10000 --port 40000 --worker http://localhost:40000 --model-path liuhaotian/llava-vicuna-7b-v1.1-lcs_558k-instruct_80k_3e-lora-preview-alpha --model-base /path/to/vicuna-v1.1
25
+ ```
26
+ Wait until the process finishes loading the model and you see "Uvicorn running on ...". Now, refresh your Gradio web UI, and you will see the model you just launched in the model list.
27
+
28
+ You can launch as many workers as you want, and compare between different model checkpoints in the same Gradio interface. Please keep the `--controller` the same, and modify the `--port` and `--worker` to a different port number for each worker.
29
+
30
+
31
+ ## Training
32
+
33
+ Please see sample training scripts for [LoRA](https://github.com/haotian-liu/LLaVA/blob/main/scripts/finetune_lora.sh) and [QLoRA](https://github.com/haotian-liu/LLaVA/blob/main/scripts/finetune_qlora.sh).
34
+
35
+ We provide sample DeepSpeed configs, [`zero3.json`](https://github.com/haotian-liu/LLaVA/blob/main/scripts/zero3.json) is more like PyTorch FSDP, and [`zero3_offload.json`](https://github.com/haotian-liu/LLaVA/blob/main/scripts/zero3_offload.json) can further save memory consumption by offloading parameters to CPU. `zero3.json` is usually faster than `zero3_offload.json` but requires more GPU memory, therefore, we recommend trying `zero3.json` first, and if you run out of GPU memory, try `zero3_offload.json`. You can also tweak the `per_device_train_batch_size` and `gradient_accumulation_steps` in the config to save memory, and just to make sure that `per_device_train_batch_size` and `gradient_accumulation_steps` remains the same.
36
+
37
+ If you are having issues with ZeRO-3 configs, and there are enough VRAM, you may try [`zero2.json`](https://github.com/haotian-liu/LLaVA/blob/main/scripts/zero2.json). This consumes slightly more memory than ZeRO-3, and behaves more similar to PyTorch FSDP, while still supporting parameter-efficient tuning.
38
+
39
+ ## Create Merged Checkpoints
40
+
41
+ ```Shell
42
+ python scripts/merge_lora_weights.py \
43
+ --model-path /path/to/lora_model \
44
+ --model-base /path/to/base_model \
45
+ --save-model-path /path/to/merge_model
46
+ ```
docs/MODEL_ZOO.md ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Model Zoo
2
+
3
+ **To Use LLaVA-1.5 checkpoints, your llava package version must be newer than 1.1.0. [Instructions](https://github.com/haotian-liu/LLaVA#upgrade-to-latest-code-base) on how to upgrade.**
4
+
5
+ If you are interested in including any other details in Model Zoo, please open an issue :)
6
+
7
+ The model weights below are *merged* weights. You do not need to apply delta. The usage of LLaVA checkpoints should comply with the base LLM's model license: [LLaMA](https://github.com/facebookresearch/llama/blob/main/MODEL_CARD.md).
8
+
9
+ ## LLaVA-v1.5
10
+
11
+ | Version | Size | Schedule | Checkpoint | VQAv2 | GQA | VizWiz | SQA | T-VQA | POPE | MME | MM-Bench | MM-Bench-CN | SEED | LLaVA-Bench-Wild | MM-Vet |
12
+ |----------|----------|-----------|-----------|---|---|---|---|---|---|---|---|---|---|---|---|
13
+ | LLaVA-1.5 | 7B | full_ft-1e | [liuhaotian/llava-v1.5-7b](https://huggingface.co/liuhaotian/llava-v1.5-7b) | 78.5 | 62.0 | 50.0 | 66.8 | 58.2 | 85.9 | 1510.7 | 64.3 | 58.3 | 58.6 | 63.4 | 30.5 |
14
+ | LLaVA-1.5 | 13B | full_ft-1e | [liuhaotian/llava-v1.5-13b](https://huggingface.co/liuhaotian/llava-v1.5-13b) | 80.0 | 63.3 | 53.6 | 71.6 | 61.3 | 85.9 | 1531.3 | 67.7 | 63.6 | 61.6 | 70.7 | 35.4 |
15
+ | LLaVA-1.5 | 7B | lora-1e | coming soon |
16
+ | LLaVA-1.5 | 13B | lora-1e | coming soon |
17
+
18
+ <p align="center">
19
+ <img src="../images/llava_v1_5_radar.jpg" width="500px"> <br>
20
+ LLaVA-1.5 achieves SoTA performance across 11 benchmarks.
21
+ </p>
22
+
23
+
24
+ ## LLaVA-v1
25
+
26
+ *Note: We recommend using the most capable LLaVA-v1.5 series above for the best performance.*
27
+
28
+ | Base LLM | Vision Encoder | Pretrain Data | Pretraining schedule | Finetuning Data | Finetuning schedule | LLaVA-Bench-Conv | LLaVA-Bench-Detail | LLaVA-Bench-Complex | LLaVA-Bench-Overall | Download |
29
+ |----------|----------------|---------------|----------------------|-----------------|--------------------|------------------|--------------------|---------------------|---------------------|---------------------|
30
+ | Vicuna-13B-v1.3 | CLIP-L-336px | LCS-558K | 1e | LLaVA-Instruct-80K | proj-1e, lora-1e | 64.3 | 55.9 | 81.7 | 70.1 | [LoRA](https://huggingface.co/liuhaotian/llava-v1-0719-336px-lora-vicuna-13b-v1.3) [LoRA-Merged](https://huggingface.co/liuhaotian/llava-v1-0719-336px-lora-merge-vicuna-13b-v1.3) |
31
+ | LLaMA-2-13B-Chat | CLIP-L | LCS-558K | 1e | LLaVA-Instruct-80K | full_ft-1e | 56.7 | 58.6 | 80.0 | 67.9 | [ckpt](https://huggingface.co/liuhaotian/llava-llama-2-13b-chat-lightning-preview) |
32
+ | LLaMA-2-7B-Chat | CLIP-L | LCS-558K | 1e | LLaVA-Instruct-80K | lora-1e | 51.2 | 58.9 | 71.6 | 62.8 | [LoRA](https://huggingface.co/liuhaotian/llava-llama-2-7b-chat-lightning-lora-preview) |
33
+
34
+
35
+ ## Projector weights
36
+
37
+ The model weights below are projector weights we have pretrained. You can use these projector weights for visual instruction tuning. We'll add more projector weights into model zoo very soon.
38
+
39
+ **NOTE**: These projector weights are only compatible with the `llava>=1.0.0`, please check out the latest code base if your local code version is below `v1.0.0`.
40
+
41
+ **NOTE**: When you use our pretrained projector for visual instruction tuning, it is very important to **use the same base LLM and vision encoder** as the one we used for pretraining the projector. Otherwise, the performance will be very bad.
42
+
43
+ When using these projector weights to instruction tune your LMM, please make sure that these options are correctly set as follows,
44
+
45
+ ```Shell
46
+ --mm_use_im_start_end False
47
+ --mm_use_im_patch_token False
48
+ ```
49
+
50
+ | Base LLM | Vision Encoder | Projection | Pretrain Data | Pretraining schedule | Download |
51
+ |----------|----------------|---------------|----------------------|----------|----------|
52
+ | Vicuna-13B-v1.5 | CLIP-L-336px | MLP-2x | LCS-558K | 1e | [projector](https://huggingface.co/liuhaotian/llava-v1.5-mlp2x-336px-pretrain-vicuna-13b-v1.5) |
53
+ | Vicuna-7B-v1.5 | CLIP-L-336px | MLP-2x | LCS-558K | 1e | [projector](https://huggingface.co/liuhaotian/llava-v1.5-mlp2x-336px-pretrain-vicuna-7b-v1.5) |
54
+ | LLaMA-2-13B-Chat | CLIP-L-336px | Linear | LCS-558K | 1e | [projector](https://huggingface.co/liuhaotian/llava-336px-pretrain-llama-2-13b-chat) |
55
+ | LLaMA-2-7B-Chat | CLIP-L-336px | Linear | LCS-558K | 1e | [projector](https://huggingface.co/liuhaotian/llava-336px-pretrain-llama-2-7b-chat) |
56
+ | LLaMA-2-13B-Chat | CLIP-L | Linear | LCS-558K | 1e | [projector](https://huggingface.co/liuhaotian/llava-pretrain-llama-2-13b-chat) |
57
+ | LLaMA-2-7B-Chat | CLIP-L | Linear | LCS-558K | 1e | [projector](https://huggingface.co/liuhaotian/llava-pretrain-llama-2-7b-chat) |
58
+ | Vicuna-13B-v1.3 | CLIP-L-336px | Linear | LCS-558K | 1e | [projector](https://huggingface.co/liuhaotian/llava-336px-pretrain-vicuna-13b-v1.3) |
59
+ | Vicuna-7B-v1.3 | CLIP-L-336px | Linear | LCS-558K | 1e | [projector](https://huggingface.co/liuhaotian/llava-336px-pretrain-vicuna-7b-v1.3) |
60
+ | Vicuna-13B-v1.3 | CLIP-L | Linear | LCS-558K | 1e | [projector](https://huggingface.co/liuhaotian/llava-pretrain-vicuna-13b-v1.3) |
61
+ | Vicuna-7B-v1.3 | CLIP-L | Linear | LCS-558K | 1e | [projector](https://huggingface.co/liuhaotian/llava-pretrain-vicuna-7b-v1.3) |
62
+
63
+
64
+ ## Science QA Checkpoints
65
+
66
+ | Base LLM | Vision Encoder | Pretrain Data | Pretraining schedule | Finetuning Data | Finetuning schedule | Download |
67
+ |----------|----------------|---------------|----------------------|-----------------|--------------------|---------------------|
68
+ | Vicuna-13B-v1.3 | CLIP-L | LCS-558K | 1e | ScienceQA | full_ft-12e | [ckpt](https://huggingface.co/liuhaotian/llava-lcs558k-scienceqa-vicuna-13b-v1.3) |
69
+
70
+
71
+ ## Legacy Models (merged weights)
72
+
73
+ The model weights below are *merged* weights. You do not need to apply delta. The usage of LLaVA checkpoints should comply with the base LLM's model license.
74
+
75
+ | Base LLM | Vision Encoder | Pretrain Data | Pretraining schedule | Finetuning Data | Finetuning schedule | Download |
76
+ |----------|----------------|---------------|----------------------|-----------------|--------------------|------------------|
77
+ | MPT-7B-Chat | CLIP-L | LCS-558K | 1e | LLaVA-Instruct-80K | full_ft-1e | [preview](https://huggingface.co/liuhaotian/LLaVA-Lightning-MPT-7B-preview) |
78
+
79
+
80
+ ## Legacy Models (delta weights)
81
+
82
+ The model weights below are *delta* weights. The usage of LLaVA checkpoints should comply with the base LLM's model license: [LLaMA](https://github.com/facebookresearch/llama/blob/main/MODEL_CARD.md).
83
+
84
+ You can add our delta to the original LLaMA weights to obtain the LLaVA weights.
85
+
86
+ Instructions:
87
+
88
+ 1. Get the original LLaMA weights in the huggingface format by following the instructions [here](https://huggingface.co/docs/transformers/main/model_doc/llama).
89
+ 2. Use the following scripts to get LLaVA weights by applying our delta. It will automatically download delta weights from our Hugging Face account. In the script below, we use the delta weights of [`liuhaotian/LLaVA-7b-delta-v0`](https://huggingface.co/liuhaotian/LLaVA-7b-delta-v0) as an example. It can be adapted for other delta weights by changing the `--delta` argument (and base/target accordingly).
90
+
91
+ ```bash
92
+ python3 -m llava.model.apply_delta \
93
+ --base /path/to/llama-7b \
94
+ --target /output/path/to/LLaVA-7B-v0 \
95
+ --delta liuhaotian/LLaVA-7b-delta-v0
96
+ ```
97
+
98
+ | Base LLM | Vision Encoder | Pretrain Data | Pretraining schedule | Finetuning Data | Finetuning schedule | Download |
99
+ |----------|----------------|---------------|----------------------|-----------------|--------------------|------------------|
100
+ | Vicuna-13B-v1.1 | CLIP-L | CC-595K | 1e | LLaVA-Instruct-158K | full_ft-3e | [delta-weights](https://huggingface.co/liuhaotian/LLaVA-13b-delta-v1-1) |
101
+ | Vicuna-7B-v1.1 | CLIP-L | LCS-558K | 1e | LLaVA-Instruct-80K | full_ft-1e | [delta-weights](https://huggingface.co/liuhaotian/LLaVA-Lightning-7B-delta-v1-1) |
102
+ | Vicuna-13B-v0 | CLIP-L | CC-595K | 1e | LLaVA-Instruct-158K | full_ft-3e | [delta-weights](https://huggingface.co/liuhaotian/LLaVA-13b-delta-v0) |
103
+ | Vicuna-13B-v0 | CLIP-L | CC-595K | 1e | ScienceQA | full_ft-12e | [delta-weights](https://huggingface.co/liuhaotian/LLaVA-13b-delta-v0-science_qa) |
104
+ | Vicuna-7B-v0 | CLIP-L | CC-595K | 1e | LLaVA-Instruct-158K | full_ft-3e | [delta-weights](https://huggingface.co/liuhaotian/LLaVA-7b-delta-v0) |
105
+
106
+
107
+
108
+ ## Legacy Projector weights
109
+
110
+ The following projector weights are deprecated, and the support for them may be removed in the future. They do not support zero-shot inference. Please use the projector weights in the [table above](#projector-weights) if possible.
111
+
112
+ **NOTE**: When you use our pretrained projector for visual instruction tuning, it is very important to **use the same base LLM and vision encoder** as the one we used for pretraining the projector. Otherwise, the performance will be very bad.
113
+
114
+ When using these projector weights to instruction tune your LMM, please make sure that these options are correctly set as follows,
115
+
116
+ ```Shell
117
+ --mm_use_im_start_end True
118
+ --mm_use_im_patch_token False
119
+ ```
120
+
121
+ | Base LLM | Vision Encoder | Pretrain Data | Pretraining schedule | Download |
122
+ |----------|----------------|---------------|----------------------|----------|
123
+ | Vicuna-7B-v1.1 | CLIP-L | LCS-558K | 1e | [projector](https://huggingface.co/liuhaotian/LLaVA-Pretrained-Projectors/blob/main/LLaVA-7b-pretrain-projector-v1-1-LCS-558K-blip_caption.bin) |
124
+ | Vicuna-13B-v0 | CLIP-L | CC-595K | 1e | [projector](https://huggingface.co/liuhaotian/LLaVA-Pretrained-Projectors/blob/main/LLaVA-13b-pretrain-projector-v0-CC3M-595K-original_caption.bin) |
125
+ | Vicuna-7B-v0 | CLIP-L | CC-595K | 1e | [projector](https://huggingface.co/liuhaotian/LLaVA-Pretrained-Projectors/blob/main/LLaVA-7b-pretrain-projector-v0-CC3M-595K-original_caption.bin) |
126
+
127
+ When using these projector weights to instruction tune your LMM, please make sure that these options are correctly set as follows,
128
+
129
+ ```Shell
130
+ --mm_use_im_start_end False
131
+ --mm_use_im_patch_token False
132
+ ```
133
+
134
+ | Base LLM | Vision Encoder | Pretrain Data | Pretraining schedule | Download |
135
+ |----------|----------------|---------------|----------------------|----------|
136
+ | Vicuna-13B-v0 | CLIP-L | CC-595K | 1e | [projector](https://huggingface.co/liuhaotian/LLaVA-Pretrained-Projectors/blob/main/LLaVA-13b-pretrain-projector-v0-CC3M-595K-original_caption-no_im_token.bin) |
docs/ScienceQA.md ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### ScienceQA
2
+
3
+ #### Prepare Data
4
+ 1. Please see ScienceQA [repo](https://github.com/lupantech/ScienceQA) for setting up the dataset.
5
+ 2. Generate ScienceQA dataset for LLaVA conversation-style format.
6
+
7
+ ```Shell
8
+ python scripts/convert_sqa_to_llava.py \
9
+ convert_to_llava \
10
+ --base-dir /path/to/ScienceQA/data/scienceqa \
11
+ --prompt-format "QCM-LEA" \
12
+ --split {train,val,minival,test,minitest}
13
+ ```
14
+
15
+ #### Training
16
+
17
+ 1. Pretraining
18
+
19
+ You can download our pretrained projector weights from our [Model Zoo](), or train your own projector weights using [`pretrain.sh`](https://github.com/haotian-liu/LLaVA/blob/main/scripts/pretrain.sh).
20
+
21
+ 2. Finetuning
22
+
23
+ See [`finetune_sqa.sh`](https://github.com/haotian-liu/LLaVA/blob/main/scripts/finetune_sqa.sh).
24
+
25
+ #### Evaluation
26
+
27
+ 1. Multiple-GPU inference
28
+ You may evaluate this with multiple GPUs, and concatenate the generated jsonl files. Please refer to our script for [batch evaluation](https://github.com/haotian-liu/LLaVA/blob/main/scripts/sqa_eval_batch.sh) and [results gathering](https://github.com/haotian-liu/LLaVA/blob/main/scripts/sqa_eval_gather.sh).
29
+
30
+ 2. Single-GPU inference
31
+
32
+ (a) Generate LLaVA responses on ScienceQA dataset
33
+
34
+ ```Shell
35
+ python -m llava.eval.model_vqa_science \
36
+ --model-path liuhaotian/llava-lcs558k-scienceqa-vicuna-13b-v1.3 \
37
+ --question-file /path/to/ScienceQA/data/scienceqa/llava_test_QCM-LEA.json \
38
+ --image-folder /path/to/ScienceQA/data/scienceqa/images/test \
39
+ --answers-file vqa/results/ScienceQA/test_llava-13b.jsonl \
40
+ --conv-mode llava_v1
41
+ ```
42
+
43
+ (b) Evaluate the generated responses
44
+
45
+ ```Shell
46
+ python eval_science_qa.py \
47
+ --base-dir /path/to/ScienceQA/data/scienceqa \
48
+ --result-file vqa/results/ScienceQA/test_llava-13b.jsonl \
49
+ --output-file vqa/results/ScienceQA/test_llava-13b_output.json \
50
+ --output-result vqa/results/ScienceQA/test_llava-13b_result.json \
51
+ ```
52
+
53
+ For reference, we attach our prediction file [`test_sqa_llava_lcs_558k_sqa_12e_vicuna_v1_3_13b.json`](https://github.com/haotian-liu/LLaVA/blob/main/llava/eval/table/results/test_sqa_llava_lcs_558k_sqa_12e_vicuna_v1_3_13b.json) and [`test_sqa_llava_13b_v0.json`](https://github.com/haotian-liu/LLaVA/blob/main/llava/eval/table/results/test_sqa_llava_13b_v0.json) for comparison when reproducing our results, as well as for further analysis in detail.
gradio_web_server.log ADDED
The diff for this file is too large to render. See raw diff
 
llava/__init__.py ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ from .model import LlavaLlamaForCausalLM
2
+ # from .model.language_model.llava_llama import LlavaLlamaForCausalLM
llava/__pycache__/__init__.cpython-311.pyc ADDED
Binary file (243 Bytes). View file
 
llava/__pycache__/constants.cpython-311.pyc ADDED
Binary file (575 Bytes). View file
 
llava/__pycache__/conversation.cpython-311.pyc ADDED
Binary file (17.5 kB). View file
 
llava/__pycache__/mm_utils.cpython-311.pyc ADDED
Binary file (19.3 kB). View file
 
llava/__pycache__/utils.cpython-311.pyc ADDED
Binary file (6.96 kB). View file
 
llava/constants.py ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ CONTROLLER_HEART_BEAT_EXPIRATION = 30
2
+ WORKER_HEART_BEAT_INTERVAL = 15
3
+
4
+ LOGDIR = "."
5
+
6
+ # Model Constants
7
+ IGNORE_INDEX = -100
8
+ IMAGE_TOKEN_INDEX = -200
9
+ DEFAULT_IMAGE_TOKEN = "<image>"
10
+ DEFAULT_IMAGE_PATCH_TOKEN = "<im_patch>"
11
+ DEFAULT_IM_START_TOKEN = "<im_start>"
12
+ DEFAULT_IM_END_TOKEN = "<im_end>"
13
+ IMAGE_PLACEHOLDER = "<image-placeholder>"
llava/conversation.py ADDED
@@ -0,0 +1,418 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import dataclasses
2
+ from enum import auto, Enum
3
+ from typing import List, Tuple
4
+ import base64
5
+ from io import BytesIO
6
+ from PIL import Image
7
+
8
+
9
+ class SeparatorStyle(Enum):
10
+ """Different separator style."""
11
+ SINGLE = auto()
12
+ TWO = auto()
13
+ MPT = auto()
14
+ PLAIN = auto()
15
+ LLAMA_2 = auto()
16
+
17
+
18
+ @dataclasses.dataclass
19
+ class Conversation:
20
+ """A class that keeps all conversation history."""
21
+ system: str
22
+ roles: List[str]
23
+ messages: List[List[str]]
24
+ offset: int
25
+ sep_style: SeparatorStyle = SeparatorStyle.SINGLE
26
+ sep: str = "###"
27
+ sep2: str = None
28
+ version: str = "Unknown"
29
+
30
+ skip_next: bool = False
31
+
32
+ def get_prompt(self):
33
+ messages = [self.messages[0],self.messages[-1]]
34
+ if len(messages) > 0 and type(messages[0][1]) is tuple:
35
+ messages = self.messages.copy()
36
+ init_role, init_msg = messages[0].copy()
37
+ init_msg = init_msg[0].replace("<image>", "").strip()
38
+ if 'mmtag' in self.version:
39
+ messages[0] = (init_role, init_msg)
40
+ messages.insert(0, (self.roles[0], "<Image><image></Image>"))
41
+ messages.insert(1, (self.roles[1], "Received."))
42
+ else:
43
+ messages[0] = (init_role, "<image>\n" + init_msg)
44
+
45
+ if self.sep_style == SeparatorStyle.SINGLE:
46
+ ret = self.system + self.sep
47
+ for role, message in messages:
48
+ if message:
49
+ if type(message) is tuple:
50
+ message, _, _ = message
51
+ ret += role + ": " + message + self.sep
52
+ else:
53
+ ret += role + ":"
54
+ elif self.sep_style == SeparatorStyle.TWO:
55
+ seps = [self.sep, self.sep2]
56
+ ret = self.system + seps[0]
57
+ for i, (role, message) in enumerate(messages):
58
+ if message:
59
+ if type(message) is tuple:
60
+ message, _, _ = message
61
+ ret += role + ": " + message + seps[i % 2]
62
+ else:
63
+ ret += role + ":"
64
+ elif self.sep_style == SeparatorStyle.MPT:
65
+ ret = self.system + self.sep
66
+ for role, message in messages:
67
+ if message:
68
+ if type(message) is tuple:
69
+ message, _, _ = message
70
+ ret += role + message + self.sep
71
+ else:
72
+ ret += role
73
+ elif self.sep_style == SeparatorStyle.LLAMA_2:
74
+ wrap_sys = lambda msg: f"<<SYS>>\n{msg}\n<</SYS>>\n\n" if len(msg) > 0 else msg
75
+ wrap_inst = lambda msg: f"[INST] {msg} [/INST]"
76
+ ret = ""
77
+
78
+ for i, (role, message) in enumerate(messages):
79
+ if i == 0:
80
+ assert message, "first message should not be none"
81
+ assert role == self.roles[0], "first message should come from user"
82
+ if message:
83
+ if type(message) is tuple:
84
+ message, _, _ = message
85
+ if i == 0: message = wrap_sys(self.system) + message
86
+ if i % 2 == 0:
87
+ message = wrap_inst(message)
88
+ ret += self.sep + message
89
+ else:
90
+ ret += " " + message + " " + self.sep2
91
+ else:
92
+ ret += ""
93
+ ret = ret.lstrip(self.sep)
94
+ elif self.sep_style == SeparatorStyle.PLAIN:
95
+ seps = [self.sep, self.sep2]
96
+ ret = self.system
97
+ for i, (role, message) in enumerate(messages):
98
+ if message:
99
+ if type(message) is tuple:
100
+ message, _, _ = message
101
+ ret += message + seps[i % 2]
102
+ else:
103
+ ret += ""
104
+ else:
105
+ raise ValueError(f"Invalid style: {self.sep_style}")
106
+
107
+ return ret
108
+
109
+ def append_message(self, role, message):
110
+ self.messages.append([role, message])
111
+
112
+ def pop_message(self, role, message):
113
+ self.messages.pop()
114
+
115
+ def process_image(self, image, image_process_mode, return_pil=False, image_format='PNG', max_len=1344, min_len=672):
116
+ if image_process_mode == "Pad":
117
+ def expand2square(pil_img, background_color=(122, 116, 104)):
118
+ width, height = pil_img.size
119
+ if width == height:
120
+ return pil_img
121
+ elif width > height:
122
+ result = Image.new(pil_img.mode, (width, width), background_color)
123
+ result.paste(pil_img, (0, (width - height) // 2))
124
+ return result
125
+ else:
126
+ result = Image.new(pil_img.mode, (height, height), background_color)
127
+ result.paste(pil_img, ((height - width) // 2, 0))
128
+ return result
129
+ image = expand2square(image)
130
+ elif image_process_mode in ["Default", "Crop"]:
131
+ pass
132
+ elif image_process_mode == "Resize":
133
+ image = image.resize((336, 336))
134
+ else:
135
+ raise ValueError(f"Invalid image_process_mode: {image_process_mode}")
136
+ if max(image.size) > max_len:
137
+ max_hw, min_hw = max(image.size), min(image.size)
138
+ aspect_ratio = max_hw / min_hw
139
+ shortest_edge = int(min(max_len / aspect_ratio, min_len, min_hw))
140
+ longest_edge = int(shortest_edge * aspect_ratio)
141
+ W, H = image.size
142
+ if H > W:
143
+ H, W = longest_edge, shortest_edge
144
+ else:
145
+ H, W = shortest_edge, longest_edge
146
+ image = image.resize((W, H))
147
+ if return_pil:
148
+ return image
149
+ else:
150
+ buffered = BytesIO()
151
+ image.save(buffered, format=image_format)
152
+ img_b64_str = base64.b64encode(buffered.getvalue()).decode()
153
+ return img_b64_str
154
+
155
+ def get_images(self, return_pil=False):
156
+ images = []
157
+ for i, (role, msg) in enumerate(self.messages[self.offset:]):
158
+ if i % 2 == 0:
159
+ if type(msg) is tuple:
160
+ msg, image, image_process_mode = msg
161
+ image = self.process_image(image, image_process_mode, return_pil=return_pil)
162
+ images.append(image)
163
+ return images
164
+
165
+ def to_gradio_chatbot(self,extra_image=None):
166
+ ret = []
167
+ for i, (role, msg) in enumerate(reversed(self.messages[self.offset:])):
168
+ if role==self.roles[0]:
169
+ pass
170
+ # if type(msg) is tuple:
171
+ # msg, image, image_process_mode = msg
172
+ # img_b64_str = self.process_image(
173
+ # image, "Default", return_pil=False,
174
+ # image_format='JPEG')
175
+ # img_str = f'<img src="data:image/jpeg;base64,{img_b64_str}" alt="user upload image" />'
176
+ # msg = img_str + msg.replace('<image>', '').strip()
177
+ # ret.append([msg, None])
178
+ # else:
179
+ # ret.append([msg, None])
180
+ elif role==self.roles[1]:
181
+ if extra_image==None:
182
+ if type(msg) is tuple:
183
+ msg, image, image_process_mode = msg
184
+ img_b64_str = self.process_image(
185
+ image, "Default", return_pil=False,
186
+ image_format='JPEG')
187
+ img_str = f'<img src="data:image/jpeg;base64,{img_b64_str}" alt="user upload image" />'
188
+ msg = img_str +msg
189
+ ret.append([msg, None])
190
+ else:
191
+ ret.append([msg, None])
192
+ else:
193
+ img_b64_str = self.process_image(
194
+ extra_image, "Default", return_pil=False,
195
+ image_format='JPEG')
196
+ img_str = f'<img src="data:image/jpeg;base64,{img_b64_str}" alt="user upload image" />'
197
+ msg=img_str
198
+ ret.append([msg, None])
199
+ break
200
+ return ret
201
+
202
+ def copy(self):
203
+ return Conversation(
204
+ system=self.system,
205
+ roles=self.roles,
206
+ messages=[[x, y] for x, y in self.messages],
207
+ offset=self.offset,
208
+ sep_style=self.sep_style,
209
+ sep=self.sep,
210
+ sep2=self.sep2,
211
+ version=self.version)
212
+
213
+ def dict(self):
214
+ if len(self.get_images()) > 0:
215
+ return {
216
+ "system": self.system,
217
+ "roles": self.roles,
218
+ "messages": [[x, y[0] if type(y) is tuple else y] for x, y in self.messages],
219
+ "offset": self.offset,
220
+ "sep": self.sep,
221
+ "sep2": self.sep2,
222
+ }
223
+ return {
224
+ "system": self.system,
225
+ "roles": self.roles,
226
+ "messages": self.messages,
227
+ "offset": self.offset,
228
+ "sep": self.sep,
229
+ "sep2": self.sep2,
230
+ }
231
+
232
+
233
+ conv_vicuna_v0 = Conversation(
234
+ system="A chat between a curious human and an artificial intelligence assistant. "
235
+ "The assistant gives helpful, detailed, and polite answers to the human's questions.",
236
+ roles=("Human", "Assistant"),
237
+ messages=(
238
+ ("Human", "What are the key differences between renewable and non-renewable energy sources?"),
239
+ ("Assistant",
240
+ "Renewable energy sources are those that can be replenished naturally in a relatively "
241
+ "short amount of time, such as solar, wind, hydro, geothermal, and biomass. "
242
+ "Non-renewable energy sources, on the other hand, are finite and will eventually be "
243
+ "depleted, such as coal, oil, and natural gas. Here are some key differences between "
244
+ "renewable and non-renewable energy sources:\n"
245
+ "1. Availability: Renewable energy sources are virtually inexhaustible, while non-renewable "
246
+ "energy sources are finite and will eventually run out.\n"
247
+ "2. Environmental impact: Renewable energy sources have a much lower environmental impact "
248
+ "than non-renewable sources, which can lead to air and water pollution, greenhouse gas emissions, "
249
+ "and other negative effects.\n"
250
+ "3. Cost: Renewable energy sources can be more expensive to initially set up, but they typically "
251
+ "have lower operational costs than non-renewable sources.\n"
252
+ "4. Reliability: Renewable energy sources are often more reliable and can be used in more remote "
253
+ "locations than non-renewable sources.\n"
254
+ "5. Flexibility: Renewable energy sources are often more flexible and can be adapted to different "
255
+ "situations and needs, while non-renewable sources are more rigid and inflexible.\n"
256
+ "6. Sustainability: Renewable energy sources are more sustainable over the long term, while "
257
+ "non-renewable sources are not, and their depletion can lead to economic and social instability.\n")
258
+ ),
259
+ offset=2,
260
+ sep_style=SeparatorStyle.SINGLE,
261
+ sep="###",
262
+ )
263
+
264
+ conv_vicuna_v1 = Conversation(
265
+ system="A chat between a curious user and an artificial intelligence assistant. "
266
+ "The assistant gives helpful, detailed, and polite answers to the user's questions.",
267
+ roles=("USER", "ASSISTANT"),
268
+ version="v1",
269
+ messages=(),
270
+ offset=0,
271
+ sep_style=SeparatorStyle.TWO,
272
+ sep=" ",
273
+ sep2="</s>",
274
+ )
275
+
276
+ conv_llama_2 = Conversation(
277
+ system="""You are a helpful, respectful and honest assistant. Always answer as helpfully as possible, while being safe. Your answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature.
278
+
279
+ If a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information.""",
280
+ roles=("USER", "ASSISTANT"),
281
+ version="llama_v2",
282
+ messages=(),
283
+ offset=0,
284
+ sep_style=SeparatorStyle.LLAMA_2,
285
+ sep="<s>",
286
+ sep2="</s>",
287
+ )
288
+
289
+ conv_llava_llama_2 = Conversation(
290
+ system="You are a helpful language and vision assistant. "
291
+ "You are able to understand the visual content that the user provides, "
292
+ "and assist the user with a variety of tasks using natural language.",
293
+ roles=("USER", "ASSISTANT"),
294
+ version="llama_v2",
295
+ messages=(),
296
+ offset=0,
297
+ sep_style=SeparatorStyle.LLAMA_2,
298
+ sep="<s>",
299
+ sep2="</s>",
300
+ )
301
+
302
+ conv_mpt = Conversation(
303
+ system="""<|im_start|>system
304
+ A conversation between a user and an LLM-based AI assistant. The assistant gives helpful and honest answers.""",
305
+ roles=("<|im_start|>user\n", "<|im_start|>assistant\n"),
306
+ version="mpt",
307
+ messages=(),
308
+ offset=0,
309
+ sep_style=SeparatorStyle.MPT,
310
+ sep="<|im_end|>",
311
+ )
312
+
313
+ conv_llava_plain = Conversation(
314
+ system="",
315
+ roles=("", ""),
316
+ messages=(
317
+ ),
318
+ offset=0,
319
+ sep_style=SeparatorStyle.PLAIN,
320
+ sep="\n",
321
+ )
322
+
323
+ conv_llava_v0 = Conversation(
324
+ system="A chat between a curious human and an artificial intelligence assistant. "
325
+ "The assistant gives helpful, detailed, and polite answers to the human's questions.",
326
+ roles=("Human", "Assistant"),
327
+ messages=(
328
+ ),
329
+ offset=0,
330
+ sep_style=SeparatorStyle.SINGLE,
331
+ sep="###",
332
+ )
333
+
334
+ conv_llava_v0_mmtag = Conversation(
335
+ system="A chat between a curious user and an artificial intelligence assistant. "
336
+ "The assistant is able to understand the visual content that the user provides, and assist the user with a variety of tasks using natural language."
337
+ "The visual content will be provided with the following format: <Image>visual content</Image>.",
338
+ roles=("Human", "Assistant"),
339
+ messages=(
340
+ ),
341
+ offset=0,
342
+ sep_style=SeparatorStyle.SINGLE,
343
+ sep="###",
344
+ version="v0_mmtag",
345
+ )
346
+
347
+ conv_llava_v1 = Conversation(
348
+ system="A chat between a curious human and an artificial intelligence assistant. "
349
+ "The assistant gives helpful, detailed, and polite answers to the human's questions.",
350
+ roles=("USER", "ASSISTANT"),
351
+ version="v1",
352
+ messages=(),
353
+ offset=0,
354
+ sep_style=SeparatorStyle.TWO,
355
+ sep=" ",
356
+ sep2="</s>",
357
+ )
358
+
359
+ conv_llava_v1_mmtag = Conversation(
360
+ system="A chat between a curious user and an artificial intelligence assistant. "
361
+ "The assistant is able to understand the visual content that the user provides, and assist the user with a variety of tasks using natural language."
362
+ "The visual content will be provided with the following format: <Image>visual content</Image>.",
363
+ roles=("USER", "ASSISTANT"),
364
+ messages=(),
365
+ offset=0,
366
+ sep_style=SeparatorStyle.TWO,
367
+ sep=" ",
368
+ sep2="</s>",
369
+ version="v1_mmtag",
370
+ )
371
+
372
+ conv_mistral_instruct = Conversation(
373
+ system="",
374
+ roles=("USER", "ASSISTANT"),
375
+ version="llama_v2",
376
+ messages=(),
377
+ offset=0,
378
+ sep_style=SeparatorStyle.LLAMA_2,
379
+ sep="",
380
+ sep2="</s>",
381
+ )
382
+
383
+ conv_chatml_direct = Conversation(
384
+ system="""<|im_start|>system
385
+ Answer the questions.""",
386
+ roles=("<|im_start|>user\n", "<|im_start|>assistant\n"),
387
+ version="mpt",
388
+ messages=(),
389
+ offset=0,
390
+ sep_style=SeparatorStyle.MPT,
391
+ sep="<|im_end|>",
392
+ )
393
+
394
+ default_conversation = conv_llava_v1
395
+ conv_templates = {
396
+ "default": conv_vicuna_v0,
397
+ "v0": conv_vicuna_v0,
398
+ "v1": conv_vicuna_v1,
399
+ "vicuna_v1": conv_vicuna_v1,
400
+ "llama_2": conv_llama_2,
401
+ "mistral_instruct": conv_mistral_instruct,
402
+ "chatml_direct": conv_chatml_direct,
403
+ "mistral_direct": conv_chatml_direct,
404
+
405
+ "plain": conv_llava_plain,
406
+ "v0_plain": conv_llava_plain,
407
+ "llava_v0": conv_llava_v0,
408
+ "v0_mmtag": conv_llava_v0_mmtag,
409
+ "llava_v1": conv_llava_v1,
410
+ "v1_mmtag": conv_llava_v1_mmtag,
411
+ "llava_llama_2": conv_llava_llama_2,
412
+
413
+ "mpt": conv_mpt,
414
+ }
415
+
416
+
417
+ if __name__ == "__main__":
418
+ print(default_conversation.get_prompt())
llava/eval/Roboto-Black.ttf ADDED
Binary file (168 kB). View file
 
llava/eval/Roboto-BlackItalic.ttf ADDED
Binary file (174 kB). View file
 
llava/eval/Roboto-Bold.ttf ADDED
Binary file (167 kB). View file
 
llava/eval/Roboto-BoldItalic.ttf ADDED
Binary file (172 kB). View file
 
llava/eval/Roboto-Italic.ttf ADDED
Binary file (171 kB). View file
 
llava/eval/Roboto-Light.ttf ADDED
Binary file (167 kB). View file
 
llava/eval/Roboto-LightItalic.ttf ADDED
Binary file (173 kB). View file
 
llava/eval/Roboto-Medium.ttf ADDED
Binary file (169 kB). View file
 
llava/eval/Roboto-MediumItalic.ttf ADDED
Binary file (173 kB). View file
 
llava/eval/Roboto-Regular.ttf ADDED
Binary file (168 kB). View file
 
llava/eval/Roboto-Thin.ttf ADDED
Binary file (168 kB). View file