zhongyufeng02 commited on
Commit
cb03203
·
1 Parent(s): ed112a9

Add application file

Browse files
app.py ADDED
@@ -0,0 +1,221 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import argparse
2
+ import json
3
+ import os
4
+
5
+ import torch
6
+ from PIL import Image
7
+ from qwen_vl_utils import process_vision_info
8
+ from transformers import AutoProcessor, Qwen2_5_VLForConditionalGeneration
9
+ import gradio as gr
10
+
11
+ user_prompt = "Analyze the image. Extract and output only the LaTeX formulas present in the image, in LaTeX code format. Ignore inline formulas, all other text, and do not include any explanations."
12
+
13
+
14
+ def read_input_file(input_file):
15
+ with open(input_file, 'r') as file:
16
+ data = json.load(file)
17
+
18
+ image_path = data[0]['images'][0]
19
+ gt_latex_code = data[0]['messages'][1]['content']
20
+
21
+ return image_path, gt_latex_code
22
+
23
+
24
+ class ImageProcessor:
25
+ def __init__(self, args):
26
+ self.args = args
27
+ self.model, self.vis_processor = self.load_model_and_processor()
28
+ self.generate_kwargs = dict(
29
+ max_new_tokens=2048,
30
+ top_p=0.001,
31
+ top_k=1,
32
+ temperature=0.01,
33
+ repetition_penalty=1.0,
34
+ )
35
+
36
+ def load_model_and_processor(self):
37
+ # Load model
38
+ checkpoint = self.args.ckpt
39
+ vis_processor = AutoProcessor.from_pretrained(checkpoint)
40
+
41
+ model = Qwen2_5_VLForConditionalGeneration.from_pretrained(checkpoint, torch_dtype="auto", device_map="auto")
42
+ model.eval()
43
+
44
+ return model, vis_processor
45
+
46
+ def process_single_image(self, image_path):
47
+ question = user_prompt
48
+
49
+ try:
50
+ image_local_path = "file://" + image_path
51
+
52
+ messages = []
53
+ messages.append(
54
+ {"role": "user", "content": [
55
+ {"type": "image", "image": image_local_path, "min_pixels": 32 * 32, "max_pixels": 512 * 512},
56
+ {"type": "text", "text": question},
57
+ ]
58
+ }
59
+ )
60
+
61
+ text = self.vis_processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
62
+ images, videos = process_vision_info([messages])
63
+
64
+ inputs = self.vis_processor(text=text, images=images, videos=videos, padding=True, return_tensors='pt')
65
+ inputs = inputs.to(self.model.device)
66
+
67
+ with torch.no_grad():
68
+ generated_ids = self.model.generate(
69
+ **inputs,
70
+ **self.generate_kwargs,
71
+ )
72
+ generated_ids = [
73
+ output_ids[len(input_ids):] for input_ids, output_ids in zip(inputs.input_ids, generated_ids)
74
+ ]
75
+ out = self.vis_processor.tokenizer.batch_decode(
76
+ generated_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False
77
+ )
78
+ model_answer = out[0]
79
+ except Exception as e:
80
+ print(e, flush=True)
81
+ model_answer = "None"
82
+
83
+ return model_answer
84
+
85
+ def save_image_with_auto_naming(image, save_dir="./tmp"):
86
+ # 确保目录存在
87
+ os.makedirs(save_dir, exist_ok=True)
88
+
89
+ # 获取目录中现有的文件名
90
+ existing_files = [f for f in os.listdir(save_dir) if f.endswith('.png') and f.split('.')[0].isdigit()]
91
+
92
+ # 找到最大的数字
93
+ next_num = 0
94
+ if existing_files:
95
+ next_num = max([int(f.split('.')[0]) for f in existing_files]) + 1
96
+
97
+ # 生成新文件名
98
+ temp_path = os.path.join(save_dir, f"{next_num}.png")
99
+
100
+ # 保存图片
101
+ image.save(temp_path)
102
+
103
+ return temp_path
104
+
105
+ # {{ edit_1 }}
106
+ def process_image_for_gradio(image):
107
+ """处理上传的图片并返回LaTeX结果"""
108
+ if image is None:
109
+ return ""
110
+
111
+ # 保存上传的图片到指定目录,并自动命名
112
+ temp_path = save_image_with_auto_naming(image)
113
+
114
+ # 处理图片
115
+ pred_latex_code = processor.process_single_image(temp_path)
116
+
117
+ # 清理临时文件
118
+ if os.path.exists(temp_path):
119
+ os.remove(temp_path)
120
+
121
+ return pred_latex_code
122
+
123
+ def load_example(example_name):
124
+ """加载示例图片"""
125
+ input_file = os.path.join('./asset/test_jsons', f"{example_name}.json")
126
+ image_path, gt_latex_code = read_input_file(input_file)
127
+ return Image.open(image_path), example_name
128
+
129
+ # {{ edit_2 }}
130
+ def create_gradio_interface(processor):
131
+ """创建Gradio界面"""
132
+ with gr.Blocks(title="DocTron-Formula") as demo:
133
+ gr.Markdown("# DocTron-Formula LaTeX公式识别")
134
+ gr.Markdown("上传图片或选择示例来识别LaTeX公式")
135
+
136
+ with gr.Row():
137
+ with gr.Column():
138
+ # 左侧列
139
+ image_input = gr.Image(type="pil", label="上传图片")
140
+
141
+ with gr.Row():
142
+ clear_btn = gr.Button("Clear")
143
+ submit_btn = gr.Button("Submit", variant="primary")
144
+
145
+ gr.Markdown("### 示例图片")
146
+ with gr.Row():
147
+ line_btn = gr.Button("Line-level")
148
+ paragraph_btn = gr.Button("Paragraph-level")
149
+ page_btn = gr.Button("Page-level")
150
+
151
+ # 存储示例名称
152
+ example_name = gr.State()
153
+
154
+ with gr.Column():
155
+ # 右侧列 - 显示结果
156
+ latex_output = gr.Textbox(label="预测的LaTeX公式", lines=10, interactive=False)
157
+
158
+ # 按钮事件绑定
159
+ submit_btn.click(
160
+ fn=process_image_for_gradio,
161
+ inputs=[image_input],
162
+ outputs=[latex_output]
163
+ )
164
+
165
+ clear_btn.click(
166
+ fn=lambda: (None, ""),
167
+ inputs=[],
168
+ outputs=[image_input, latex_output]
169
+ )
170
+
171
+ # 示例按钮事件
172
+ line_btn.click(
173
+ fn=load_example,
174
+ inputs=gr.Textbox(value="line-level", visible=False),
175
+ outputs=[image_input, example_name]
176
+ ).then(
177
+ fn=lambda img: process_image_for_gradio(img),
178
+ inputs=[image_input],
179
+ outputs=[latex_output]
180
+ )
181
+
182
+ paragraph_btn.click(
183
+ fn=load_example,
184
+ inputs=gr.Textbox(value="paragraph-level", visible=False),
185
+ outputs=[image_input, example_name]
186
+ ).then(
187
+ fn=lambda img: process_image_for_gradio(img),
188
+ inputs=[image_input],
189
+ outputs=[latex_output]
190
+ )
191
+
192
+ page_btn.click(
193
+ fn=load_example,
194
+ inputs=gr.Textbox(value="page-level", visible=False),
195
+ outputs=[image_input, example_name]
196
+ ).then(
197
+ fn=lambda img: process_image_for_gradio(img),
198
+ inputs=[image_input],
199
+ outputs=[latex_output]
200
+ )
201
+
202
+ return demo
203
+
204
+ if __name__ == "__main__":
205
+ parser = argparse.ArgumentParser()
206
+ parser.add_argument("--ckpt", type=str, default="DocTron/DocTron-Formula")
207
+ parser.add_argument("--input_file", type=str, default="line-level")
208
+ args = parser.parse_args()
209
+
210
+ # Init model
211
+ processor = ImageProcessor(args)
212
+
213
+ # {{ edit_3 }}
214
+ # 创建并启动Gradio界面
215
+ demo = create_gradio_interface(processor)
216
+ # demo.launch(
217
+ # server_name="10.238.36.208",
218
+ # server_port=8000,
219
+ # share=False
220
+ # )
221
+ demo.launch()
asset/test_jsons/line-level.json ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "qid": "part-00014-8bdd594e-bf2f-4dee-8277-9c33e8468d28-c000_9402_single_15",
4
+ "messages": [
5
+ {
6
+ "content": "<image> Analyze the image. Extract and output only the LaTeX formulas present in the image, in LaTeX code format. Ignore inline formulas, all other text, and do not include any explanations.",
7
+ "role": "user"
8
+ },
9
+ {
10
+ "content": "\\begin{align}\n\\frac{d}{dt}X_1+\\frac{d}{dt}X_2 &=\\left(AX_1+B\\begin{bmatrix}c_1\\cos{\\omega_1t}\\\\ d_1\\cos{\\omega_1t}\\end{bmatrix}\\right)+ \\left(AX_2+B\\begin{bmatrix}c_2\\cos{\\omega_2t}\\\\ d_2\\cos{\\omega_2t}\\end{bmatrix}\\right) \\\\ &=AX_1+AX_2+B\\begin{bmatrix}c_1\\cos{\\omega_1t}\\\\ d_1\\cos{\\omega_1t}\\end{bmatrix}+B\\begin{bmatrix}c_2\\cos{\\omega_2t}\\\\ d_2\\cos{\\omega_2t}\\end{bmatrix} \\\\ &= A(X_1+X_2) + B\\left(\\begin{bmatrix}c_1\\cos{\\omega_1t}\\\\ d_1\\cos{\\omega_1t}\\end{bmatrix}+\\begin{bmatrix}c_2\\cos{\\omega_2t}\\\\ d_2\\cos{\\omega_2t}\\end{bmatrix}\\right) \\\\ &= AX+B\\begin{bmatrix}u_1(t) \\\\ u_2(t)\\end{bmatrix} \\\\ &=\\frac{d}{dt}X.\n\\end{align}",
11
+ "role": "assistant"
12
+ }
13
+ ],
14
+ "images": [
15
+ "/mnt/dolphinfs/ssd_pool/docker/user/hadoop-basecv-hl/hadoop-basecv/zhongyufeng02/data/OCR/math_stackexchange_single/se_20_host_prepared_20240926/part-00014-8bdd594e-bf2f-4dee-8277-9c33e8468d28-c000/images/question_part-00014-8bdd594e-bf2f-4dee-8277-9c33e8468d28-c000_9402_single_15.png"
16
+ ],
17
+ "model_answer": "\\begin{align}\n\\frac{d}{dt}X_1 + \\frac{d}{dt}X_2 &= \\left(AX_1 + B\\begin{bmatrix}c_1\\cos\\omega_1 t\\\\d_1\\cos\\omega_1 t\\end{bmatrix}\\right) + \\left(AX_2 + B\\begin{bmatrix}c_2\\cos\\omega_2 t\\\\d_2\\cos\\omega_2 t\\end{bmatrix}\\right)\\\\ &= AX_1 + AX_2 + B\\begin{bmatrix}c_1\\cos\\omega_1 t\\\\d_1\\cos\\omega_1 t\\end{bmatrix} + B\\begin{bmatrix}c_2\\cos\\omega_2 t\\\\d_2\\cos\\omega_2 t\\end{bmatrix}\\\\ &= A(X_1 + X_2) + B\\left(\\begin{bmatrix}c_1\\cos\\omega_1 t\\\\d_1\\cos\\omega_1 t\\end{bmatrix} + \\begin{bmatrix}c_2\\cos\\omega_2 t\\\\d_2\\cos\\omega_2 t\\end{bmatrix}\\right)\\\\ &= AX + B\\begin{bmatrix}u_1(t)\\\\u_2(t)\\end{bmatrix}\\\\ &= \\frac{d}{dt}X.\n\\end{align}",
18
+ "edit_acc": 0.1109350237717908
19
+ }
20
+ ]
asset/test_jsons/page-level.json ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "qid": "part-00014-8bdd594e-bf2f-4dee-8277-9c33e8468d28-c000_27959_all",
4
+ "messages": [
5
+ {
6
+ "content": "<image> Analyze the image. Extract and output only the LaTeX formulas present in the image, in LaTeX code format. Ignore inline formulas, all other text, and do not include any explanations.",
7
+ "role": "user"
8
+ },
9
+ {
10
+ "content": "$$\n\\sigma^2 = \\int_{-\\infty}^\\infty \\frac{N_0}{2}|H(f)|^2\\,\\mathrm df\n$$\n\\begin{align}\n\\sigma^2 &= \\int_{-\\infty}^\\infty \\frac{N_0}{2}|H(f)|^2\\,df \\\\ &= \\int_{-\\infty}^\\infty \\frac{N_0}{2}|H(\\omega/2\\pi)|^2\\,d(\\omega/2\\pi) \\\\ &= \\frac{1}{2\\pi}\\int_{-\\infty}^\\infty \\frac{N_0}{2}|H(\\omega)|^2\\,d\\omega \\\\ &= \\frac{1}{2\\pi}\\int_{-\\infty}^\\infty \\frac{N_0}{2}\\frac{1}{(\\omega\\tau)^2+1}\\,d\\omega \\\\ &= \\frac{1}{2\\pi\\tau}\\int_{-\\infty}^\\infty \\frac{N_0}{2}\\frac{1}{(\\omega\\tau)^2+1}\\,d(\\omega\\tau) \\\\ &= \\frac{1}{2\\pi\\tau}\\int_{-\\infty}^\\infty \\frac{N_0}{2}\\frac{1}{u^2+1}\\, du \\\\ &= \\frac{N_0}{4\\pi\\tau}\\left[\\tan^{-1} u\\right]_{-\\infty}^{\\infty} \\\\ &= \\frac{N_0}{4\\pi\\tau}\\left[\\pi/2 - (-\\pi/2)\\right] \\\\ &= \\frac{N_0}{4\\tau},\n\\end{align}\n$$\ny[k]=x(kT)\\;\\Longleftrightarrow \\;R_y[k]=R_x(kT)\\tag{1}\n$$\n$$\nS_y(e^{j\\omega T})=\\frac{1}{T}\\sum_{k=-\\infty}^{\\infty}S_x\\left(\\omega-\\frac{2\\pi k}{T}\\right)\\tag{2}\n$$",
11
+ "role": "assistant"
12
+ }
13
+ ],
14
+ "images": [
15
+ "/mnt/dolphinfs/ssd_pool/docker/user/hadoop-basecv-hl/hadoop-basecv/zhongyufeng02/data/OCR/math_stackexchange_new/se_20_host_prepared_20240926/part-00014-8bdd594e-bf2f-4dee-8277-9c33e8468d28-c000/images/question_part-00014-8bdd594e-bf2f-4dee-8277-9c33e8468d28-c000_27959_all.png"
16
+ ],
17
+ "model_answer": "$$\n\\sigma^2 = \\int_{-\\infty}^{\\infty} \\frac{N_0}{2} |H(f)|^2 \\, \\mathrm{d}f\n$$\n\\begin{align}\n\\sigma^2 &= \\int_{-\\infty}^{\\infty} \\frac{N_0}{2} |H(f)|^2 \\, \\mathrm{d}f \\\\ &= \\int_{-\\infty}^{\\infty} \\frac{N_0}{2} |H(\\omega/2\\pi)|^2 \\, \\mathrm{d}(\\omega/2\\pi) \\\\ &= \\frac{1}{2\\pi} \\int_{-\\infty}^{\\infty} \\frac{N_0}{2} |H(\\omega)|^2 \\, \\mathrm{d}\\omega \\\\ &= \\frac{1}{2\\pi} \\int_{-\\infty}^{\\infty} \\frac{N_0}{2} \\frac{1}{(\\omega\\tau)^2 + 1} \\, \\mathrm{d}\\omega \\\\ &= \\frac{2\\pi\\tau}{2\\pi} \\int_{-\\infty}^{\\infty} \\frac{N_0}{2} \\frac{1}{(\\omega\\tau)^2 + 1} \\, \\mathrm{d}(\\omega\\tau) \\\\ &= \\frac{1}{2\\pi\\tau} \\int_{-\\infty}^{\\infty} \\frac{N_0}{2} \\frac{1}{u^2 + 1} \\, \\mathrm{d}u \\\\ &= \\frac{N_0}{4\\pi} \\left[ \\tan^{-1} u \\right]_{-\\infty}^{\\infty} \\\\ &= \\frac{N_0}{4\\pi} \\left[ \\pi/2 - (-\\pi/2) \\right] \\\\ &= \\frac{N_0}{4\\pi}\n\\end{align}\n$$\ny[k]=x(kT)\\iff R_y[k]=R_x(kT)\\tag{1}\n$$\n$$\nS_y(e^{j\\omega T})=\\frac{1}{T}\\sum_{k=-\\infty}^{\\infty}S_x\\left(\\omega-\\frac{2\\pi k}{T}\\right)\\tag{2}\n$$",
18
+ "edit_acc": 0.15040650406504066
19
+ }
20
+ ]
asset/test_jsons/paragraph-level.json ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "qid": "part-00025-8bdd594e-bf2f-4dee-8277-9c33e8468d28-c000_4210_multi",
4
+ "messages": [
5
+ {
6
+ "content": "<image> Analyze the image. Extract and output only the LaTeX formulas present in the image, in LaTeX code format. Ignore inline formulas, all other text, and do not include any explanations.",
7
+ "role": "user"
8
+ },
9
+ {
10
+ "content": "\\begin{align}\n&{\\text{Start with defining $2N$-Point DFT of $x_{2N}[n]\\ldots$}}\\\\ X_{2N}[k] &= \\sum_{n=0}^{2N-1} {x_{2N}[n] e^{-j\\frac{2\\pi}{2N}nk}} \\\\ \\\\ &{\\text{first split the sum and then substitude $n=n-N$ in the $2^{nd}$}}\\\\ &= \\sum_{n=0}^{N-1} {x_{2N}[n] e^{-j\\frac{2\\pi}{N}n(k/2)}} + \\sum_{n=N}^{2N-1} {x_{2N}[n] e^{-j\\frac{2\\pi}{2N}nk}} \\\\ \\\\ &{\\text{recognise $x_{2N}[n]=x_N[n]$, $x_{2N}[n+N]=x_N[n]$ }}\\\\ &= \\sum_{n=0}^{N-1} {x_{2N}[n] e^{-j\\frac{2\\pi}{N}n(k/2)}} + \\sum_{n=0}^{N-1} {x_{2N}[n+N] e^{-j\\frac{2\\pi}{2N}(n+N)k}} \\\\ \\\\ &{\\text{Expand the 2nd sum's multiplier factor}}\\\\ &= \\sum_{n=0}^{N-1} {x_N[n] e^{-j\\frac{2\\pi}{N}n(k/2)}} + \\sum_{n=0}^{N-1} {x_N[n] e^{-j\\frac{2\\pi}{N}(n+N)(k/2)}} \\\\ \\\\ &{\\text{Replace $e^{-2j\\frac\\pi N}$ with $W_N$ for simplicity }} \\\\ &= \\sum_{n=0}^{N-1} {x_N[n] W_N^{nk/2}} + W_N^{Nk/2}\\sum_{n=0}^{N-1} {x_N[n] W_N^{nk/2}} \\\\ \\\\ &{\\text{Recognise the sums as $N$-Point DFT $X[k]$ of $x[n]$, at $\\frac k2$}}\\\\ &= X_N[k/2] + e^{-j\\pi k} X_N[k/2] \\\\ \\\\ &= X_N[k/2] \\cdot \\big( 1 + (-1)^k \\big) \\\\ \\\\ &= \\begin{cases} 2 X_N[k/2] , &\\scriptstyle{\\text{k=0,2,4,...,2N-2 }}\\\\ 0 , &\\scriptstyle{\\text{k=1,3,5,...,2N-1 }}\\\\ \\end{cases}\n\\end{align}\n$$\nX_{2N}[k] = 0 ~~,~~ \\text{for}~~ k=1,3,5...,2N-1\n$$",
11
+ "role": "assistant"
12
+ }
13
+ ],
14
+ "images": [
15
+ "/mnt/dolphinfs/ssd_pool/docker/user/hadoop-basecv-hl/hadoop-basecv/zhongyufeng02/data/OCR/math_stackexchange_multi/se_20_host_prepared_20240926/part-00025-8bdd594e-bf2f-4dee-8277-9c33e8468d28-c000/images/question_part-00025-8bdd594e-bf2f-4dee-8277-9c33e8468d28-c000_4210_multi.png"
16
+ ],
17
+ "model_answer": "\\begin{align}\n\\text{Start with defining 2N-Point DFT of } x_{2N}[n] \\ldots \\\\ X_{2N}[k] &= \\sum_{n=0}^{2N-1} x_{2N}[n] e^{-j \\frac{2\\pi}{2N} nk} \\\\ \\\\ &\\text{first split the sum and then substitute } n = n-N \\text{ in the } 2^{nd} \\\\ &= \\sum_{n=0}^{N-1} x_{2N}[n] e^{-j \\frac{2\\pi}{2N} n (k/2)} + \\sum_{n=N}^{2N-1} x_{2N}[n] e^{-j \\frac{2\\pi}{2N} nk} \\\\ \\\\ &\\text{recognise } x_{2N}[n] = x_N[n], \\ x_{2N}[n+N] = x_N[n] \\\\ &= \\sum_{n=0}^{N-1} x_{2N}[n] e^{-j \\frac{2\\pi}{2N} n (k/2)} + \\sum_{n=0}^{N-1} x_{2N}[n+N] e^{-j \\frac{2\\pi}{2N} (n+N) k} \\\\ \\\\ &\\text{Expand the 2nd sum's multiplier factor} \\\\ &= \\sum_{n=0}^{N-1} x_N[n] e^{-j \\frac{2\\pi}{N} n (k/2)} + \\sum_{n=0}^{N-1} x_N[n] e^{-j \\frac{2\\pi}{N} (n+N) (k/2)} \\\\ \\\\ &\\text{Replace } e^{-2j\\frac{\\pi}{N}} \\text{ with } W_N \\text{ for simplicity} \\\\ &= \\sum_{n=0}^{N-1} x_N[n] W_N^{nk/2} + W_N^{Nk/2} \\sum_{n=0}^{N-1} x_N[n] W_N^{nk/2} \\\\ \\\\ &\\text{Recognise the sums as N-Point DFT } X[k] \\text{ of } x[n] \\text{, at } \\frac{k}{2} \\\\ &= X_N[k/2] + e^{-j \\pi k} X_N[k/2] \\\\ \\\\ &= X_N[k/2] \\cdot \\big( 1 + (-1)^k \\big) \\\\ \\\\ &= \\begin{cases} 2 X_N[k/2], & \\text{k = 0,2,4,...2N2} \\\\ 0, & \\text{k = 1,3,5,...2N-1} \\end{cases} \\\\\n\\end{align}\n$$\nX_{2N}[k] = 0 ~~,~~ \\text{for}~~ k = 1,3,5...,2N-1\n$$",
18
+ "edit_acc": 0.14628297362110312
19
+ }
20
+ ]
requirements.txt ADDED
@@ -0,0 +1,268 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ absl-py==2.2.2
2
+ accelerate==1.0.1
3
+ aiofiles==23.2.1
4
+ aiohappyeyeballs==2.4.4
5
+ aiohttp==3.11.11
6
+ aiosignal==1.3.2
7
+ annotated-types==0.7.0
8
+ antlr4-python3-runtime==4.11.1
9
+ anyio==4.7.0
10
+ asttokens==3.0.0
11
+ async-timeout==5.0.1
12
+ attrs==24.3.0
13
+ audioread==3.0.1
14
+ av==14.0.1
15
+ blis==1.3.0
16
+ boto3==1.35.99
17
+ botocore==1.35.99
18
+ Brotli==1.1.0
19
+ catalogue==2.0.10
20
+ certifi==2024.12.14
21
+ cffi==1.17.1
22
+ charset-normalizer==3.4.1
23
+ choreographer==1.0.9
24
+ click==8.1.8
25
+ cloudpathlib==0.21.1
26
+ cloudpickle==3.1.0
27
+ colorama
28
+ colormath==3.0.0
29
+ confection==0.1.5
30
+ contourpy==1.3.1
31
+ cycler==0.12.1
32
+ cymem==2.0.11
33
+ dataclasses
34
+ datasets==3.1.0
35
+ decorator==5.2.1
36
+ decord==0.6.0
37
+ deepspeed==0.16.7
38
+ dill==0.3.8
39
+ diskcache==5.6.3
40
+ distro==1.9.0
41
+ docopt==0.6.2
42
+ docstring_parser==0.16
43
+ editdistance==0.8.1
44
+ einops==0.8.0
45
+ en_core_web_sm @ https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.8.0/en_core_web_sm-3.8.0-py3-none-any.whl#sha256=1932429db727d4bff3deed6b34cfc05df17794f4a52eeb26cf8928f7c1a0fb85
46
+ et_xmlfile==2.0.0
47
+ evaluate==0.4.3
48
+ exceptiongroup==1.2.2
49
+ executing==2.2.0
50
+ fastapi==0.115.6
51
+ ffmpy==0.5.0
52
+ filelock==3.16.1
53
+ fire==0.7.0
54
+ flash-attn==2.7.2.post1
55
+ fonttools==4.55.3
56
+ frozenlist==1.5.0
57
+ fsspec==2024.9.0
58
+ gguf==0.9.1
59
+ gradio==5.38.2
60
+ gradio_client==1.11.0
61
+ groovy==0.1.2
62
+ h11==0.14.0
63
+ h5py==3.12.1
64
+ hf-xet==1.1.5
65
+ hjson==3.1.0
66
+ httpcore==1.0.7
67
+ httptools==0.6.4
68
+ httpx==0.28.1
69
+ huggingface-hub==0.33.2
70
+ icecream==2.1.4
71
+ idna==3.10
72
+ imageio==2.37.0
73
+ importlib_metadata==8.5.0
74
+ importlib_resources==6.4.5
75
+ interegular==0.3.3
76
+ iopath
77
+ ipdb==0.13.13
78
+ ipython==8.37.0
79
+ isort==6.0.1
80
+ jedi==0.19.2
81
+ jieba==0.42.1
82
+ Jinja2==3.1.5
83
+ jiter==0.8.2
84
+ jmespath==1.0.1
85
+ joblib==1.4.2
86
+ jsonlines==4.0.0
87
+ jsonschema==4.23.0
88
+ jsonschema-specifications==2024.10.1
89
+ kaleido==1.0.0
90
+ kiwisolver==1.4.8
91
+ langcodes==3.5.0
92
+ language_data==1.3.0
93
+ lark==1.2.2
94
+ latex2sympy2_extended==1.10.2
95
+ lazy_loader==0.4
96
+ Levenshtein==0.26.1
97
+ librosa==0.11.0
98
+ -e git+https://github.com/hiyouga/LLaMA-Factory.git@2e4b94e8a287493dee0bf739794fa084810c23c1#egg=llamafactory
99
+ llvmlite==0.43.0
100
+ lm-format-enforcer==0.10.6
101
+ logistro==1.1.0
102
+ loguru==0.7.3
103
+ marisa-trie==1.2.1
104
+ markdown-it-py==3.0.0
105
+ MarkupSafe==2.1.5
106
+ math-verify==0.8.0
107
+ matplotlib==3.8.4
108
+ matplotlib-inline==0.1.6
109
+ matplotlib-venn==0.11.10
110
+ mdurl==0.1.2
111
+ mistral_common==1.5.1
112
+ mpmath==1.3.0
113
+ mpxpy==0.0.5
114
+ msgpack==1.1.0
115
+ msgspec==0.18.6
116
+ mssapi==1.1
117
+ mt-longcat==0.1.7
118
+ multidict==6.1.0
119
+ multiprocess==0.70.16
120
+ murmurhash==1.0.13
121
+ nest-asyncio==1.6.0
122
+ networkx==3.4.2
123
+ ninja==1.11.1.3
124
+ nltk==3.9.1
125
+ numba==0.60.0
126
+ numpy==1.26.4
127
+ nvidia-cublas-cu12==12.1.3.1
128
+ nvidia-cuda-cupti-cu12==12.1.105
129
+ nvidia-cuda-nvrtc-cu12==12.1.105
130
+ nvidia-cuda-runtime-cu12==12.1.105
131
+ nvidia-cudnn-cu12==9.1.0.70
132
+ nvidia-cufft-cu12==11.0.2.54
133
+ nvidia-curand-cu12==10.3.2.106
134
+ nvidia-cusolver-cu12==11.4.5.107
135
+ nvidia-cusparse-cu12==12.1.0.106
136
+ nvidia-ml-py==12.560.30
137
+ nvidia-nccl-cu12==2.20.5
138
+ nvidia-nvjitlink-cu12==12.6.85
139
+ nvidia-nvtx-cu12==12.1.105
140
+ omegaconf==2.3.0
141
+ openai==0.28.0
142
+ opencv-python==4.11.0.86
143
+ opencv-python-headless==4.11.0.86
144
+ openpyxl==3.1.5
145
+ orjson==3.10.18
146
+ outlines==0.0.46
147
+ packaging==24.2
148
+ pandas==2.2.3
149
+ parso==0.8.4
150
+ partial-json-parser==0.2.1.1.post4
151
+ pdf2image==1.17.0
152
+ peft==0.15.1
153
+ pexpect==4.9.0
154
+ pillow==10.4.0
155
+ platformdirs==4.3.8
156
+ pooch==1.8.2
157
+ portalocker
158
+ preshed==3.0.9
159
+ prometheus-fastapi-instrumentator==7.0.0
160
+ prometheus_client==0.21.1
161
+ prompt_toolkit==3.0.51
162
+ propcache==0.2.1
163
+ protobuf==5.29.2
164
+ psutil==6.1.1
165
+ ptyprocess==0.7.0
166
+ pure_eval==0.2.3
167
+ py-cpuinfo==9.0.0
168
+ pyairports==2.1.1
169
+ pyarrow==18.1.0
170
+ pycocoevalcap==1.2
171
+ pycocotools==2.0.8
172
+ pycountry==24.6.1
173
+ pycparser==2.22
174
+ pydantic==2.11.7
175
+ pydantic_core==2.33.2
176
+ pydub==0.25.1
177
+ Pygments==2.18.0
178
+ pyparsing==3.2.0
179
+ python-dateutil==2.9.0.post0
180
+ python-dotenv==1.0.1
181
+ python-Levenshtein==0.26.1
182
+ python-magic==0.4.27
183
+ python-multipart==0.0.20
184
+ pytz==2024.2
185
+ PyYAML==6.0.2
186
+ pyzmq==26.2.0
187
+ qwen-vl-utils==0.0.8
188
+ RapidFuzz==3.11.0
189
+ ray==2.40.0
190
+ referencing==0.35.1
191
+ regex==2024.11.6
192
+ requests==2.32.3
193
+ requests-toolbelt==1.0.0
194
+ retrying==1.3.4
195
+ rich==13.9.4
196
+ rouge-chinese==1.0.3
197
+ rouge_score==0.1.2
198
+ rpds-py==0.22.3
199
+ ruff==0.11.9
200
+ s3transfer==0.10.4
201
+ safehttpx==0.1.6
202
+ safetensors==0.4.5
203
+ scikit-learn==1.6.1
204
+ scipy==1.14.1
205
+ seaborn==0.13.2
206
+ semantic-version==2.10.0
207
+ sentencepiece==0.2.0
208
+ shellingham==1.5.4
209
+ shtab==1.7.1
210
+ simplejson==3.20.1
211
+ six==1.17.0
212
+ smart-open==7.1.0
213
+ sniffio==1.3.1
214
+ soundfile==0.13.1
215
+ soxr==0.5.0.post1
216
+ spacy==3.8.7
217
+ spacy-legacy==3.0.12
218
+ spacy-loggers==1.0.5
219
+ spacy_pkuseg==1.0.0
220
+ squarify==0.4.4
221
+ srsly==2.5.1
222
+ sse-starlette==2.2.1
223
+ stack-data==0.6.3
224
+ starlette==0.41.3
225
+ sty==1.0.6
226
+ sympy==1.13.3
227
+ tabulate==0.9.0
228
+ termcolor==2.5.0
229
+ textdistance==4.6.3
230
+ thinc==8.3.6
231
+ threadpoolctl==3.6.0
232
+ tiktoken==0.7.0
233
+ timeout-decorator==0.5.0
234
+ timm==1.0.15
235
+ tokenizers==0.21.1
236
+ tomli==2.2.1
237
+ tomlkit==0.12.0
238
+ torch==2.4.0
239
+ torchvision==0.19.0
240
+ tqdm
241
+ traitlets==5.14.3
242
+ transformers==4.51.3
243
+ triton==3.0.0
244
+ trl==0.9.6
245
+ typer==0.15.1
246
+ typing-inspection==0.4.1
247
+ typing_extensions==4.12.2
248
+ tyro==0.8.14
249
+ tzdata==2024.2
250
+ urllib3==2.3.0
251
+ uvicorn==0.34.0
252
+ uvloop==0.21.0
253
+ validators==0.34.0
254
+ vllm==0.6.1
255
+ vllm-flash-attn==2.6.1
256
+ -e git+https://github.com/open-compass/VLMEvalKit.git@502578411f6cead71ef83930dcffea95e79d2356#egg=vlmeval
257
+ wasabi==1.1.3
258
+ watchfiles==1.0.3
259
+ wcwidth==0.2.13
260
+ weasel==0.4.1
261
+ websockets==12.0
262
+ wrapt==1.17.2
263
+ xformers==0.0.27.post2
264
+ XlsxWriter==3.2.2
265
+ xxhash==3.5.0
266
+ yarl==1.18.3
267
+ zh_core_web_sm @ https://github.com/explosion/spacy-models/releases/download/zh_core_web_sm-3.8.0/zh_core_web_sm-3.8.0-py3-none-any.whl#sha256=7de3bd267176b9b2a8defb6997c1cd296da16c57b5e712f72ea44a51755421c8
268
+ zipp==3.21.0