vlff李飞飞 commited on
Commit
8d16531
1 Parent(s): 18f2729
Files changed (2) hide show
  1. .gitattributes +1 -0
  2. README.md +242 -1
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ *.ttf filter=lfs diff=lfs merge=lfs -text
README.md CHANGED
@@ -6,6 +6,247 @@ colorTo: purple
6
  sdk: docker
7
  pinned: false
8
  license: apache-2.0
 
9
  ---
10
 
11
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  sdk: docker
7
  pinned: false
8
  license: apache-2.0
9
+ app_port: 7860
10
  ---
11
 
12
+ [中文](./README_CN.md) English
13
+
14
+ <p align="center">
15
+ <img src="https://qianwen-res.oss-cn-beijing.aliyuncs.com/assets/qwen_agent/logo-qwen-agent.png" width="400"/>
16
+ <p>
17
+ <br>
18
+
19
+ Qwen-Agent is a framework for harnessing the tool usage, planning, and memory capabilities of the open-source language model [Qwen](https://github.com/QwenLM/Qwen).
20
+ Building upon Qwen-Agent, we have developed a **Chrome browser extension** called BrowserQwen, which has key features such as:
21
+ - You can discuss with Qwen regarding the current webpage or PDF document.
22
+ - It records the web pages and PDF/Word/PowerPoint materials that you have browsed, with your permission. It helps you understand the contents of multiple pages, summarize your browsing content, and automate tedious writing tasks.
23
+ - It supports plugin integration, including **Code Interpreter** for math problem solving and data visualization.
24
+
25
+ # Use Case Demonstration
26
+
27
+ If you prefer watching videos instead of screenshots, you can refer to the [video demonstration](#video-demonstration).
28
+
29
+ ## Workstation - Editor Mode
30
+
31
+ **This mode is designed for creating long articles based on browsed web pages and PDFs.**
32
+
33
+ <figure>
34
+ <img src="assets/screenshot-writing.png">
35
+ </figure>
36
+
37
+ **It allows you to call plugins to assist in rich text creation.**
38
+
39
+ <figure>
40
+ <img src="assets/screenshot-editor-movie.png">
41
+ </figure>
42
+
43
+ ## Workstation - Chat Mode
44
+
45
+ **In this mode, you can engage in multi-webpage QA.**
46
+
47
+ <figure >
48
+ <img src="assets/screenshot-multi-web-qa.png">
49
+ </figure>
50
+
51
+ **Create data charts using the code interpreter.**
52
+
53
+ <figure>
54
+ <img src="assets/screenshot-ci.png">
55
+ </figure>
56
+
57
+ ## Browser Assistant
58
+
59
+ **Web page QA**
60
+
61
+ <figure>
62
+ <img src="assets/screenshot-web-qa.png">
63
+ </figure>
64
+
65
+ **PDF document QA**
66
+
67
+ <figure>
68
+ <img src="assets/screenshot-pdf-qa.png">
69
+ </figure>
70
+
71
+ # BrowserQwen User Guide
72
+
73
+ Supported platforms: MacOS, Linux, Windows.
74
+
75
+ ## Step 1. Deploy Model Service
76
+
77
+ ***You can skip this step if you are using the model service provided by [DashScope](https://help.aliyun.com/zh/dashscope/developer-reference/quick-start) from Alibaba Cloud.***
78
+
79
+ However, if you prefer to deploy your own model service instead of using DashScope, please follow the instruction below, which is provided by the [Qwen](https://github.com/QwenLM/Qwen) project, to deploy a model service compatible with the OpenAI API:
80
+
81
+ ```bash
82
+ # Install dependencies.
83
+ git clone git@github.com:QwenLM/Qwen.git
84
+ cd Qwen
85
+ pip install -r requirements.txt
86
+ pip install fastapi uvicorn "openai<1.0.0" "pydantic>=2.3.0" sse_starlette
87
+
88
+ # Start the model service, specifying the model version with the -c parameter.
89
+ # --server-name 0.0.0.0 allows other machines to access your service.
90
+ # --server-name 127.0.0.1 only allows the machine deploying the model to access the service.
91
+ python openai_api.py --server-name 0.0.0.0 --server-port 7905 -c Qwen/Qwen-14B-Chat
92
+ ```
93
+
94
+ We can specify the -c argument to load the Qwen models listed on [Qwen's Hugging Face page](https://huggingface.co/Qwen), such as `Qwen/Qwen-1_8B-Chat`, `Qwen/Qwen-7B-Chat`, `Qwen/Qwen-14B-Chat`, `Qwen/Qwen-72B-Chat`, as well as their `Int4` and `Int8` versions.
95
+
96
+ ## Step 2. Deploy Local Database Service
97
+
98
+ On your local machine (the machine where you can open the Chrome browser), you will need to deploy a database service to manage your browsing history and conversation history.
99
+
100
+ Please install the following dependencies if you have not done so already:
101
+
102
+ ```bash
103
+ # Install dependencies.
104
+ git clone https://github.com/QwenLM/Qwen-Agent.git
105
+ cd Qwen-Agent
106
+ pip install -r requirements.txt
107
+ ```
108
+
109
+ If you have skipped Step 1 and decided to use DashScope's model service, then please execute the following command:
110
+
111
+ ```bash
112
+ # Start the database service, specifying the model on DashScope by using the --llm flag.
113
+ # The value of --llm can be one of the following, in increasing order of resource consumption:
114
+ # - qwen-7b-chat (the same as the open-sourced 7B-Chat model)
115
+ # - qwen-14b-chat (the same as the open-sourced 14B-Chat model)
116
+ # - qwen-turbo
117
+ # - qwen-plus
118
+ # "YOUR_DASHSCOPE_API_KEY" is a placeholder. The user should replace it with their actual key.
119
+ python run_server.py --api_key YOUR_DASHSCOPE_API_KEY --model_server dashscope --llm qwen-7b-chat --workstation_port 7864
120
+ ```
121
+
122
+ If you have followed Step 1 and are using your own model service instead of DashScope, then please execute the following command:
123
+
124
+ ```bash
125
+ # Start the database service, specifying the model service deployed in Step 1 with --model_server.
126
+ # If the IP address of the machine in Step 1 is 123.45.67.89,
127
+ # you can specify --model_server http://123.45.67.89:7905/v1
128
+ # If Step 1 and Step 2 are on the same machine,
129
+ # you can specify --model_server http://127.0.0.1:7905/v1
130
+ python run_server.py --model_server http://{MODEL_SERVER_IP}:7905/v1 --workstation_port 7864
131
+ ```
132
+
133
+ Now you can access [http://127.0.0.1:7864/](http://127.0.0.1:7864/) to use the Workstation's Editor mode and Chat mode.
134
+
135
+ For tips on using the Workstation, please refer to the instructions on the Workstation page or watch the [video demonstration](#video-demonstration).
136
+
137
+ ## Step 3. Install Browser Assistant
138
+
139
+ Install the BrowserQwen Chrome extension:
140
+
141
+ - Open the Chrome browser and enter `chrome://extensions/` in the address bar, then press Enter.
142
+ - Make sure that the `Developer mode` in the top right corner is turned on, then click on `Load unpacked` to upload the `browser_qwen` directory from this project and enable it.
143
+ - Click the extension icon in the top right corner of the Chrome browser to pin BrowserQwen to the toolbar.
144
+
145
+ Note that after installing the Chrome extension, you need to refresh the page for the extension to take effect.
146
+
147
+ When you want Qwen to read the content of the current webpage:
148
+
149
+ - Click the `Add to Qwen's Reading List` button on the screen to authorize Qwen to analyze the page in the background.
150
+ - Click the Qwen icon in the browser's top right corner to start interacting with Qwen about the current page's content.
151
+
152
+ ## Video Demonstration
153
+
154
+ You can watch the following showcase videos to learn about the basic operations of BrowserQwen:
155
+
156
+ - Long-form writing based on visited webpages and PDFs [video](https://qianwen-res.oss-cn-beijing.aliyuncs.com/assets/qwen_agent/showcase_write_article_based_on_webpages_and_pdfs.mp4)
157
+ - Drawing a plot using code interpreter based on the given information [video](https://qianwen-res.oss-cn-beijing.aliyuncs.com/assets/qwen_agent/showcase_chat_with_docs_and_code_interpreter.mp4)
158
+ - Uploading files, multi-turn conversation, and data analysis using code interpreter [video](https://qianwen-res.oss-cn-beijing.aliyuncs.com/assets/qwen_agent/showcase_code_interpreter_multi_turn_chat.mp4)
159
+
160
+ # Evaluation Benchmark
161
+
162
+ We have also open-sourced a benchmark for evaluating the performance of a model in writing Python code and using Code Interpreter for mathematical problem solving, data analysis, and other general tasks. The benchmark can be found in the [benchmark](benchmark/README.md) directory. The current evaluation results are as follows:
163
+
164
+ <table>
165
+ <tr>
166
+ <th colspan="5" align="center">In-house Code Interpreter Benchmark (Version 20231206)</th>
167
+ </tr>
168
+ <tr>
169
+ <th rowspan="2" align="center">Model</th>
170
+ <th colspan="3" align="center">Accuracy of Code Execution Results (%)</th>
171
+ <th colspan="1" align="center">Executable Rate of Code (%)</th>
172
+ </tr>
173
+ <tr>
174
+ <th align="center">Math↑</th><th align="center">Visualization-Hard↑</th><th align="center">Visualization-Easy↑</th><th align="center">General↑</th>
175
+ </tr>
176
+ <tr>
177
+ <td>GPT-4</td>
178
+ <td align="center">82.8</td>
179
+ <td align="center">66.7</td>
180
+ <td align="center">60.8</td>
181
+ <td align="center">82.8</td>
182
+ </tr>
183
+ <tr>
184
+ <td>GPT-3.5</td>
185
+ <td align="center">47.3</td>
186
+ <td align="center">33.3</td>
187
+ <td align="center">55.7</td>
188
+ <td align="center">74.1</td>
189
+ </tr>
190
+ <tr>
191
+ <td>LLaMA2-13B-Chat</td>
192
+ <td align="center">8.3</td>
193
+ <td align="center">1.2</td>
194
+ <td align="center">15.2</td>
195
+ <td align="center">48.3</td>
196
+ </tr>
197
+ <tr>
198
+ <td>CodeLLaMA-13B-Instruct</td>
199
+ <td align="center">28.2</td>
200
+ <td align="center">15.5</td>
201
+ <td align="center">21.5</td>
202
+ <td align="center">74.1</td>
203
+ </tr>
204
+ <tr>
205
+ <td>InternLM-20B-Chat</td>
206
+ <td align="center">34.6</td>
207
+ <td align="center">10.7</td>
208
+ <td align="center">24.1</td>
209
+ <td align="center">65.5</td>
210
+ </tr>
211
+ <tr>
212
+ <td>ChatGLM3-6B</td>
213
+ <td align="center">54.2</td>
214
+ <td align="center">4.8</td>
215
+ <td align="center">15.2</td>
216
+ <td align="center">62.1</td>
217
+ </tr>
218
+ <tr>
219
+ <td>Qwen-1.8B-Chat</td>
220
+ <td align="center">25.6</td>
221
+ <td align="center">21.4</td>
222
+ <td align="center">22.8</td>
223
+ <td align="center">65.5</td>
224
+ </tr>
225
+ <tr>
226
+ <td>Qwen-7B-Chat</td>
227
+ <td align="center">41.9</td>
228
+ <td align="center">23.8</td>
229
+ <td align="center">38.0</td>
230
+ <td align="center">67.2</td>
231
+ </tr>
232
+ <tr>
233
+ <td>Qwen-14B-Chat</td>
234
+ <td align="center">58.4</td>
235
+ <td align="center">31.0</td>
236
+ <td align="center">45.6</td>
237
+ <td align="center">65.5</td>
238
+ </tr>
239
+ <tr>
240
+ <td>Qwen-72B-Chat</td>
241
+ <td align="center">72.7</td>
242
+ <td align="center">41.7</td>
243
+ <td align="center">43.0</td>
244
+ <td align="center">82.8</td>
245
+ </tr>
246
+ </table>
247
+
248
+ # Disclaimer
249
+
250
+ This project is not intended to be an official product, rather it serves as a proof-of-concept project that highlights the capabilities of the Qwen series models.
251
+
252
+ > Important: The code interpreter is not sandboxed, and it executes code in your own environment. Please do not ask Qwen to perform dangerous tasks, and do not directly use the code interpreter for production purposes.