r-g2-2024 commited on
Commit
4adddcc
·
verified ·
1 Parent(s): 49d7413

Add files required for benchmark evaluation

Browse files
Files changed (7) hide show
  1. LICENSE.txt +56 -0
  2. annotation.csv +201 -0
  3. create_dataset_for_lmms-eval.ipynb +1561 -0
  4. jgraphqa.yaml +28 -0
  5. llava_onevision.py +814 -0
  6. source.csv +87 -0
  7. utils.py +262 -0
LICENSE.txt ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # For the main pipeline structure-related code, we maintain the original license provided with lm-evaluation-harness, which is the MIT License.
2
+
3
+ MIT License
4
+
5
+ Copyright (c) 2024 LMMs-Lab
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in all
15
+ copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ SOFTWARE.
24
+
25
+ # For the multimodal models and datasets that we have added (defined as code in the lmms_eval/tasks and lmms_eval/models folders), we apply the Apache License.
26
+
27
+ Apache 2.0 License
28
+
29
+ Copyright (c) 2024 LMMs-Lab
30
+
31
+ Licensed under the Apache License, Version 2.0 (the "License");
32
+ you may not use this file except in compliance with the License.
33
+ You may obtain a copy of the License at
34
+
35
+ http://www.apache.org/licenses/LICENSE-2.0
36
+
37
+ Unless required by applicable law or agreed to in writing, software
38
+ distributed under the License is distributed on an "AS IS" BASIS,
39
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
40
+ See the License for the specific language governing permissions and
41
+ limitations under the License.
42
+
43
+ When modifying the code, please include the following information about the original lmms-eval source:
44
+ # Adopted from lmms-eval from https://github.com/EvolvingLMMs-Lab/lmms-eval. Below is the original copyright:
45
+ #
46
+ # Licensed under the Apache License, Version 2.0 (the "License");
47
+ # you may not use this file except in compliance with the License.
48
+ # You may obtain a copy of the License at
49
+ #
50
+ # http://www.apache.org/licenses/LICENSE-2.0
51
+ #
52
+ # Unless required by applicable law or agreed to in writing, software
53
+ # distributed under the License is distributed on an "AS IS" BASIS,
54
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
55
+ # See the License for the specific language governing permissions and
56
+ # limitations under the License.
annotation.csv ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ id,type,question,answer,annotation_tag,x1,y1,x2,y2,width,height,image
2
+ 1,line,2022/3期の利益率は何%か,0.5,1-500/11359603927730a1c325f3_006.png,1828.31,480.24,2529.2,1379.13,2667.0,1500.0,
3
+ 2,line,2024/3期の利益率は2023/3期より何%上がったか?,1.3,1-500/11359603927730a1c325f3_006.png,1828.31,480.24,2529.2,1379.13,2667.0,1500.0,
4
+ 15,line,グラフのタイトルは何か,売上高2019年比推移,1-500/13da97c1bc2fb4e725d49d_010.png,521.73,199.58,1424.58,880.62,2667.0,1500.0,
5
+ 16,line,23.1Qから24.3Qではどのくらい数字が上がったか?,25.4,1-500/13da97c1bc2fb4e725d49d_010.png,521.73,199.58,1424.58,880.62,2667.0,1500.0,
6
+ 17,line,配当性向が最も低い年は?,2019年,1-500/141da1caf1c3b99f1ec4a9_026.png,79.64,195.83,2310.54,1562.31,2339.0,1654.0,
7
+ 18,line,2021年から2022年の配当性向は何%上がったか?,2.4,1-500/141da1caf1c3b99f1ec4a9_026.png,79.64,195.83,2310.54,1562.31,2339.0,1654.0,
8
+ 19,line,2020年の期末株価はいくらか?,1910円,1-500/141da1caf1c3b99f1ec4a9_036.png,1153.16,737.41,2198.42,1475.95,2339.0,1654.0,
9
+ 20,line,2021年から2022年にかけて株価はいくら下がったか?,359円,1-500/141da1caf1c3b99f1ec4a9_036.png,1153.16,737.41,2198.42,1475.95,2339.0,1654.0,
10
+ 21,line,ROE(%)が最も低い年は?,2020年,1-500/141da1caf1c3b99f1ec4a9_036.png,99.02,733.77,1143.16,1479.59,2339.0,1654.0,
11
+ 22,line,2021年から2023年のROE(%)の比率の差は何%か,0.7,1-500/141da1caf1c3b99f1ec4a9_036.png,99.02,733.77,1143.16,1479.59,2339.0,1654.0,
12
+ 27,line,縦軸の数値単位は何か。カタカナで記載せよ,パーセント,1-500/14cb03f0a9ef31ee990171_051.png,1462.83,230.3,2558.55,1342.19,2667.0,1500.0,
13
+ 28,line,赤色と黄色の2019年度比率の差は何%か,44,1-500/14cb03f0a9ef31ee990171_051.png,1462.83,230.3,2558.55,1342.19,2667.0,1500.0,
14
+ 29,line,専業主婦世帯は1981年以降増加したか、減少したか?,減少,1-500/14cb03f0a9ef31ee990171_051.png,64.96,216.34,1325.52,1278.9,2667.0,1500.0,
15
+ 30,line,黄色の折れ線は何を示しているか,専業主婦世帯,1-500/14cb03f0a9ef31ee990171_051.png,64.96,216.34,1325.52,1278.9,2667.0,1500.0,
16
+ 33,line,人口が最も低い年は何年か?,2040年,1-500/14cb03f0a9ef31ee990171_052.png,114.56,217.6,1241.37,1225.38,2667.0,1500.0,
17
+ 34,line,右の縦軸は何を表しているか,世帯人員,1-500/14cb03f0a9ef31ee990171_052.png,114.56,217.6,1241.37,1225.38,2667.0,1500.0,
18
+ 39,line,商業地の価格が最も高い年はいつか,2023年,1-500/14cb03f0a9ef31ee990171_054.png,1442.38,233.19,2504.43,1185.41,2667.0,1500.0,
19
+ 40,line,青色の折れ線は何を示しているか,住宅地,1-500/14cb03f0a9ef31ee990171_054.png,1442.38,233.19,2504.43,1185.41,2667.0,1500.0,
20
+ 41,line,2011年の一戸建ての1㎡あたりの工事費はいくら(千円)か?,174,1-500/14cb03f0a9ef31ee990171_054.png,118.66,232.51,1227.14,1175.33,2667.0,1500.0,
21
+ 42,line,2017年の一戸建てとマンションの差額はいくら(千円)か?,153,1-500/14cb03f0a9ef31ee990171_054.png,118.66,232.51,1227.14,1175.33,2667.0,1500.0,
22
+ 47,line,2015年の世帯年収はいくつ(千円)か,8934,1-500/14cb03f0a9ef31ee990171_057.png,1387.68,241.34,2589.44,1216.56,2667.0,1500.0,
23
+ 48,line,オレンジ色の折れ線は何を指しているか,世帯年収,1-500/14cb03f0a9ef31ee990171_057.png,1387.68,241.34,2589.44,1216.56,2667.0,1500.0,
24
+ 49,line,赤の折れ線グラフは何を表しているか,大企業/建設,1-500/14cb03f0a9ef31ee990171_061.png,111.86,750.58,2511.33,1364.85,2667.0,1500.0,
25
+ 50,line,大企業/不動産で一番%が低いときは何年何月か,2009年3月,1-500/14cb03f0a9ef31ee990171_061.png,111.86,750.58,2511.33,1364.85,2667.0,1500.0,
26
+ 53,line,2024/3期のQ1のセグメント利益はいくら(百万円)か?,579,1-500/154f7e7eeb18abc07b54f9_008.png,108.49,350.4,1190.86,1139.23,2000.0,1500.0,
27
+ 54,line,2023/3期のセグメント利益のQ1とQ3の差はいくら(百万円)か?,255,1-500/154f7e7eeb18abc07b54f9_008.png,108.49,350.4,1190.86,1139.23,2000.0,1500.0,
28
+ 55,line,粗利益が最も低かった年は何年か?,2024年,1-500/15b05762aec8614cd46548_006.png,764.3,187.71,1958.38,976.01,2000.0,1125.0,
29
+ 56,line,2021年2Qと2022年3Qの粗利率の差は何%か?,1.8,1-500/15b05762aec8614cd46548_006.png,764.3,187.71,1958.38,976.01,2000.0,1125.0,
30
+ 59,line,青色の折れ線は何を表しているか?,売上高,1-500/170b36f8f22aec4d651d54_012.png,57.94,435.69,1165.36,1557.04,2339.0,1654.0,
31
+ 60,line,2023年9月ごろの客単価はおおよそ何%か?,140,1-500/170b36f8f22aec4d651d54_012.png,57.94,435.69,1165.36,1557.04,2339.0,1654.0,
32
+ 71,line,オレンジ色の線は何を表しているか,D/Eレシオ,1-500/184d24730e188a3782cde6_018.png,1221.32,650.5,2237.48,1430.96,2339.0,1654.0,
33
+ 72,line,2023年度の自己資本比率は前年度比で増加しているか、減少しているか,減少,1-500/184d24730e188a3782cde6_018.png,1221.32,650.5,2237.48,1430.96,2339.0,1654.0,
34
+ 73,line,預金利息の値は右���か左軸かどちらになるか?,右軸,1-500/193bb0d846a01088535a67_008.png,116.15,338.81,979.64,1308.01,2167.0,1500.0,
35
+ 74,line,2020/3から2021/3で預金利息は増加しているか、減少しているか,減少,1-500/193bb0d846a01088535a67_008.png,116.15,338.81,979.64,1308.01,2167.0,1500.0,
36
+ 75,line,黄緑色は何を表しているか,地銀平均,1-500/193bb0d846a01088535a67_008.png,1091.25,341.67,2006.29,779.23,2167.0,1500.0,
37
+ 76,line,当行の預金等利回りは2022/3から2023/3にかけて上昇しているか、横ばいか、下降しているか,横ばい,1-500/193bb0d846a01088535a67_008.png,1091.25,341.67,2006.29,779.23,2167.0,1500.0,
38
+ 83,line,オレンジ色の点線は何を表しているか,沖縄商業地,1-500/193bb0d846a01088535a67_047.png,145.33,391.54,1024.74,1306.58,2167.0,1500.0,
39
+ 84,line,2024年の沖縄住宅地の変動率はプラス何%か?,5.5,1-500/193bb0d846a01088535a67_047.png,145.33,391.54,1024.74,1306.58,2167.0,1500.0,
40
+ 93,line,赤い線は何を表しているか,ROE,1-500/19c5c51865c56cefa0117d_053.png,164.48,469.58,1741.43,1393.17,2000.0,1500.0,
41
+ 94,line,24/3期の経常利益率は前年比で上昇しているか、下降しているか,上昇,1-500/19c5c51865c56cefa0117d_053.png,164.48,469.58,1741.43,1393.17,2000.0,1500.0,
42
+ 99,line,順位が最下位の年は何年か?,2023年,1-500/2d8f98263a80904ecc9a84_027.png,1494.87,666.23,2755.48,1678.63,2845.0,2134.0,
43
+ 100,line,2017年から2018年にかけて順位が何位上がったか?,5,1-500/2d8f98263a80904ecc9a84_027.png,1494.87,666.23,2755.48,1678.63,2845.0,2134.0,
44
+ 107,bar,2022年2Qの売上高はいくら(百万円)か?,1082,1-500/2f258b9d14ae2438ad1d27_021.png,36.64,410.69,1004.83,1404.61,2000.0,1500.0,
45
+ 108,bar,2023年2Qと3Qの売上高の差はいくら(百万円)か?,146,1-500/2f258b9d14ae2438ad1d27_021.png,36.64,410.69,1004.83,1404.61,2000.0,1500.0,
46
+ 109,bar,2022年度の地銀平均は何%か?,16,1-500/2f3081ef18aebbeb549cce_010.png,1167.7,685.77,2135.13,972.55,2167.0,1500.0,
47
+ 110,bar,2019年度から4年間累計の地銀平均と群馬の比率の差は何%か?,14.1,1-500/2f3081ef18aebbeb549cce_010.png,1167.7,685.77,2135.13,972.55,2167.0,1500.0,
48
+ 113,line,オレンジのグラフは何を表しているのか,連結コア業務純益,1-500/2f3081ef18aebbeb549cce_010.png,79.96,980.47,2059.89,1489.31,2167.0,1500.0,
49
+ 114,line,2014/3期の連結純利益ベースはいくらか,42.58,1-500/2f3081ef18aebbeb549cce_010.png,79.96,980.47,2059.89,1489.31,2167.0,1500.0,
50
+ 115,line,利益率が最も低い年は何年何期か?,21/3期,1-500/2fcd4247dac0286a9c6a93_013.png,48.33,44.18,1826.31,1445.54,2667.0,1500.0,
51
+ 116,line,22/3期1Qと22/3期4Qの利益率の差は何%か?,5.3,1-500/2fcd4247dac0286a9c6a93_013.png,48.33,44.18,1826.31,1445.54,2667.0,1500.0,
52
+ 137,line,縦軸の最小値はいくつか?,100,1-500/3361d922cf953e40775aff_057.png,164.73,758.82,1863.71,1337.18,2000.0,1500.0,
53
+ 138,line,神戸市内中心3区で最も成約平均㎡単価が低いのはいつか?,20年5月,1-500/3361d922cf953e40775aff_057.png,164.73,758.82,1863.71,1337.18,2000.0,1500.0,
54
+ 153,line,折れ線グラフは何を表している?,アクティブシニア比率,1-500/36d565bb3cecd5bed6c356_007.png,165.38,495.31,1277.06,1258.24,2667.0,1500.0,
55
+ 154,line,FY24の3Qのアクティブシニア比率は何%か?,31.5,1-500/36d565bb3cecd5bed6c356_007.png,165.38,495.31,1277.06,1258.24,2667.0,1500.0,
56
+ 275,bar,単体が連結の値を上回りだしたのはFYいつからか?,2022,1-500/8f3c47f72a0bd0a74a9248_011.png,108.0,422.16,943.33,1093.91,2167.0,1500.0,
57
+ 276,bar,FY2023の単体の値を答えよ。,54,1-500/8f3c47f72a0bd0a74a9248_011.png,108.0,422.16,943.33,1093.91,2167.0,1500.0,
58
+ 433,bar,人件費と物件費の差が最も大きかったのはいつか,2023/9期,1001-1500/7c7492bfd27e9ce500cdcb_019.png,196.95,534.63,1153.21,1450.82,2339.0,1654.0,
59
+ 434,bar,オレンジ色の項目は何を表しているか,税金,1001-1500/7c7492bfd27e9ce500cdcb_019.png,196.95,534.63,1153.21,1450.82,2339.0,1654.0,
60
+ 461,bar,この「市場規模」の棒グラフの単位は何か?,億円,1989ec528ade15352db518_034.png,163.74,252.36,808.07,1218.72,2667.0,1500.0,
61
+ 462,bar,2022年3月期の市場規模はいくら(億円)か?,307,1989ec528ade15352db518_034.png,163.74,252.36,808.07,1218.72,2667.0,1500.0,
62
+ 463,circle,このグラフの青は何の割合か?,ラクス,1989ec528ade15352db518_034.png,1069.38,374.92,1612.76,1082.87,2667.0,1500.0,
63
+ 464,circle,C社の占める割合は何%か?,37,1989ec528ade15352db518_034.png,1069.38,374.92,1612.76,1082.87,2667.0,1500.0,
64
+ 465,circle,このグラフのラクスを除いた合計の割合は何%か?,59,1989ec528ade15352db518_034.png,1800.39,369.53,2390.29,1078.35,2667.0,1500.0,
65
+ 466,circle,このグラフは何を示しているか?,累計導入社数,1989ec528ade15352db518_034.png,1800.39,369.53,2390.29,1078.35,2667.0,1500.0,
66
+ 477,circle,直接受注の比率は何%か?,41,1e361ea46ac9d76aada84b_015.png,1192.75,511.06,2215.53,1598.13,2339.0,1653.0,
67
+ 478,circle,構成比の中で3番目に多い事業は?,銀行紹介,1e361ea46ac9d76aada84b_015.png,1192.75,511.06,2215.53,1598.13,2339.0,1653.0,
68
+ 481,circle,比率が最も高い資産はどれか?,販売用不動産及び仕掛販売用不動産,1e971a732d54ae699ceb30_017.png,1362.51,473.91,2529.78,1354.65,2667.0,1500.0,
69
+ 482,circle,現金及び預金の比率は何%か?,30,1e971a732d54ae699ceb30_017.png,1362.51,473.91,2529.78,1354.65,2667.0,1500.0,
70
+ 489,circle,当社のCO2排出量の内、45%を占めているのはどれか?,電力,1fb739a2f8488ffbe58a14_030.png,1094.65,158.54,1737.86,827.08,2000.0,1500.0,
71
+ 490,circle,「石炭コークス」と「電力」では何パーセントの差があるか?,29,1fb739a2f8488ffbe58a14_030.png,1094.65,158.54,1737.86,827.08,2000.0,1500.0,
72
+ 503,bar,2023年の「冷凍食品」と「常温食品」では何億円の差があるか?,133,6036990c41c174cf7f3fe6_036.png,70.92,386.62,826.5,1395.02,2000.0,1500.0,
73
+ 504,bar,オレンジのグラフは何の割合を表しているか?,常温食品,6036990c41c174cf7f3fe6_036.png,70.92,386.62,826.5,1395.02,2000.0,1500.0,
74
+ 505,circle,固定金利の割合は何%か,55,692ee4d0b17fef611f0a33_043.png,1632.18,595.99,2392.92,1378.39,2667.0,1500.0,
75
+ 506,circle,固定金利と変動金利のどちらの割合が高いか,固定金利,692ee4d0b17fef611f0a33_043.png,1632.18,595.99,2392.92,1378.39,2667.0,1500.0,
76
+ 509,bar,グラフ内のオレンジの項目はなにか,Mマート,6af889640c1db3a0b12f42_013.png,108.63,544.83,1296.94,1361.96,2000.0,1500.0,
77
+ 510,bar,Mマートの2020/1期1Qの数値と2024/1期1Qの数値ではどちらが売り上げが高いか,2024/1期1Q,6af889640c1db3a0b12f42_013.png,108.63,544.83,1296.94,1361.96,2000.0,1500.0,
78
+ 511,circle,このグラフは何年のものか,2024年,6af889640c1db3a0b12f42_013.png,1397.24,300.26,1813.75,767.64,2000.0,1500.0,
79
+ 512,circle,黄色の項目は何か,その他,6af889640c1db3a0b12f42_013.png,1397.24,300.26,1813.75,767.64,2000.0,1500.0,
80
+ 517,circle,海外売上高比率は何%か?,69.4,6fb3a85950d29981ee8d26_012.png,1662.2,193.28,2563.69,1263.12,2667.0,1500.0,
81
+ 518,circle,アジアと米州ではどのくらいパーセントの差があるか?,0.1,6fb3a85950d29981ee8d26_012.png,1662.2,193.28,2563.69,1263.12,2667.0,1500.0,
82
+ 529,circle,海外売上高は何億円か?,796,720e3023878d51d4680323_006.png,1522.15,140.35,2654.04,1431.9,2667.0,1500.0,
83
+ 530,circle,アジア州他の売上高は何%下がったか?,1.2,720e3023878d51d4680323_006.png,1522.15,140.35,2654.04,1431.9,2667.0,1500.0,
84
+ 533,circle,灰色の項目は何か,地域金融機関,73768b18aa28f337b9a66e_037.png,1119.72,344.92,2094.8,1119.42,2167.0,1500.0,
85
+ 534,circle,年金は何%か,20.7,73768b18aa28f337b9a66e_037.png,1119.72,344.92,2094.8,1119.42,2167.0,1500.0,
86
+ 537,circle,オレンジ色が表す項目を答えよ,食品,799504937eb4fae1f3d0e1_015.png,1606.39,331.2,2241.89,1058.55,2339.0,1654.0,
87
+ 538,circle,最も割合が多い業界はどこか,ファッション,799504937eb4fae1f3d0e1_015.png,1606.39,331.2,2241.89,1058.55,2339.0,1654.0,
88
+ 543,bar,相談件数は年々増加しているか、減少しているか,増加,825c06c9748934418136e8_026.png,161.14,328.86,1334.66,1424.45,2667.0,1500.0,
89
+ 544,bar,2024年第1Qと2023年第2Qとで相談件数は何件上昇しているか,26件,825c06c9748934418136e8_026.png,161.14,328.86,1334.66,1424.45,2667.0,1500.0,
90
+ 553,circle,24/3期の連結売上高はいくら(百万円)か,24098,866a8a62d3bda046cd4057_039.png,1258.36,224.1,1956.56,1309.16,2167.0,1500.0,
91
+ 554,circle,円グラフの割合が少ない項目は何か,コプロテクノロジー,866a8a62d3bda046cd4057_039.png,1258.36,224.1,1956.56,1309.16,2167.0,1500.0,
92
+ 557,circle,23.9期末 管理戸数は何戸か,22568,8a80b7d406c2bff66ef8b5_019.png,1209.2,210.6,2137.62,1190.04,2167.0,1500.0,
93
+ 558,circle,東海・日立の管理戸数は東京のおよそ何倍か。整数で答えよ,2,8a80b7d406c2bff66ef8b5_019.png,1209.2,210.6,2137.62,1190.04,2167.0,1500.0,
94
+ 561,bar,FY2022の新卒採用数は何人か?,142人,9044be4bca6d19c644bc1e_011.png,127.82,573.51,936.29,1428.73,2167.0,1500.0,
95
+ 562,bar,FY2023からFY2024にかけて新卒、中途合わせて何人増える計画になるのか?,73人,9044be4bca6d19c644bc1e_011.png,127.82,573.51,936.29,1428.73,2167.0,1500.0,
96
+ 563,circle,円グラフの青色の数値はいくつか,52.1,9082633c6abe7a7036af2c_040.png,1365.78,675.2,1828.99,1235.71,2000.0,1500.0,
97
+ 564,circle,赤と青の比率の差は何%か,4.2,9082633c6abe7a7036af2c_040.png,1365.78,675.2,1828.99,1235.71,2000.0,1500.0,
98
+ 565,bar,FY23の1Qの従業員数は何人か?,80人,9082633c6abe7a7036af2c_040.png,164.37,672.26,1259.07,1323.68,2000.0,1500.0,
99
+ 566,bar,FY24の2Qから3Qにかけて何人増えたか?,3人,9082633c6abe7a7036af2c_040.png,164.37,672.26,1259.07,1323.68,2000.0,1500.0,
100
+ 569,bar,当社の三大都市圏外は何%か,75,9144b6564a3cdbe6175c99_046.png,109.1,278.8,1905.34,773.96,2000.0,1500.0,
101
+ 570,bar,C社の三大都市圏とD社の三大都市圏の比率の差は何%か,17,9144b6564a3cdbe6175c99_046.png,109.1,278.8,1905.34,773.96,2000.0,1500.0,
102
+ 571,circle,売上高構成比の過半数を占めている項目を答えよ。,福田組,9559b5b3666430666ce6ac_004.png,1374.02,322.82,2247.23,1145.08,2339.0,1654.0,
103
+ 572,circle,その他の売上高構成比は何%か,25.8,9559b5b3666430666ce6ac_004.png,1374.02,322.82,2247.23,1145.08,2339.0,1654.0,
104
+ 573,bar,福田道路売上の売上高が300億円を下回った年は何年と何年か,2019年と2023年,9559b5b3666430666ce6ac_004.png,103.85,493.01,1194.25,1141.79,2339.0,1654.0,
105
+ 574,bar,2023年のその他売上の売上高は何億円か。,436,9559b5b3666430666ce6ac_004.png,103.85,493.01,1194.25,1141.79,2339.0,1654.0,
106
+ 575,bar,2022年度の高付加価値品の割合は何%か,36,a0d9f3d0568a96c2c69a78_006.png,72.68,975.16,993.38,1407.65,2000.0,1500.0,
107
+ 576,bar,一番右の棒グラフは何年度を表しているか,2023年度,a0d9f3d0568a96c2c69a78_006.png,72.68,975.16,993.38,1407.65,2000.0,1500.0,
108
+ 583,circle,その他フリーWi-Fiの値は何%か,10,a59f14cea6a19e50bcfa0e_010.png,1145.63,434.5,2108.28,1290.18,2167.0,1500.0,
109
+ 584,circle,このグラフで一番%の値が大きい項目はなにか,フリーWi-Fi,a59f14cea6a19e50bcfa0e_010.png,1145.63,434.5,2108.28,1290.18,2167.0,1500.0,
110
+ 585,bar,全社の女性比率は何%か,36,abba4faad8b25cea956d9a_057.png,65.5,386.19,1245.74,1180.36,2667.0,1500.0,
111
+ 586,bar,最も濃いグレーは何を表しているか,日本の男性,abba4faad8b25cea956d9a_057.png,65.5,386.19,1245.74,1180.36,2667.0,1500.0,
112
+ 587,circle,日本国籍は何%か,65,abba4faad8b25cea956d9a_057.png,1400.32,384.11,2591.49,1150.7,2667.0,1500.0,
113
+ 588,circle,円グラフの水色が指している項目は何か,外国籍,abba4faad8b25cea956d9a_057.png,1400.32,384.11,2591.49,1150.7,2667.0,1500.0,
114
+ 595,circle,店舗事業の値はいくつか,138,b5dac8aeea6adb09f998d1_050.png,1411.64,337.8,2311.55,1169.16,2520.0,1418.0,
115
+ 596,circle,三番目に割合が多い項目は何か,商品・販売戦略本部,b5dac8aeea6adb09f998d1_050.png,1411.64,337.8,2311.55,1169.16,2520.0,1418.0,
116
+ 597,bar,販売用不動産が最も多いのは何年か,2023年,b9a5e74bca727f9823dd24_021.png,60.55,225.03,924.48,887.3,2000.0,1500.0,
117
+ 598,bar,棒グラフの赤色は何を表しているか,仕掛販売用不動産,b9a5e74bca727f9823dd24_021.png,60.55,225.03,924.48,887.3,2000.0,1500.0,
118
+ 599,circle,2022/12の住宅系の件数は何件か,37件,b9a5e74bca727f9823dd24_021.png,1027.78,222.51,1984.75,909.99,2000.0,1500.0,
119
+ 600,circle,ホテル・宿泊関連は、2022/12から2023/12にかけて何件減少したか,2件,b9a5e74bca727f9823dd24_021.png,1027.78,222.51,1984.75,909.99,2000.0,1500.0,
120
+ 603,circle,建設・土木工事以外が占める割合は約何%か,60,bd0d8ccc4b4e8a2fa3aab1_081.png,1416.34,301.58,2537.34,1304.3,2662.0,1498.0,
121
+ 604,circle,建設・土木工事が占める割合は約何%か,40,bd0d8ccc4b4e8a2fa3aab1_081.png,1416.34,301.58,2537.34,1304.3,2662.0,1498.0,
122
+ 605,bar,このグラフのタイトルはなにか,受注残高推移,c0947ec7c71c42ed77d07d_005.png,41.58,494.01,1141.86,1406.52,2339.0,1654.0,
123
+ 606,bar,2022年9月の陸上用(海外)の受注残高はいくら(百万円)か,745,c0947ec7c71c42ed77d07d_005.png,41.58,494.01,1141.86,1406.52,2339.0,1654.0,
124
+ 607,circle,最も大きい割合を占める項目は何か,中小型機関,c0947ec7c71c42ed77d07d_005.png,1196.06,494.7,2298.09,1412.47,2339.0,1654.0,
125
+ 608,circle,大型機関は何%か,33,c0947ec7c71c42ed77d07d_005.png,1196.06,494.7,2298.09,1412.47,2339.0,1654.0,
126
+ 609,bar,このグラフのタイトルはなにか,取引自治体数の推移,c0b2ff883a7f9b2588fd5d_038.png,96.62,605.48,1325.4,1259.68,2167.0,1500.0,
127
+ 610,bar,24/3の取引自治体数はいくつか,467,c0b2ff883a7f9b2588fd5d_038.png,96.62,605.48,1325.4,1259.68,2167.0,1500.0,
128
+ 627,bar,青い棒グラフが指している項目はなにか,スプレッド,r1/GMOペイメントゲートウェイ_2022年9月期_ページ11.jpg,75.68,391.31,1587.89,1355.33,2167.0,1500.0,
129
+ 628,bar,21/単4Qと22/単4Qを比べてイニシャルはどちらが数値が高いか,22/単4Q,r1/GMOペイメントゲートウェイ_2022年9月期_ページ11.jpg,75.68,391.31,1587.89,1355.33,2167.0,1500.0,
130
+ 639,bar,白抜きの点線の棒グラフは何を指しているか,社内目標,r1/GMOペイメントゲートウェイ_2022年9月期_ページ18.jpg,74.67,336.03,1000.55,1370.63,2167.0,1500.0,
131
+ 640,bar,18/9から25/9にかけて、棒グラフは右上がりか右下がりどちらか,右上がり,r1/GMOペイメントゲートウェイ_2022年9月期_ページ18.jpg,74.67,336.03,1000.55,1370.63,2167.0,1500.0,
132
+ 657,circle,青色の項目は何を指しているか,クレジットカード,r1/GMOペイメントゲートウェイ_2022年9月期_ページ26.jpg,1105.16,506.9,2005.77,994.96,2167.0,1500.0,
133
+ 658,circle,キャリア決済の利用率は何%か,8.5,r1/GMOペイメントゲートウェイ_2022年9月期_ページ26.jpg,1105.16,506.9,2005.77,994.96,2167.0,1500.0,
134
+ 661,table,インドネシアの2行目の項目は何か,コンビニ決済早払い,r1/GMOペイメントゲートウェイ_2022年9月期_ページ27.jpg,92.02,755.37,986.22,1378.1,2167.0,1500.0,
135
+ 662,table,アメリカの3行目の項目は何か,SME向け購買オーダーファイナンス,r1/GMOペイメントゲートウェイ_2022年9月期_ページ27.jpg,92.02,755.37,986.22,1378.1,2167.0,1500.0,
136
+ 669,bar,青色の項目は何を指しているか,Scope2,r1/GMOペイメントゲートウェイ_2022年9月期_ページ30.jpg,1313.07,747.87,2054.08,1241.87,2167.0,1500.0,
137
+ 670,bar,21/9の数値はいくつか,1883,r1/GMOペイメントゲートウェイ_2022年9月期_ページ30.jpg,1313.07,747.87,2054.08,1241.87,2167.0,1500.0,
138
+ 671,bar,20/4Q末の自己資本比率は何%か,16.5,r1/GMOペイメントゲートウェイ_2022年9月期_ページ33.jpg,1122.17,337.24,2101.23,1307.75,2167.0,1500.0,
139
+ 672,bar,紫色のグラフが表している情報項目は何か,有利子負債,r1/GMOペイメントゲートウェイ_2022年9月期_ページ33.jpg,1122.17,337.24,2101.23,1307.75,2167.0,1500.0,
140
+ 673,bar,黄色のグラフで表されている情報項目は何か,MSB関連,r1/GMOペイメントゲートウェイ_2022年9月期_ページ33.jpg,64.21,337.24,1117.91,1309.89,2167.0,1500.0,
141
+ 674,bar,22/4Q末の現金及び現金同等物の数値はいくつか,113967,r1/GMOペイメントゲートウェイ_2022年9月期_ページ33.jpg,64.21,337.24,1117.91,1309.89,2167.0,1500.0,
142
+ 677,bar,21/単4Qと22/単4Qの差額は何億円か,22,r1/GMOペイメントゲートウェイ_2022年9月期_ページ35.jpg,59.51,353.47,2099.0,1357.86,2167.0,1500.0,
143
+ 678,bar,GMO-PSに該当するのは何の情報項目か,後払い,r1/GMOペイメントゲートウェイ_2022年9月期_ページ35.jpg,59.51,353.47,2099.0,1357.86,2167.0,1500.0,
144
+ 681,bar,営業利益の増減要因の中で、粗利増となった最も大きい要因は何か,増収効果,r1/GMOペイメントゲートウェイ_2022年9月期_ページ36.jpg,67.33,334.18,1009.26,1432.25,2167.0,1500.0,
145
+ 682,bar,グラフの数値の単位は何か,百万円,r1/GMOペイメントゲートウェイ_2022年9月期_ページ36.jpg,67.33,334.18,1009.26,1432.25,2167.0,1500.0,
146
+ 685,bar,緑色のグラフで表されている情報項目は何か,ストック,r1/GMOペイメントゲートウェイ_2022年9月期_ページ38.jpg,67.64,297.13,2072.74,1428.68,2167.0,1500.0,
147
+ 686,bar,22/1Qのストックはいくら(百万円)か,1851,r1/GMOペイメントゲートウェイ_2022年9月期_ページ38.jpg,67.64,297.13,2072.74,1428.68,2167.0,1500.0,
148
+ 739,table,22/3期の売上収益は何億円か。,14286,r1/LIXIL_2023年3月期_ページ05.jpg,78.3,54.92,1551.52,864.28,1654.0,2339.0,
149
+ 740,table,通期の隣、右側部分の薄いオレンジ色の表はいつの業績結果を表しているか。,第4四半期3ヵ月,r1/LIXIL_2023年3月期_ページ05.jpg,78.3,54.92,1551.52,864.28,1654.0,2339.0,
150
+ 767,table,設置箇所の合計はいくつか,248,r1/SBIホールディングス_2023年3月期_ページ117.jpg,421.94,700.51,1713.68,1399.22,2000.0,1500.0,
151
+ 768,table,道の駅の急速充電器の設置数はいくつか,281,r1/SBIホールディングス_2023年3月期_ページ117.jpg,421.94,700.51,1713.68,1399.22,2000.0,1500.0,
152
+ 771,table,ヤマダHDの業種はなにか,小売,r1/SBIホールディングス_2023年3月期_ページ120.jpg,55.98,262.61,1932.96,1457.7,2000.0,1500.0,
153
+ 772,table,一番右の列の項目はなにか,顧客基盤,r1/SBIホールディングス_2023年3月期_ページ120.jpg,55.98,262.61,1932.96,1457.7,2000.0,1500.0,
154
+ 773,table,京王電鉄の業種はなにか,鉄道旅客,r1/SBIホールディングス_2023年3月期_ページ121.jpg,58.87,236.31,1932.04,1316.88,2000.0,1500.0,
155
+ 774,table,右から2番目の列の項目はなにか,サービス開始,r1/SBIホールディングス_2023年3月期_ページ121.jpg,58.87,236.31,1932.04,1316.88,2000.0,1500.0,
156
+ 781,table,非課税保有期間はどのくらいか,無期限,r1/SBIホールディングス_2023年3月期_ページ129.jpg,98.59,377.23,1901.98,1037.21,2000.0,1500.0,
157
+ 782,table,一番右の列の項目はなにか,成長投資枠,r1/SBIホールディングス_2023年3月期_ページ129.jpg,98.59,377.23,1901.98,1037.21,2000.0,1500.0,
158
+ 797,table,2022年3月末の合計の数値はいくつか,17496,r1/SBIホールディングス_2023年3月期_ページ178.jpg,91.28,1026.67,1910.03,1331.02,2000.0,1500.0,
159
+ 798,table,このグラフのタイトルを答えよ,連結従業員数推移,r1/SBIホールディングス_2023年3月期_ページ178.jpg,91.28,1026.67,1910.03,1331.02,2000.0,1500.0,
160
+ 803,table,2022年3月期の営業利益の数値はいくつか,61920,r1/SBIホールディングス_2023年3月期_ページ19.jpg,49.02,130.79,1905.1,1426.52,2000.0,1500.0,
161
+ 804,table,営業収益の増減率はプラスいくつか,5.1,r1/SBIホールディングス_2023年3月期_ページ19.jpg,49.02,130.79,1905.1,1426.52,2000.0,1500.0,
162
+ 813,table,表の一番右側の項目は何か。,前期比増減率,r1/SBIホールディングス_2023年3月期_ページ24.jpg,150.66,279.06,1879.86,621.87,2000.0,1500.0,
163
+ 814,table,営業利益が過去最高となったの何年何月期か。,2023年3月期,r1/SBIホールディングス_2023年3月期_ページ24.jpg,150.66,279.06,1879.86,621.87,2000.0,1500.0,
164
+ 839,table,2023年3月期累計の連結業績(J-GAAP)の表の単位はなにか,百万円,r1/SBIホールディングス_2023年3月期_ページ43.jpg,47.15,350.25,1955.62,1298.24,2000.0,1500.0,
165
+ 840,table,2023年3月期累計の連結業績(J-GAAP)の表の中央下の数値はなにか,1240,r1/SBIホールディングス_2023年3月期_ページ43.jpg,47.15,350.25,1955.62,1298.24,2000.0,1500.0,
166
+ 845,table,2022年3月期の収益はいくら(百万円)か,177911,r1/SBIホールディングス_2023年3月期_ページ47.jpg,75.38,429.65,1830.93,1074.98,2000.0,1500.0,
167
+ 846,table,表の単位はなにか,百万円,r1/SBIホールディングス_2023年3月期_ページ47.jpg,75.38,429.65,1830.93,1074.98,2000.0,1500.0,
168
+ 847,table,この表の一番左の列の項目はなにか,EXIT時期,r1/SBIホールディングス_2023年3月期_ページ48.jpg,57.57,489.39,1902.33,1462.49,2000.0,1500.0,
169
+ 848,table,EXIT時期が2022年6月8日の投資先名はなにか,ANYCOLOR株式会社,r1/SBIホールディングス_2023年3月期_ページ48.jpg,57.57,489.39,1902.33,1462.49,2000.0,1500.0,
170
+ 851,table,表のタイトルはなにか,2023年3月期連結業績,r1/SBIホールディングス_2023年3月期_ページ50.jpg,64.85,281.37,1934.17,1185.46,2000.0,1500.0,
171
+ 852,table,売上高の前期比増減率はプラス何%か,33.9,r1/SBIホールディングス_2023年3月期_ページ50.jpg,64.85,281.37,1934.17,1185.46,2000.0,1500.0,
172
+ 853,table,収益(売上高)の前期比増減率はマイナス何%か,45,r1/SBIホールディングス_2023年3月期_ページ51.jpg,31.78,342.65,1871.62,763.45,2000.0,1500.0,
173
+ 854,table,この表の数値の単位は何か,百万円,r1/SBIホールディングス_2023年3月期_ページ51.jpg,31.78,342.65,1871.62,763.45,2000.0,1500.0,
174
+ 855,table,2022年3月期の収益(売上高)はいくら(百万円)か,23596,r1/SBIホールディングス_2023年3月期_ページ52.jpg,160.45,390.39,1785.9,880.6,2000.0,1500.0,
175
+ 856,table,表の一番下の行の項目名は何か,税引前利益,r1/SBIホールディングス_2023年3月期_ページ52.jpg,160.45,390.39,1785.9,880.6,2000.0,1500.0,
176
+ 867,table,2021年6月の施策内容はなにか,金・銀・プラチナ取引手数料改定,r1/SBIホールディングス_2023年3月期_ページ62.jpg,38.45,344.71,1957.0,1352.5,2000.0,1500.0,
177
+ 868,table,左の列の項目はなにか,リリース時期,r1/SBIホールディングス_2023年3月期_ページ62.jpg,38.45,344.71,1957.0,1352.5,2000.0,1500.0,
178
+ 883,table,一番左の項目は何か,社名,r1/SBIホールディングス_2023年3月期_ページ77.jpg,48.87,401.46,1013.74,1492.68,2000.0,1500.0,
179
+ 884,table,楽天の関与率は何%か,68.8,r1/SBIホールディングス_2023年3月期_ページ77.jpg,48.87,401.46,1013.74,1492.68,2000.0,1500.0,
180
+ 917,table,一番右の列の項目は何か,増減率,r1/SCSK_2023年3月期_ページ12.jpg,226.59,178.72,2425.9,1451.45,2667.0,1500.0,
181
+ 918,table,23年3月期実績(A)の営業利益率は何%か,11.5,r1/SCSK_2023年3月期_ページ12.jpg,226.59,178.72,2425.9,1451.45,2667.0,1500.0,
182
+ 919,table,システム開発(下段:第4四半期期間)のグラフの22年3月期の受注残高はいくら(百万円)か,40657,r1/SCSK_2023年3月期_ページ14.jpg,452.74,188.97,2241.28,852.25,2667.0,1500.0,
183
+ 920,table,システム開発(下段:第4四半期期間)のグラフの一番右の列の項目はなにか,増減率,r1/SCSK_2023年3月期_ページ14.jpg,452.74,188.97,2241.28,852.25,2667.0,1500.0,
184
+ 935,table,2022/3月期末、2023年3月期末の財務活動によるキャッシュ・フローはプラス、マイナスのどちらか。,マイナス,r1/SGホールディングス_2023年3月期_ページ09.jpg,104.18,289.13,2077.58,1540.44,2200.0,1700.0,
185
+ 936,table,873という数値は何を表しているか。,現金及び現金同等物の期末残高,r1/SGホールディングス_2023年3月期_ページ09.jpg,104.18,289.13,2077.58,1540.44,2200.0,1700.0,
186
+ 967,table,一番下の行に記されている項目は何か,親会社株主に帰属する当期純利益,r1/TBSホールディングス_2023年3月期_ページ06.jpg,209.25,312.24,2441.87,845.2,2667.0,1500.0,
187
+ 968,table,営業利益の増減率は何%か,2.1,r1/TBSホールディングス_2023年3月期_ページ06.jpg,209.25,312.24,2441.87,845.2,2667.0,1500.0,
188
+ 997,table,右から2番目の列の項目は何か,配当性向,r1/TBSホールディングス_2023年3月期_ページ24.jpg,51.89,565.38,1650.8,1324.94,2667.0,1500.0,
189
+ 998,table,2017年度の配当性向は何%か,30.5,r1/TBSホールディングス_2023年3月期_ページ24.jpg,51.89,565.38,1650.8,1324.94,2667.0,1500.0,
190
+ 1001,table,2019年の自己株式取得額は何億円か,40億円,r1/TBSホールディングス_2023年3月期_ページ25.jpg,462.39,1219.94,2156.67,1465.67,2667.0,1500.0,
191
+ 1002,table,2022年の自己株式取得額は2019年と比べて増加しているか、減少しているか?,増加,r1/TBSホールディングス_2023年3月期_ページ25.jpg,462.39,1219.94,2156.67,1465.67,2667.0,1500.0,
192
+ 1007,table,一番右の列の項目はなにか,備考,r1/TBSホールディングス_2023年3月期_ページ34.jpg,44.25,191.28,2641.92,1353.89,2667.0,1500.0,
193
+ 1008,table,2023/4/28公開の映画はなにか,劇場版TOKYOMER,r1/TBSホールディングス_2023年3月期_ページ34.jpg,44.25,191.28,2641.92,1353.89,2667.0,1500.0,
194
+ 1009,table,流動負債の前年比数値はプラスいくら(百万円)か,28467,r1/TBSホールディングス_2023年3月期_ページ40.jpg,96.42,30.14,2414.03,1399.14,2667.0,1500.0,
195
+ 1010,table,自己資本は前年と比較し増加しているか、減少しているか,減少,r1/TBSホールディングス_2023年3月期_ページ40.jpg,96.42,30.14,2414.03,1399.14,2667.0,1500.0,
196
+ 1031,circle,円グラフの赤い項目は何か,カード,r1/TIS_2023年3月期_ページ09.jpg,244.19,812.4,1808.88,1439.27,2000.0,1500.0,
197
+ 1032,circle,2023年3月期の保険の数値は何%か,6.1,r1/TIS_2023年3月期_ページ09.jpg,244.19,812.4,1808.88,1439.27,2000.0,1500.0,
198
+ 1311,circle,地域別累積投資比率ではどの国が一番割合を占めているか。,日本,r1/アイシン_2023年3月期_ページ14.jpg,1605.56,208.83,2620.52,1216.29,2667.0,1500.0,
199
+ 1312,circle,中国の数値は何%か,15,r1/アイシン_2023年3月期_ページ14.jpg,1605.56,208.83,2620.52,1216.29,2667.0,1500.0,
200
+ 1397,circle,2021年の社内取締役比率は何%か,54.5,r1/アズビル_2023年3月期_ページ53.jpg,1478.72,188.53,2465.13,798.98,2667.0,1500.0,
201
+ 1398,circle,2022年の社内取締役比率は何%か,33.3,r1/アズビル_2023年3月期_ページ53.jpg,1478.72,188.53,2465.13,798.98,2667.0,1500.0,
create_dataset_for_lmms-eval.ipynb ADDED
@@ -0,0 +1,1561 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 1,
6
+ "metadata": {},
7
+ "outputs": [],
8
+ "source": [
9
+ "import pandas as pd"
10
+ ]
11
+ },
12
+ {
13
+ "cell_type": "code",
14
+ "execution_count": 2,
15
+ "metadata": {},
16
+ "outputs": [
17
+ {
18
+ "data": {
19
+ "text/html": [
20
+ "<div>\n",
21
+ "<style scoped>\n",
22
+ " .dataframe tbody tr th:only-of-type {\n",
23
+ " vertical-align: middle;\n",
24
+ " }\n",
25
+ "\n",
26
+ " .dataframe tbody tr th {\n",
27
+ " vertical-align: top;\n",
28
+ " }\n",
29
+ "\n",
30
+ " .dataframe thead th {\n",
31
+ " text-align: right;\n",
32
+ " }\n",
33
+ "</style>\n",
34
+ "<table border=\"1\" class=\"dataframe\">\n",
35
+ " <thead>\n",
36
+ " <tr style=\"text-align: right;\">\n",
37
+ " <th></th>\n",
38
+ " <th>id</th>\n",
39
+ " <th>type</th>\n",
40
+ " <th>question</th>\n",
41
+ " <th>answer</th>\n",
42
+ " <th>annotation_tag</th>\n",
43
+ " <th>x1</th>\n",
44
+ " <th>y1</th>\n",
45
+ " <th>x2</th>\n",
46
+ " <th>y2</th>\n",
47
+ " <th>width</th>\n",
48
+ " <th>height</th>\n",
49
+ " <th>image</th>\n",
50
+ " </tr>\n",
51
+ " </thead>\n",
52
+ " <tbody>\n",
53
+ " <tr>\n",
54
+ " <th>0</th>\n",
55
+ " <td>1</td>\n",
56
+ " <td>line</td>\n",
57
+ " <td>2022/3期の利益率は何%か</td>\n",
58
+ " <td>0.5</td>\n",
59
+ " <td>1-500/11359603927730a1c325f3_006.png</td>\n",
60
+ " <td>1828.31</td>\n",
61
+ " <td>480.24</td>\n",
62
+ " <td>2529.20</td>\n",
63
+ " <td>1379.13</td>\n",
64
+ " <td>2667.0</td>\n",
65
+ " <td>1500.0</td>\n",
66
+ " <td>NaN</td>\n",
67
+ " </tr>\n",
68
+ " <tr>\n",
69
+ " <th>1</th>\n",
70
+ " <td>2</td>\n",
71
+ " <td>line</td>\n",
72
+ " <td>2024/3期の利益率は2023/3期より何%上がったか?</td>\n",
73
+ " <td>1.3</td>\n",
74
+ " <td>1-500/11359603927730a1c325f3_006.png</td>\n",
75
+ " <td>1828.31</td>\n",
76
+ " <td>480.24</td>\n",
77
+ " <td>2529.20</td>\n",
78
+ " <td>1379.13</td>\n",
79
+ " <td>2667.0</td>\n",
80
+ " <td>1500.0</td>\n",
81
+ " <td>NaN</td>\n",
82
+ " </tr>\n",
83
+ " <tr>\n",
84
+ " <th>2</th>\n",
85
+ " <td>15</td>\n",
86
+ " <td>line</td>\n",
87
+ " <td>グラフのタイトルは何か</td>\n",
88
+ " <td>売上高2019年比推移</td>\n",
89
+ " <td>1-500/13da97c1bc2fb4e725d49d_010.png</td>\n",
90
+ " <td>521.73</td>\n",
91
+ " <td>199.58</td>\n",
92
+ " <td>1424.58</td>\n",
93
+ " <td>880.62</td>\n",
94
+ " <td>2667.0</td>\n",
95
+ " <td>1500.0</td>\n",
96
+ " <td>NaN</td>\n",
97
+ " </tr>\n",
98
+ " <tr>\n",
99
+ " <th>3</th>\n",
100
+ " <td>16</td>\n",
101
+ " <td>line</td>\n",
102
+ " <td>23.1Qから24.3Qではどのくらい数字が上がったか?</td>\n",
103
+ " <td>25.4</td>\n",
104
+ " <td>1-500/13da97c1bc2fb4e725d49d_010.png</td>\n",
105
+ " <td>521.73</td>\n",
106
+ " <td>199.58</td>\n",
107
+ " <td>1424.58</td>\n",
108
+ " <td>880.62</td>\n",
109
+ " <td>2667.0</td>\n",
110
+ " <td>1500.0</td>\n",
111
+ " <td>NaN</td>\n",
112
+ " </tr>\n",
113
+ " <tr>\n",
114
+ " <th>4</th>\n",
115
+ " <td>17</td>\n",
116
+ " <td>line</td>\n",
117
+ " <td>配当性向が最も低い年は?</td>\n",
118
+ " <td>2019年</td>\n",
119
+ " <td>1-500/141da1caf1c3b99f1ec4a9_026.png</td>\n",
120
+ " <td>79.64</td>\n",
121
+ " <td>195.83</td>\n",
122
+ " <td>2310.54</td>\n",
123
+ " <td>1562.31</td>\n",
124
+ " <td>2339.0</td>\n",
125
+ " <td>1654.0</td>\n",
126
+ " <td>NaN</td>\n",
127
+ " </tr>\n",
128
+ " <tr>\n",
129
+ " <th>...</th>\n",
130
+ " <td>...</td>\n",
131
+ " <td>...</td>\n",
132
+ " <td>...</td>\n",
133
+ " <td>...</td>\n",
134
+ " <td>...</td>\n",
135
+ " <td>...</td>\n",
136
+ " <td>...</td>\n",
137
+ " <td>...</td>\n",
138
+ " <td>...</td>\n",
139
+ " <td>...</td>\n",
140
+ " <td>...</td>\n",
141
+ " <td>...</td>\n",
142
+ " </tr>\n",
143
+ " <tr>\n",
144
+ " <th>195</th>\n",
145
+ " <td>1032</td>\n",
146
+ " <td>circle</td>\n",
147
+ " <td>2023年3月期の保険の数値は何%か</td>\n",
148
+ " <td>6.1</td>\n",
149
+ " <td>r1/TIS_2023年3月期_ページ09.jpg</td>\n",
150
+ " <td>244.19</td>\n",
151
+ " <td>812.40</td>\n",
152
+ " <td>1808.88</td>\n",
153
+ " <td>1439.27</td>\n",
154
+ " <td>2000.0</td>\n",
155
+ " <td>1500.0</td>\n",
156
+ " <td>NaN</td>\n",
157
+ " </tr>\n",
158
+ " <tr>\n",
159
+ " <th>196</th>\n",
160
+ " <td>1311</td>\n",
161
+ " <td>circle</td>\n",
162
+ " <td>地域別累積投資比率ではどの国が一番割合を占めているか。</td>\n",
163
+ " <td>日本</td>\n",
164
+ " <td>r1/アイシン_2023年3月期_ページ14.jpg</td>\n",
165
+ " <td>1605.56</td>\n",
166
+ " <td>208.83</td>\n",
167
+ " <td>2620.52</td>\n",
168
+ " <td>1216.29</td>\n",
169
+ " <td>2667.0</td>\n",
170
+ " <td>1500.0</td>\n",
171
+ " <td>NaN</td>\n",
172
+ " </tr>\n",
173
+ " <tr>\n",
174
+ " <th>197</th>\n",
175
+ " <td>1312</td>\n",
176
+ " <td>circle</td>\n",
177
+ " <td>中国の数値は何%か</td>\n",
178
+ " <td>15</td>\n",
179
+ " <td>r1/アイシン_2023年3月期_ページ14.jpg</td>\n",
180
+ " <td>1605.56</td>\n",
181
+ " <td>208.83</td>\n",
182
+ " <td>2620.52</td>\n",
183
+ " <td>1216.29</td>\n",
184
+ " <td>2667.0</td>\n",
185
+ " <td>1500.0</td>\n",
186
+ " <td>NaN</td>\n",
187
+ " </tr>\n",
188
+ " <tr>\n",
189
+ " <th>198</th>\n",
190
+ " <td>1397</td>\n",
191
+ " <td>circle</td>\n",
192
+ " <td>2021年の社内取締役比率は何%か</td>\n",
193
+ " <td>54.5</td>\n",
194
+ " <td>r1/アズビル_2023年3月期_ページ53.jpg</td>\n",
195
+ " <td>1478.72</td>\n",
196
+ " <td>188.53</td>\n",
197
+ " <td>2465.13</td>\n",
198
+ " <td>798.98</td>\n",
199
+ " <td>2667.0</td>\n",
200
+ " <td>1500.0</td>\n",
201
+ " <td>NaN</td>\n",
202
+ " </tr>\n",
203
+ " <tr>\n",
204
+ " <th>199</th>\n",
205
+ " <td>1398</td>\n",
206
+ " <td>circle</td>\n",
207
+ " <td>2022年の社内取締役比率は何%か</td>\n",
208
+ " <td>33.3</td>\n",
209
+ " <td>r1/アズビル_2023年3月期_ページ53.jpg</td>\n",
210
+ " <td>1478.72</td>\n",
211
+ " <td>188.53</td>\n",
212
+ " <td>2465.13</td>\n",
213
+ " <td>798.98</td>\n",
214
+ " <td>2667.0</td>\n",
215
+ " <td>1500.0</td>\n",
216
+ " <td>NaN</td>\n",
217
+ " </tr>\n",
218
+ " </tbody>\n",
219
+ "</table>\n",
220
+ "<p>200 rows × 12 columns</p>\n",
221
+ "</div>"
222
+ ],
223
+ "text/plain": [
224
+ " id type question answer \\\n",
225
+ "0 1 line 2022/3期の利益率は何%か 0.5 \n",
226
+ "1 2 line 2024/3期の利益率は2023/3期より何%上がったか? 1.3 \n",
227
+ "2 15 line グラフのタイトルは何か 売上高2019年比推移 \n",
228
+ "3 16 line 23.1Qから24.3Qではどのくらい数字が上がったか? 25.4 \n",
229
+ "4 17 line 配当性向が最も低い年は? 2019年 \n",
230
+ ".. ... ... ... ... \n",
231
+ "195 1032 circle 2023年3月期の保険の数値は何%か 6.1 \n",
232
+ "196 1311 circle 地域別累積投資比率ではどの国が一番割合を占めているか。 日本 \n",
233
+ "197 1312 circle 中国の数値は何%か 15 \n",
234
+ "198 1397 circle 2021年の社内取締役比率は何%か 54.5 \n",
235
+ "199 1398 circle 2022年の社内取締役比率は何%か 33.3 \n",
236
+ "\n",
237
+ " annotation_tag x1 y1 x2 y2 \\\n",
238
+ "0 1-500/11359603927730a1c325f3_006.png 1828.31 480.24 2529.20 1379.13 \n",
239
+ "1 1-500/11359603927730a1c325f3_006.png 1828.31 480.24 2529.20 1379.13 \n",
240
+ "2 1-500/13da97c1bc2fb4e725d49d_010.png 521.73 199.58 1424.58 880.62 \n",
241
+ "3 1-500/13da97c1bc2fb4e725d49d_010.png 521.73 199.58 1424.58 880.62 \n",
242
+ "4 1-500/141da1caf1c3b99f1ec4a9_026.png 79.64 195.83 2310.54 1562.31 \n",
243
+ ".. ... ... ... ... ... \n",
244
+ "195 r1/TIS_2023年3月期_ページ09.jpg 244.19 812.40 1808.88 1439.27 \n",
245
+ "196 r1/アイシン_2023年3月期_ページ14.jpg 1605.56 208.83 2620.52 1216.29 \n",
246
+ "197 r1/アイシン_2023年3月期_ページ14.jpg 1605.56 208.83 2620.52 1216.29 \n",
247
+ "198 r1/アズビル_2023年3月期_ページ53.jpg 1478.72 188.53 2465.13 798.98 \n",
248
+ "199 r1/アズビル_2023年3月期_ページ53.jpg 1478.72 188.53 2465.13 798.98 \n",
249
+ "\n",
250
+ " width height image \n",
251
+ "0 2667.0 1500.0 NaN \n",
252
+ "1 2667.0 1500.0 NaN \n",
253
+ "2 2667.0 1500.0 NaN \n",
254
+ "3 2667.0 1500.0 NaN \n",
255
+ "4 2339.0 1654.0 NaN \n",
256
+ ".. ... ... ... \n",
257
+ "195 2000.0 1500.0 NaN \n",
258
+ "196 2667.0 1500.0 NaN \n",
259
+ "197 2667.0 1500.0 NaN \n",
260
+ "198 2667.0 1500.0 NaN \n",
261
+ "199 2667.0 1500.0 NaN \n",
262
+ "\n",
263
+ "[200 rows x 12 columns]"
264
+ ]
265
+ },
266
+ "execution_count": 2,
267
+ "metadata": {},
268
+ "output_type": "execute_result"
269
+ }
270
+ ],
271
+ "source": [
272
+ "annotation_df = pd.read_csv('annotation.csv')\n",
273
+ "annotation_df"
274
+ ]
275
+ },
276
+ {
277
+ "cell_type": "code",
278
+ "execution_count": null,
279
+ "metadata": {},
280
+ "outputs": [
281
+ {
282
+ "data": {
283
+ "text/html": [
284
+ "<div>\n",
285
+ "<style scoped>\n",
286
+ " .dataframe tbody tr th:only-of-type {\n",
287
+ " vertical-align: middle;\n",
288
+ " }\n",
289
+ "\n",
290
+ " .dataframe tbody tr th {\n",
291
+ " vertical-align: top;\n",
292
+ " }\n",
293
+ "\n",
294
+ " .dataframe thead th {\n",
295
+ " text-align: right;\n",
296
+ " }\n",
297
+ "</style>\n",
298
+ "<table border=\"1\" class=\"dataframe\">\n",
299
+ " <thead>\n",
300
+ " <tr style=\"text-align: right;\">\n",
301
+ " <th></th>\n",
302
+ " <th>annotation_tag</th>\n",
303
+ " <th>citation_source_url</th>\n",
304
+ " <th>citation_company_name</th>\n",
305
+ " <th>citation_file_name</th>\n",
306
+ " <th>citation_pdf_url</th>\n",
307
+ " <th>local_file_name</th>\n",
308
+ " <th>page_no</th>\n",
309
+ " </tr>\n",
310
+ " </thead>\n",
311
+ " <tbody>\n",
312
+ " <tr>\n",
313
+ " <th>0</th>\n",
314
+ " <td>1-500/11359603927730a1c325f3_006.png</td>\n",
315
+ " <td>https://www.yaginet.co.jp/ir/library/presentat...</td>\n",
316
+ " <td>株式会社ヤギ</td>\n",
317
+ " <td>2024年3月期 決算補足説明資料</td>\n",
318
+ " <td>https://data.swcms.net/file/yaginet-corp/dam/j...</td>\n",
319
+ " <td>140120240509587890.pdf</td>\n",
320
+ " <td>7</td>\n",
321
+ " </tr>\n",
322
+ " <tr>\n",
323
+ " <th>1</th>\n",
324
+ " <td>1-500/13da97c1bc2fb4e725d49d_010.png</td>\n",
325
+ " <td>https://www.via-hd.co.jp/ir/library/session/</td>\n",
326
+ " <td>株式会社ヴィア・ホールディングス</td>\n",
327
+ " <td>2024年3月期 決算説明会資料</td>\n",
328
+ " <td>https://www.via-hd.co.jp/ir/library/session/as...</td>\n",
329
+ " <td>20240614.pdf</td>\n",
330
+ " <td>15</td>\n",
331
+ " </tr>\n",
332
+ " <tr>\n",
333
+ " <th>2</th>\n",
334
+ " <td>1-500/141da1caf1c3b99f1ec4a9_026.png</td>\n",
335
+ " <td>https://www.okr-ind.co.jp/ir/supplemental-doc/</td>\n",
336
+ " <td>大倉工業株式会社</td>\n",
337
+ " <td>2023年12月期決算説明資料</td>\n",
338
+ " <td>https://www.okr-ind.co.jp/wp/wp-content/upload...</td>\n",
339
+ " <td>20240221IR.pdf</td>\n",
340
+ " <td>27</td>\n",
341
+ " </tr>\n",
342
+ " <tr>\n",
343
+ " <th>3</th>\n",
344
+ " <td>1-500/141da1caf1c3b99f1ec4a9_036.png</td>\n",
345
+ " <td>https://www.okr-ind.co.jp/ir/supplemental-doc/</td>\n",
346
+ " <td>大倉工業株式会社</td>\n",
347
+ " <td>2023年12月期決算説明資料</td>\n",
348
+ " <td>https://www.okr-ind.co.jp/wp/wp-content/upload...</td>\n",
349
+ " <td>20240221IR.pdf</td>\n",
350
+ " <td>37</td>\n",
351
+ " </tr>\n",
352
+ " <tr>\n",
353
+ " <th>4</th>\n",
354
+ " <td>1-500/14cb03f0a9ef31ee990171_051.png</td>\n",
355
+ " <td>https://openhouse-group.co.jp/ir/library/libra...</td>\n",
356
+ " <td>株式会社オープンハウスグループ</td>\n",
357
+ " <td>2024年9月期 第2四半期 決算説明資料</td>\n",
358
+ " <td>https://openhouse-group.co.jp/ir/upload_file/m...</td>\n",
359
+ " <td>kessan_202492q.pdf</td>\n",
360
+ " <td>52</td>\n",
361
+ " </tr>\n",
362
+ " <tr>\n",
363
+ " <th>...</th>\n",
364
+ " <td>...</td>\n",
365
+ " <td>...</td>\n",
366
+ " <td>...</td>\n",
367
+ " <td>...</td>\n",
368
+ " <td>...</td>\n",
369
+ " <td>...</td>\n",
370
+ " <td>...</td>\n",
371
+ " </tr>\n",
372
+ " <tr>\n",
373
+ " <th>81</th>\n",
374
+ " <td>bd0d8ccc4b4e8a2fa3aab1_081.png</td>\n",
375
+ " <td>https://www.uluru.biz/ir/presentation.html</td>\n",
376
+ " <td>株式会社うるる</td>\n",
377
+ " <td>2024年3月期 通期及び第4四半期 決算説明資料</td>\n",
378
+ " <td>https://ssl4.eir-parts.net/doc/3979/ir_materia...</td>\n",
379
+ " <td>00 (15).pdf</td>\n",
380
+ " <td>82</td>\n",
381
+ " </tr>\n",
382
+ " <tr>\n",
383
+ " <th>82</th>\n",
384
+ " <td>r1/GMOペイメン��ゲートウェイ_2022年9月期_ページ26.jpg</td>\n",
385
+ " <td>https://www.gmo-pg.com/ir/library/presentation/</td>\n",
386
+ " <td>GMOペイメントゲートウェイ株式会社</td>\n",
387
+ " <td>2022 年9月期 決算説明会</td>\n",
388
+ " <td>https://www.gmo-pg.com/news/pdf/20221115_gmo-p...</td>\n",
389
+ " <td>20221115_gmo-pg_kessan.pdf</td>\n",
390
+ " <td>26</td>\n",
391
+ " </tr>\n",
392
+ " <tr>\n",
393
+ " <th>83</th>\n",
394
+ " <td>r1/TIS_2023年3月期_ページ09.jpg</td>\n",
395
+ " <td>https://www.tis.co.jp/ir/finance/meeting/</td>\n",
396
+ " <td>TIS株式会社</td>\n",
397
+ " <td>2023年3月期 決算説明資料</td>\n",
398
+ " <td>https://www.tis.co.jp/documents/jp/ir/finance/...</td>\n",
399
+ " <td>230509_1.pdf</td>\n",
400
+ " <td>9</td>\n",
401
+ " </tr>\n",
402
+ " <tr>\n",
403
+ " <th>84</th>\n",
404
+ " <td>r1/アイシン_2023年3月期_ページ14.jpg</td>\n",
405
+ " <td>https://www.aisin.com/jp/investors/settlement/</td>\n",
406
+ " <td>株式会社アイシン</td>\n",
407
+ " <td>2023年3月期 決算説明会</td>\n",
408
+ " <td>https://www.aisin.com/jp/investors/settlement/...</td>\n",
409
+ " <td>fy2023_q4_presentation-j.pdf</td>\n",
410
+ " <td>14</td>\n",
411
+ " </tr>\n",
412
+ " <tr>\n",
413
+ " <th>85</th>\n",
414
+ " <td>r1/アズビル_2023年3月期_ページ53.jpg</td>\n",
415
+ " <td>https://www.azbil.com/jp/ir/library/result/</td>\n",
416
+ " <td>アズビル株式会社</td>\n",
417
+ " <td>2022年度(2023年3月期) 決算説明資料</td>\n",
418
+ " <td>https://www.azbil.com/jp/ir/library/result/__i...</td>\n",
419
+ " <td>azbil_FY2022_4Q_amm-j-3.pdf</td>\n",
420
+ " <td>53</td>\n",
421
+ " </tr>\n",
422
+ " </tbody>\n",
423
+ "</table>\n",
424
+ "<p>86 rows × 7 columns</p>\n",
425
+ "</div>"
426
+ ],
427
+ "text/plain": [
428
+ " annotation_tag \\\n",
429
+ "0 1-500/11359603927730a1c325f3_006.png \n",
430
+ "1 1-500/13da97c1bc2fb4e725d49d_010.png \n",
431
+ "2 1-500/141da1caf1c3b99f1ec4a9_026.png \n",
432
+ "3 1-500/141da1caf1c3b99f1ec4a9_036.png \n",
433
+ "4 1-500/14cb03f0a9ef31ee990171_051.png \n",
434
+ ".. ... \n",
435
+ "81 bd0d8ccc4b4e8a2fa3aab1_081.png \n",
436
+ "82 r1/GMOペイメントゲートウェイ_2022年9月期_ページ26.jpg \n",
437
+ "83 r1/TIS_2023年3月期_ページ09.jpg \n",
438
+ "84 r1/アイシン_2023年3月期_ページ14.jpg \n",
439
+ "85 r1/アズビル_2023年3月期_ページ53.jpg \n",
440
+ "\n",
441
+ " citation_source_url citation_company_name \\\n",
442
+ "0 https://www.yaginet.co.jp/ir/library/presentat... 株式会社ヤギ \n",
443
+ "1 https://www.via-hd.co.jp/ir/library/session/ 株式会社ヴィア・ホールディングス \n",
444
+ "2 https://www.okr-ind.co.jp/ir/supplemental-doc/ 大倉工業株式会社 \n",
445
+ "3 https://www.okr-ind.co.jp/ir/supplemental-doc/ 大倉工業株式会社 \n",
446
+ "4 https://openhouse-group.co.jp/ir/library/libra... 株式会社オープンハウスグループ \n",
447
+ ".. ... ... \n",
448
+ "81 https://www.uluru.biz/ir/presentation.html 株式会社うるる \n",
449
+ "82 https://www.gmo-pg.com/ir/library/presentation/ GMOペイメントゲートウェイ株式会社 \n",
450
+ "83 https://www.tis.co.jp/ir/finance/meeting/ TIS株式会社 \n",
451
+ "84 https://www.aisin.com/jp/investors/settlement/ 株式会社アイシン \n",
452
+ "85 https://www.azbil.com/jp/ir/library/result/ アズビル株式会社 \n",
453
+ "\n",
454
+ " citation_file_name \\\n",
455
+ "0 2024年3月期 決算補足説明資料 \n",
456
+ "1 2024年3月期 決算説明会資料 \n",
457
+ "2 2023年12月期決算説明資料 \n",
458
+ "3 2023年12月期決算説明資料 \n",
459
+ "4 2024年9月期 第2四半期 決算説明資料 \n",
460
+ ".. ... \n",
461
+ "81 2024年3月期 通期及び第4四半期 決算説明資料 \n",
462
+ "82 2022 年9月期 決算説明会 \n",
463
+ "83 2023年3月期 決算説明資料 \n",
464
+ "84 2023年3月期 決算説明会 \n",
465
+ "85 2022年度(2023年3月期) 決算説明資料 \n",
466
+ "\n",
467
+ " citation_pdf_url \\\n",
468
+ "0 https://data.swcms.net/file/yaginet-corp/dam/j... \n",
469
+ "1 https://www.via-hd.co.jp/ir/library/session/as... \n",
470
+ "2 https://www.okr-ind.co.jp/wp/wp-content/upload... \n",
471
+ "3 https://www.okr-ind.co.jp/wp/wp-content/upload... \n",
472
+ "4 https://openhouse-group.co.jp/ir/upload_file/m... \n",
473
+ ".. ... \n",
474
+ "81 https://ssl4.eir-parts.net/doc/3979/ir_materia... \n",
475
+ "82 https://www.gmo-pg.com/news/pdf/20221115_gmo-p... \n",
476
+ "83 https://www.tis.co.jp/documents/jp/ir/finance/... \n",
477
+ "84 https://www.aisin.com/jp/investors/settlement/... \n",
478
+ "85 https://www.azbil.com/jp/ir/library/result/__i... \n",
479
+ "\n",
480
+ " local_file_name page_no \n",
481
+ "0 140120240509587890.pdf 7 \n",
482
+ "1 20240614.pdf 15 \n",
483
+ "2 20240221IR.pdf 27 \n",
484
+ "3 20240221IR.pdf 37 \n",
485
+ "4 kessan_202492q.pdf 52 \n",
486
+ ".. ... ... \n",
487
+ "81 00 (15).pdf 82 \n",
488
+ "82 20221115_gmo-pg_kessan.pdf 26 \n",
489
+ "83 230509_1.pdf 9 \n",
490
+ "84 fy2023_q4_presentation-j.pdf 14 \n",
491
+ "85 azbil_FY2022_4Q_amm-j-3.pdf 53 \n",
492
+ "\n",
493
+ "[86 rows x 7 columns]"
494
+ ]
495
+ },
496
+ "execution_count": 3,
497
+ "metadata": {},
498
+ "output_type": "execute_result"
499
+ }
500
+ ],
501
+ "source": [
502
+ "citation_df = pd.read_csv('source.csv', encoding='shift_jis')\n",
503
+ "citation_df"
504
+ ]
505
+ },
506
+ {
507
+ "cell_type": "code",
508
+ "execution_count": 4,
509
+ "metadata": {},
510
+ "outputs": [
511
+ {
512
+ "data": {
513
+ "text/html": [
514
+ "<div>\n",
515
+ "<style scoped>\n",
516
+ " .dataframe tbody tr th:only-of-type {\n",
517
+ " vertical-align: middle;\n",
518
+ " }\n",
519
+ "\n",
520
+ " .dataframe tbody tr th {\n",
521
+ " vertical-align: top;\n",
522
+ " }\n",
523
+ "\n",
524
+ " .dataframe thead th {\n",
525
+ " text-align: right;\n",
526
+ " }\n",
527
+ "</style>\n",
528
+ "<table border=\"1\" class=\"dataframe\">\n",
529
+ " <thead>\n",
530
+ " <tr style=\"text-align: right;\">\n",
531
+ " <th></th>\n",
532
+ " <th>id</th>\n",
533
+ " <th>type</th>\n",
534
+ " <th>question</th>\n",
535
+ " <th>answer</th>\n",
536
+ " <th>annotation_tag</th>\n",
537
+ " <th>x1</th>\n",
538
+ " <th>y1</th>\n",
539
+ " <th>x2</th>\n",
540
+ " <th>y2</th>\n",
541
+ " <th>width</th>\n",
542
+ " <th>height</th>\n",
543
+ " <th>image</th>\n",
544
+ " <th>citation_source_url</th>\n",
545
+ " <th>citation_company_name</th>\n",
546
+ " <th>citation_file_name</th>\n",
547
+ " <th>citation_pdf_url</th>\n",
548
+ " <th>local_file_name</th>\n",
549
+ " <th>page_no</th>\n",
550
+ " </tr>\n",
551
+ " </thead>\n",
552
+ " <tbody>\n",
553
+ " <tr>\n",
554
+ " <th>0</th>\n",
555
+ " <td>1</td>\n",
556
+ " <td>line</td>\n",
557
+ " <td>2022/3期の利益率は何%か</td>\n",
558
+ " <td>0.5</td>\n",
559
+ " <td>1-500/11359603927730a1c325f3_006.png</td>\n",
560
+ " <td>1828.31</td>\n",
561
+ " <td>480.24</td>\n",
562
+ " <td>2529.20</td>\n",
563
+ " <td>1379.13</td>\n",
564
+ " <td>2667.0</td>\n",
565
+ " <td>1500.0</td>\n",
566
+ " <td>NaN</td>\n",
567
+ " <td>https://www.yaginet.co.jp/ir/library/presentat...</td>\n",
568
+ " <td>株式会社ヤギ</td>\n",
569
+ " <td>2024年3月期 決算補足説明資料</td>\n",
570
+ " <td>https://data.swcms.net/file/yaginet-corp/dam/j...</td>\n",
571
+ " <td>140120240509587890.pdf</td>\n",
572
+ " <td>7</td>\n",
573
+ " </tr>\n",
574
+ " <tr>\n",
575
+ " <th>1</th>\n",
576
+ " <td>2</td>\n",
577
+ " <td>line</td>\n",
578
+ " <td>2024/3期の利益率は2023/3期より何%上がったか?</td>\n",
579
+ " <td>1.3</td>\n",
580
+ " <td>1-500/11359603927730a1c325f3_006.png</td>\n",
581
+ " <td>1828.31</td>\n",
582
+ " <td>480.24</td>\n",
583
+ " <td>2529.20</td>\n",
584
+ " <td>1379.13</td>\n",
585
+ " <td>2667.0</td>\n",
586
+ " <td>1500.0</td>\n",
587
+ " <td>NaN</td>\n",
588
+ " <td>https://www.yaginet.co.jp/ir/library/presentat...</td>\n",
589
+ " <td>株式会社ヤギ</td>\n",
590
+ " <td>2024年3月期 決算補足説明資料</td>\n",
591
+ " <td>https://data.swcms.net/file/yaginet-corp/dam/j...</td>\n",
592
+ " <td>140120240509587890.pdf</td>\n",
593
+ " <td>7</td>\n",
594
+ " </tr>\n",
595
+ " <tr>\n",
596
+ " <th>2</th>\n",
597
+ " <td>15</td>\n",
598
+ " <td>line</td>\n",
599
+ " <td>グラフのタイトルは何���</td>\n",
600
+ " <td>売上高2019年比推移</td>\n",
601
+ " <td>1-500/13da97c1bc2fb4e725d49d_010.png</td>\n",
602
+ " <td>521.73</td>\n",
603
+ " <td>199.58</td>\n",
604
+ " <td>1424.58</td>\n",
605
+ " <td>880.62</td>\n",
606
+ " <td>2667.0</td>\n",
607
+ " <td>1500.0</td>\n",
608
+ " <td>NaN</td>\n",
609
+ " <td>https://www.via-hd.co.jp/ir/library/session/</td>\n",
610
+ " <td>株式会社ヴィア・ホールディングス</td>\n",
611
+ " <td>2024年3月期 決算説明会資料</td>\n",
612
+ " <td>https://www.via-hd.co.jp/ir/library/session/as...</td>\n",
613
+ " <td>20240614.pdf</td>\n",
614
+ " <td>15</td>\n",
615
+ " </tr>\n",
616
+ " <tr>\n",
617
+ " <th>3</th>\n",
618
+ " <td>16</td>\n",
619
+ " <td>line</td>\n",
620
+ " <td>23.1Qから24.3Qではどのくらい数字が上がったか?</td>\n",
621
+ " <td>25.4</td>\n",
622
+ " <td>1-500/13da97c1bc2fb4e725d49d_010.png</td>\n",
623
+ " <td>521.73</td>\n",
624
+ " <td>199.58</td>\n",
625
+ " <td>1424.58</td>\n",
626
+ " <td>880.62</td>\n",
627
+ " <td>2667.0</td>\n",
628
+ " <td>1500.0</td>\n",
629
+ " <td>NaN</td>\n",
630
+ " <td>https://www.via-hd.co.jp/ir/library/session/</td>\n",
631
+ " <td>株式会社ヴィア・ホールディングス</td>\n",
632
+ " <td>2024年3月期 決算説明会資料</td>\n",
633
+ " <td>https://www.via-hd.co.jp/ir/library/session/as...</td>\n",
634
+ " <td>20240614.pdf</td>\n",
635
+ " <td>15</td>\n",
636
+ " </tr>\n",
637
+ " <tr>\n",
638
+ " <th>4</th>\n",
639
+ " <td>17</td>\n",
640
+ " <td>line</td>\n",
641
+ " <td>配当性向が最も低い年は?</td>\n",
642
+ " <td>2019年</td>\n",
643
+ " <td>1-500/141da1caf1c3b99f1ec4a9_026.png</td>\n",
644
+ " <td>79.64</td>\n",
645
+ " <td>195.83</td>\n",
646
+ " <td>2310.54</td>\n",
647
+ " <td>1562.31</td>\n",
648
+ " <td>2339.0</td>\n",
649
+ " <td>1654.0</td>\n",
650
+ " <td>NaN</td>\n",
651
+ " <td>https://www.okr-ind.co.jp/ir/supplemental-doc/</td>\n",
652
+ " <td>大倉工業株式会社</td>\n",
653
+ " <td>2023年12月期決算説明資料</td>\n",
654
+ " <td>https://www.okr-ind.co.jp/wp/wp-content/upload...</td>\n",
655
+ " <td>20240221IR.pdf</td>\n",
656
+ " <td>27</td>\n",
657
+ " </tr>\n",
658
+ " <tr>\n",
659
+ " <th>...</th>\n",
660
+ " <td>...</td>\n",
661
+ " <td>...</td>\n",
662
+ " <td>...</td>\n",
663
+ " <td>...</td>\n",
664
+ " <td>...</td>\n",
665
+ " <td>...</td>\n",
666
+ " <td>...</td>\n",
667
+ " <td>...</td>\n",
668
+ " <td>...</td>\n",
669
+ " <td>...</td>\n",
670
+ " <td>...</td>\n",
671
+ " <td>...</td>\n",
672
+ " <td>...</td>\n",
673
+ " <td>...</td>\n",
674
+ " <td>...</td>\n",
675
+ " <td>...</td>\n",
676
+ " <td>...</td>\n",
677
+ " <td>...</td>\n",
678
+ " </tr>\n",
679
+ " <tr>\n",
680
+ " <th>195</th>\n",
681
+ " <td>1032</td>\n",
682
+ " <td>circle</td>\n",
683
+ " <td>2023年3月期の保険の数値は何%か</td>\n",
684
+ " <td>6.1</td>\n",
685
+ " <td>r1/TIS_2023年3月期_ページ09.jpg</td>\n",
686
+ " <td>244.19</td>\n",
687
+ " <td>812.40</td>\n",
688
+ " <td>1808.88</td>\n",
689
+ " <td>1439.27</td>\n",
690
+ " <td>2000.0</td>\n",
691
+ " <td>1500.0</td>\n",
692
+ " <td>NaN</td>\n",
693
+ " <td>https://www.tis.co.jp/ir/finance/meeting/</td>\n",
694
+ " <td>TIS株式会社</td>\n",
695
+ " <td>2023年3月期 決算説明資料</td>\n",
696
+ " <td>https://www.tis.co.jp/documents/jp/ir/finance/...</td>\n",
697
+ " <td>230509_1.pdf</td>\n",
698
+ " <td>9</td>\n",
699
+ " </tr>\n",
700
+ " <tr>\n",
701
+ " <th>196</th>\n",
702
+ " <td>1311</td>\n",
703
+ " <td>circle</td>\n",
704
+ " <td>地域別累積投資比率ではどの国が一番割合を占めているか。</td>\n",
705
+ " <td>日本</td>\n",
706
+ " <td>r1/アイシン_2023年3月期_ページ14.jpg</td>\n",
707
+ " <td>1605.56</td>\n",
708
+ " <td>208.83</td>\n",
709
+ " <td>2620.52</td>\n",
710
+ " <td>1216.29</td>\n",
711
+ " <td>2667.0</td>\n",
712
+ " <td>1500.0</td>\n",
713
+ " <td>NaN</td>\n",
714
+ " <td>https://www.aisin.com/jp/investors/settlement/</td>\n",
715
+ " <td>株式会社アイシン</td>\n",
716
+ " <td>2023年3月期 決算説明会</td>\n",
717
+ " <td>https://www.aisin.com/jp/investors/settlement/...</td>\n",
718
+ " <td>fy2023_q4_presentation-j.pdf</td>\n",
719
+ " <td>14</td>\n",
720
+ " </tr>\n",
721
+ " <tr>\n",
722
+ " <th>197</th>\n",
723
+ " <td>1312</td>\n",
724
+ " <td>circle</td>\n",
725
+ " <td>中国の数値は何%か</td>\n",
726
+ " <td>15</td>\n",
727
+ " <td>r1/アイシン_2023年3月期_ページ14.jpg</td>\n",
728
+ " <td>1605.56</td>\n",
729
+ " <td>208.83</td>\n",
730
+ " <td>2620.52</td>\n",
731
+ " <td>1216.29</td>\n",
732
+ " <td>2667.0</td>\n",
733
+ " <td>1500.0</td>\n",
734
+ " <td>NaN</td>\n",
735
+ " <td>https://www.aisin.com/jp/investors/settlement/</td>\n",
736
+ " <td>株式会社アイシン</td>\n",
737
+ " <td>2023年3月期 決算説明会</td>\n",
738
+ " <td>https://www.aisin.com/jp/investors/settlement/...</td>\n",
739
+ " <td>fy2023_q4_presentation-j.pdf</td>\n",
740
+ " <td>14</td>\n",
741
+ " </tr>\n",
742
+ " <tr>\n",
743
+ " <th>198</th>\n",
744
+ " <td>1397</td>\n",
745
+ " <td>circle</td>\n",
746
+ " <td>2021年の社内取締役比率は何%か</td>\n",
747
+ " <td>54.5</td>\n",
748
+ " <td>r1/アズビル_2023年3月期_ページ53.jpg</td>\n",
749
+ " <td>1478.72</td>\n",
750
+ " <td>188.53</td>\n",
751
+ " <td>2465.13</td>\n",
752
+ " <td>798.98</td>\n",
753
+ " <td>2667.0</td>\n",
754
+ " <td>1500.0</td>\n",
755
+ " <td>NaN</td>\n",
756
+ " <td>https://www.azbil.com/jp/ir/library/result/</td>\n",
757
+ " <td>アズビル株式会社</td>\n",
758
+ " <td>2022年度(2023年3月期) 決算説明資料</td>\n",
759
+ " <td>https://www.azbil.com/jp/ir/library/result/__i...</td>\n",
760
+ " <td>azbil_FY2022_4Q_amm-j-3.pdf</td>\n",
761
+ " <td>53</td>\n",
762
+ " </tr>\n",
763
+ " <tr>\n",
764
+ " <th>199</th>\n",
765
+ " <td>1398</td>\n",
766
+ " <td>circle</td>\n",
767
+ " <td>2022年の社内取締役比率は何%か</td>\n",
768
+ " <td>33.3</td>\n",
769
+ " <td>r1/アズビル_2023年3月期_ページ53.jpg</td>\n",
770
+ " <td>1478.72</td>\n",
771
+ " <td>188.53</td>\n",
772
+ " <td>2465.13</td>\n",
773
+ " <td>798.98</td>\n",
774
+ " <td>2667.0</td>\n",
775
+ " <td>1500.0</td>\n",
776
+ " <td>NaN</td>\n",
777
+ " <td>https://www.azbil.com/jp/ir/library/result/</td>\n",
778
+ " <td>アズビル株式会社</td>\n",
779
+ " <td>2022年度(2023年3月期) 決算説明資料</td>\n",
780
+ " <td>https://www.azbil.com/jp/ir/library/result/__i...</td>\n",
781
+ " <td>azbil_FY2022_4Q_amm-j-3.pdf</td>\n",
782
+ " <td>53</td>\n",
783
+ " </tr>\n",
784
+ " </tbody>\n",
785
+ "</table>\n",
786
+ "<p>200 rows × 18 columns</p>\n",
787
+ "</div>"
788
+ ],
789
+ "text/plain": [
790
+ " id type question answer \\\n",
791
+ "0 1 line 2022/3期の利益率は何%か 0.5 \n",
792
+ "1 2 line 2024/3期の利益率は2023/3期より何%上がったか? 1.3 \n",
793
+ "2 15 line グラフのタイトルは何か 売上高2019年比推移 \n",
794
+ "3 16 line 23.1Qから24.3Qではどのくらい数字が上がったか? 25.4 \n",
795
+ "4 17 line 配当性向が最も低い年は? 2019年 \n",
796
+ ".. ... ... ... ... \n",
797
+ "195 1032 circle 2023年3月期の保険の数値は何%か 6.1 \n",
798
+ "196 1311 circle 地域別累積投資比率ではどの国が一番割合を占めているか。 日本 \n",
799
+ "197 1312 circle 中国の数値は何%か 15 \n",
800
+ "198 1397 circle 2021年の社内取締役比率は何%か 54.5 \n",
801
+ "199 1398 circle 2022年の社内取締役比率は何%か 33.3 \n",
802
+ "\n",
803
+ " annotation_tag x1 y1 x2 y2 \\\n",
804
+ "0 1-500/11359603927730a1c325f3_006.png 1828.31 480.24 2529.20 1379.13 \n",
805
+ "1 1-500/11359603927730a1c325f3_006.png 1828.31 480.24 2529.20 1379.13 \n",
806
+ "2 1-500/13da97c1bc2fb4e725d49d_010.png 521.73 199.58 1424.58 880.62 \n",
807
+ "3 1-500/13da97c1bc2fb4e725d49d_010.png 521.73 199.58 1424.58 880.62 \n",
808
+ "4 1-500/141da1caf1c3b99f1ec4a9_026.png 79.64 195.83 2310.54 1562.31 \n",
809
+ ".. ... ... ... ... ... \n",
810
+ "195 r1/TIS_2023年3月期_ページ09.jpg 244.19 812.40 1808.88 1439.27 \n",
811
+ "196 r1/アイシン_2023年3月期_ページ14.jpg 1605.56 208.83 2620.52 1216.29 \n",
812
+ "197 r1/アイシン_2023年3月期_ページ14.jpg 1605.56 208.83 2620.52 1216.29 \n",
813
+ "198 r1/アズビル_2023年3月期_ページ53.jpg 1478.72 188.53 2465.13 798.98 \n",
814
+ "199 r1/アズビル_2023年3月期_ページ53.jpg 1478.72 188.53 2465.13 798.98 \n",
815
+ "\n",
816
+ " width height image citation_source_url \\\n",
817
+ "0 2667.0 1500.0 NaN https://www.yaginet.co.jp/ir/library/presentat... \n",
818
+ "1 2667.0 1500.0 NaN https://www.yaginet.co.jp/ir/library/presentat... \n",
819
+ "2 2667.0 1500.0 NaN https://www.via-hd.co.jp/ir/library/session/ \n",
820
+ "3 2667.0 1500.0 NaN https://www.via-hd.co.jp/ir/library/session/ \n",
821
+ "4 2339.0 1654.0 NaN https://www.okr-ind.co.jp/ir/supplemental-doc/ \n",
822
+ ".. ... ... ... ... \n",
823
+ "195 2000.0 1500.0 NaN https://www.tis.co.jp/ir/finance/meeting/ \n",
824
+ "196 2667.0 1500.0 NaN https://www.aisin.com/jp/investors/settlement/ \n",
825
+ "197 2667.0 1500.0 NaN https://www.aisin.com/jp/investors/settlement/ \n",
826
+ "198 2667.0 1500.0 NaN https://www.azbil.com/jp/ir/library/result/ \n",
827
+ "199 2667.0 1500.0 NaN https://www.azbil.com/jp/ir/library/result/ \n",
828
+ "\n",
829
+ " citation_company_name citation_file_name \\\n",
830
+ "0 株式会社ヤギ 2024年3月期 決算補足説明資料 \n",
831
+ "1 株式会社ヤギ 2024年3月期 決算補足説明資料 \n",
832
+ "2 株式会社ヴィア・ホールディングス 2024年3月期 決算説明会資料 \n",
833
+ "3 株式会社ヴィア・ホールディングス 2024年3月期 決算説明会資料 \n",
834
+ "4 大倉工業株式会社 2023年12月期決算説明資料 \n",
835
+ ".. ... ... \n",
836
+ "195 TIS株式会社 2023年3月期 決算説明資料 \n",
837
+ "196 株式会社アイシン 2023年3月期 決算説明会 \n",
838
+ "197 株式会社アイシン 2023年3月期 決算説明会 \n",
839
+ "198 アズビル株式会社 2022年度(2023年3月期) 決算説明資料 \n",
840
+ "199 アズビル株式会社 2022年度(2023年3月期) 決算説明資料 \n",
841
+ "\n",
842
+ " citation_pdf_url \\\n",
843
+ "0 https://data.swcms.net/file/yaginet-corp/dam/j... \n",
844
+ "1 https://data.swcms.net/file/yaginet-corp/dam/j... \n",
845
+ "2 https://www.via-hd.co.jp/ir/library/session/as... \n",
846
+ "3 https://www.via-hd.co.jp/ir/library/session/as... \n",
847
+ "4 https://www.okr-ind.co.jp/wp/wp-content/upload... \n",
848
+ ".. ... \n",
849
+ "195 https://www.tis.co.jp/documents/jp/ir/finance/... \n",
850
+ "196 https://www.aisin.com/jp/investors/settlement/... \n",
851
+ "197 https://www.aisin.com/jp/investors/settlement/... \n",
852
+ "198 https://www.azbil.com/jp/ir/library/result/__i... \n",
853
+ "199 https://www.azbil.com/jp/ir/library/result/__i... \n",
854
+ "\n",
855
+ " local_file_name page_no \n",
856
+ "0 140120240509587890.pdf 7 \n",
857
+ "1 140120240509587890.pdf 7 \n",
858
+ "2 20240614.pdf 15 \n",
859
+ "3 20240614.pdf 15 \n",
860
+ "4 20240221IR.pdf 27 \n",
861
+ ".. ... ... \n",
862
+ "195 230509_1.pdf 9 \n",
863
+ "196 fy2023_q4_presentation-j.pdf 14 \n",
864
+ "197 fy2023_q4_presentation-j.pdf 14 \n",
865
+ "198 azbil_FY2022_4Q_amm-j-3.pdf 53 \n",
866
+ "199 azbil_FY2022_4Q_amm-j-3.pdf 53 \n",
867
+ "\n",
868
+ "[200 rows x 18 columns]"
869
+ ]
870
+ },
871
+ "execution_count": 4,
872
+ "metadata": {},
873
+ "output_type": "execute_result"
874
+ }
875
+ ],
876
+ "source": [
877
+ "merged_df = pd.merge(annotation_df, citation_df, on='annotation_tag')\n",
878
+ "merged_df"
879
+ ]
880
+ },
881
+ {
882
+ "cell_type": "code",
883
+ "execution_count": null,
884
+ "metadata": {},
885
+ "outputs": [],
886
+ "source": [
887
+ "import pymupdf\n",
888
+ "\n",
889
+ "zoom_x = 3.0 # horizontal zoom\n",
890
+ "zoom_y = 3.0 # vertical zoom\n",
891
+ "mat = pymupdf.Matrix(zoom_x, zoom_y) # zoom factor 3 in each dimension"
892
+ ]
893
+ },
894
+ {
895
+ "cell_type": "code",
896
+ "execution_count": 6,
897
+ "metadata": {},
898
+ "outputs": [
899
+ {
900
+ "name": "stderr",
901
+ "output_type": "stream",
902
+ "text": [
903
+ "/tmp/ipykernel_3350573/164051748.py:27: SettingWithCopyWarning: \n",
904
+ "A value is trying to be set on a copy of a slice from a DataFrame\n",
905
+ "\n",
906
+ "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
907
+ " merged_df['image'][i] = img\n"
908
+ ]
909
+ }
910
+ ],
911
+ "source": [
912
+ "import io\n",
913
+ "from PIL import Image\n",
914
+ "import matplotlib.pyplot as plt\n",
915
+ "\n",
916
+ "for i in range(0, len(merged_df), 2): \n",
917
+ " pdf_filename = merged_df['local_file_name'][i]\n",
918
+ " pdf_filename = f'./pdf/{pdf_filename}'\n",
919
+ " pdf = pymupdf.open(pdf_filename)\n",
920
+ " page_no = int(merged_df['page_no'][i]-1)\n",
921
+ " page = pdf[page_no]\n",
922
+ " pix = page.get_pixmap(matrix=mat)\n",
923
+ " byte = pix.pil_tobytes(\"png\")\n",
924
+ " binary = io.BytesIO(byte)\n",
925
+ " pil_img = Image.open(binary)\n",
926
+ " width= int(merged_df['width'][i])\n",
927
+ " height = int(merged_df['height'][i])\n",
928
+ " dst = pil_img.resize((width, height), Image.LANCZOS)\n",
929
+ " x1 = merged_df['x1'][i]\n",
930
+ " y1 = merged_df['y1'][i]\n",
931
+ " x2 = merged_df['x2'][i]\n",
932
+ " y2 = merged_df['y2'][i]\n",
933
+ " cropped_img = dst.crop([x1,y1,x2,y2])\n",
934
+ " with io.BytesIO() as output:\n",
935
+ " cropped_img.save(output,format=\"PNG\")\n",
936
+ " cropped_img_binary = output.getvalue()\n",
937
+ " img = {\"bytes\": cropped_img_binary}\n",
938
+ " merged_df['image'][i] = img\n",
939
+ " merged_df['image'][i+1] = img"
940
+ ]
941
+ },
942
+ {
943
+ "cell_type": "code",
944
+ "execution_count": 7,
945
+ "metadata": {},
946
+ "outputs": [
947
+ {
948
+ "data": {
949
+ "text/html": [
950
+ "<div>\n",
951
+ "<style scoped>\n",
952
+ " .dataframe tbody tr th:only-of-type {\n",
953
+ " vertical-align: middle;\n",
954
+ " }\n",
955
+ "\n",
956
+ " .dataframe tbody tr th {\n",
957
+ " vertical-align: top;\n",
958
+ " }\n",
959
+ "\n",
960
+ " .dataframe thead th {\n",
961
+ " text-align: right;\n",
962
+ " }\n",
963
+ "</style>\n",
964
+ "<table border=\"1\" class=\"dataframe\">\n",
965
+ " <thead>\n",
966
+ " <tr style=\"text-align: right;\">\n",
967
+ " <th></th>\n",
968
+ " <th>id</th>\n",
969
+ " <th>type</th>\n",
970
+ " <th>question</th>\n",
971
+ " <th>answer</th>\n",
972
+ " <th>annotation_tag</th>\n",
973
+ " <th>x1</th>\n",
974
+ " <th>y1</th>\n",
975
+ " <th>x2</th>\n",
976
+ " <th>y2</th>\n",
977
+ " <th>width</th>\n",
978
+ " <th>height</th>\n",
979
+ " <th>image</th>\n",
980
+ " <th>citation_source_url</th>\n",
981
+ " <th>citation_company_name</th>\n",
982
+ " <th>citation_file_name</th>\n",
983
+ " <th>citation_pdf_url</th>\n",
984
+ " <th>local_file_name</th>\n",
985
+ " <th>page_no</th>\n",
986
+ " </tr>\n",
987
+ " </thead>\n",
988
+ " <tbody>\n",
989
+ " <tr>\n",
990
+ " <th>0</th>\n",
991
+ " <td>1</td>\n",
992
+ " <td>line</td>\n",
993
+ " <td>2022/3期の利益率は何%か</td>\n",
994
+ " <td>0.5</td>\n",
995
+ " <td>1-500/11359603927730a1c325f3_006.png</td>\n",
996
+ " <td>1828.31</td>\n",
997
+ " <td>480.24</td>\n",
998
+ " <td>2529.20</td>\n",
999
+ " <td>1379.13</td>\n",
1000
+ " <td>2667.0</td>\n",
1001
+ " <td>1500.0</td>\n",
1002
+ " <td>{'bytes': b'\\x89PNG\\r\\n\\x1a\\n\\x00\\x00\\x00\\rIHD...</td>\n",
1003
+ " <td>https://www.yaginet.co.jp/ir/library/presentat...</td>\n",
1004
+ " <td>株式会社ヤギ</td>\n",
1005
+ " <td>2024年3月期 決算補足説明資料</td>\n",
1006
+ " <td>https://data.swcms.net/file/yaginet-corp/dam/j...</td>\n",
1007
+ " <td>140120240509587890.pdf</td>\n",
1008
+ " <td>7</td>\n",
1009
+ " </tr>\n",
1010
+ " <tr>\n",
1011
+ " <th>1</th>\n",
1012
+ " <td>2</td>\n",
1013
+ " <td>line</td>\n",
1014
+ " <td>2024/3期の利益率は2023/3期より何%上がったか?</td>\n",
1015
+ " <td>1.3</td>\n",
1016
+ " <td>1-500/11359603927730a1c325f3_006.png</td>\n",
1017
+ " <td>1828.31</td>\n",
1018
+ " <td>480.24</td>\n",
1019
+ " <td>2529.20</td>\n",
1020
+ " <td>1379.13</td>\n",
1021
+ " <td>2667.0</td>\n",
1022
+ " <td>1500.0</td>\n",
1023
+ " <td>{'bytes': b'\\x89PNG\\r\\n\\x1a\\n\\x00\\x00\\x00\\rIHD...</td>\n",
1024
+ " <td>https://www.yaginet.co.jp/ir/library/presentat...</td>\n",
1025
+ " <td>株式会社ヤギ</td>\n",
1026
+ " <td>2024年3月期 決算補足説明資料</td>\n",
1027
+ " <td>https://data.swcms.net/file/yaginet-corp/dam/j...</td>\n",
1028
+ " <td>140120240509587890.pdf</td>\n",
1029
+ " <td>7</td>\n",
1030
+ " </tr>\n",
1031
+ " <tr>\n",
1032
+ " <th>2</th>\n",
1033
+ " <td>15</td>\n",
1034
+ " <td>line</td>\n",
1035
+ " <td>グラフのタイトルは何か</td>\n",
1036
+ " <td>売上高2019年比推移</td>\n",
1037
+ " <td>1-500/13da97c1bc2fb4e725d49d_010.png</td>\n",
1038
+ " <td>521.73</td>\n",
1039
+ " <td>199.58</td>\n",
1040
+ " <td>1424.58</td>\n",
1041
+ " <td>880.62</td>\n",
1042
+ " <td>2667.0</td>\n",
1043
+ " <td>1500.0</td>\n",
1044
+ " <td>{'bytes': b'\\x89PNG\\r\\n\\x1a\\n\\x00\\x00\\x00\\rIHD...</td>\n",
1045
+ " <td>https://www.via-hd.co.jp/ir/library/session/</td>\n",
1046
+ " <td>株式会社ヴィア・ホールディングス</td>\n",
1047
+ " <td>2024年3月期 決算説明会資料</td>\n",
1048
+ " <td>https://www.via-hd.co.jp/ir/library/session/as...</td>\n",
1049
+ " <td>20240614.pdf</td>\n",
1050
+ " <td>15</td>\n",
1051
+ " </tr>\n",
1052
+ " <tr>\n",
1053
+ " <th>3</th>\n",
1054
+ " <td>16</td>\n",
1055
+ " <td>line</td>\n",
1056
+ " <td>23.1Qから24.3Qではどのくらい数字が上がったか?</td>\n",
1057
+ " <td>25.4</td>\n",
1058
+ " <td>1-500/13da97c1bc2fb4e725d49d_010.png</td>\n",
1059
+ " <td>521.73</td>\n",
1060
+ " <td>199.58</td>\n",
1061
+ " <td>1424.58</td>\n",
1062
+ " <td>880.62</td>\n",
1063
+ " <td>2667.0</td>\n",
1064
+ " <td>1500.0</td>\n",
1065
+ " <td>{'bytes': b'\\x89PNG\\r\\n\\x1a\\n\\x00\\x00\\x00\\rIHD...</td>\n",
1066
+ " <td>https://www.via-hd.co.jp/ir/library/session/</td>\n",
1067
+ " <td>株式会社ヴィア・ホールディングス</td>\n",
1068
+ " <td>2024年3月期 決算説明会資料</td>\n",
1069
+ " <td>https://www.via-hd.co.jp/ir/library/session/as...</td>\n",
1070
+ " <td>20240614.pdf</td>\n",
1071
+ " <td>15</td>\n",
1072
+ " </tr>\n",
1073
+ " <tr>\n",
1074
+ " <th>4</th>\n",
1075
+ " <td>17</td>\n",
1076
+ " <td>line</td>\n",
1077
+ " <td>配当性向が最も低い年は?</td>\n",
1078
+ " <td>2019年</td>\n",
1079
+ " <td>1-500/141da1caf1c3b99f1ec4a9_026.png</td>\n",
1080
+ " <td>79.64</td>\n",
1081
+ " <td>195.83</td>\n",
1082
+ " <td>2310.54</td>\n",
1083
+ " <td>1562.31</td>\n",
1084
+ " <td>2339.0</td>\n",
1085
+ " <td>1654.0</td>\n",
1086
+ " <td>{'bytes': b'\\x89PNG\\r\\n\\x1a\\n\\x00\\x00\\x00\\rIHD...</td>\n",
1087
+ " <td>https://www.okr-ind.co.jp/ir/supplemental-doc/</td>\n",
1088
+ " <td>大倉工業株式会社</td>\n",
1089
+ " <td>2023年12月期決算説明資料</td>\n",
1090
+ " <td>https://www.okr-ind.co.jp/wp/wp-content/upload...</td>\n",
1091
+ " <td>20240221IR.pdf</td>\n",
1092
+ " <td>27</td>\n",
1093
+ " </tr>\n",
1094
+ " <tr>\n",
1095
+ " <th>...</th>\n",
1096
+ " <td>...</td>\n",
1097
+ " <td>...</td>\n",
1098
+ " <td>...</td>\n",
1099
+ " <td>...</td>\n",
1100
+ " <td>...</td>\n",
1101
+ " <td>...</td>\n",
1102
+ " <td>...</td>\n",
1103
+ " <td>...</td>\n",
1104
+ " <td>...</td>\n",
1105
+ " <td>...</td>\n",
1106
+ " <td>...</td>\n",
1107
+ " <td>...</td>\n",
1108
+ " <td>...</td>\n",
1109
+ " <td>...</td>\n",
1110
+ " <td>...</td>\n",
1111
+ " <td>...</td>\n",
1112
+ " <td>...</td>\n",
1113
+ " <td>...</td>\n",
1114
+ " </tr>\n",
1115
+ " <tr>\n",
1116
+ " <th>195</th>\n",
1117
+ " <td>1032</td>\n",
1118
+ " <td>circle</td>\n",
1119
+ " <td>2023年3月期の保険の数値は何%か</td>\n",
1120
+ " <td>6.1</td>\n",
1121
+ " <td>r1/TIS_2023年3月期_ページ09.jpg</td>\n",
1122
+ " <td>244.19</td>\n",
1123
+ " <td>812.40</td>\n",
1124
+ " <td>1808.88</td>\n",
1125
+ " <td>1439.27</td>\n",
1126
+ " <td>2000.0</td>\n",
1127
+ " <td>1500.0</td>\n",
1128
+ " <td>{'bytes': b'\\x89PNG\\r\\n\\x1a\\n\\x00\\x00\\x00\\rIHD...</td>\n",
1129
+ " <td>https://www.tis.co.jp/ir/finance/meeting/</td>\n",
1130
+ " <td>TIS株式会社</td>\n",
1131
+ " <td>2023年3月期 決算説明資料</td>\n",
1132
+ " <td>https://www.tis.co.jp/documents/jp/ir/finance/...</td>\n",
1133
+ " <td>230509_1.pdf</td>\n",
1134
+ " <td>9</td>\n",
1135
+ " </tr>\n",
1136
+ " <tr>\n",
1137
+ " <th>196</th>\n",
1138
+ " <td>1311</td>\n",
1139
+ " <td>circle</td>\n",
1140
+ " <td>地域別累積投資比率ではどの国が一番割合を占めているか。</td>\n",
1141
+ " <td>日本</td>\n",
1142
+ " <td>r1/アイシン_2023年3月期_ページ14.jpg</td>\n",
1143
+ " <td>1605.56</td>\n",
1144
+ " <td>208.83</td>\n",
1145
+ " <td>2620.52</td>\n",
1146
+ " <td>1216.29</td>\n",
1147
+ " <td>2667.0</td>\n",
1148
+ " <td>1500.0</td>\n",
1149
+ " <td>{'bytes': b'\\x89PNG\\r\\n\\x1a\\n\\x00\\x00\\x00\\rIHD...</td>\n",
1150
+ " <td>https://www.aisin.com/jp/investors/settlement/</td>\n",
1151
+ " <td>株式会社アイシン</td>\n",
1152
+ " <td>2023年3月期 決算説明会</td>\n",
1153
+ " <td>https://www.aisin.com/jp/investors/settlement/...</td>\n",
1154
+ " <td>fy2023_q4_presentation-j.pdf</td>\n",
1155
+ " <td>14</td>\n",
1156
+ " </tr>\n",
1157
+ " <tr>\n",
1158
+ " <th>197</th>\n",
1159
+ " <td>1312</td>\n",
1160
+ " <td>circle</td>\n",
1161
+ " <td>中国の数値は何%か</td>\n",
1162
+ " <td>15</td>\n",
1163
+ " <td>r1/アイシン_2023年3月期_ページ14.jpg</td>\n",
1164
+ " <td>1605.56</td>\n",
1165
+ " <td>208.83</td>\n",
1166
+ " <td>2620.52</td>\n",
1167
+ " <td>1216.29</td>\n",
1168
+ " <td>2667.0</td>\n",
1169
+ " <td>1500.0</td>\n",
1170
+ " <td>{'bytes': b'\\x89PNG\\r\\n\\x1a\\n\\x00\\x00\\x00\\rIHD...</td>\n",
1171
+ " <td>https://www.aisin.com/jp/investors/settlement/</td>\n",
1172
+ " <td>株式会社アイシン</td>\n",
1173
+ " <td>2023年3月期 決算説明会</td>\n",
1174
+ " <td>https://www.aisin.com/jp/investors/settlement/...</td>\n",
1175
+ " <td>fy2023_q4_presentation-j.pdf</td>\n",
1176
+ " <td>14</td>\n",
1177
+ " </tr>\n",
1178
+ " <tr>\n",
1179
+ " <th>198</th>\n",
1180
+ " <td>1397</td>\n",
1181
+ " <td>circle</td>\n",
1182
+ " <td>2021年の社内取締役比率は何%か</td>\n",
1183
+ " <td>54.5</td>\n",
1184
+ " <td>r1/アズビル_2023年3月期_ページ53.jpg</td>\n",
1185
+ " <td>1478.72</td>\n",
1186
+ " <td>188.53</td>\n",
1187
+ " <td>2465.13</td>\n",
1188
+ " <td>798.98</td>\n",
1189
+ " <td>2667.0</td>\n",
1190
+ " <td>1500.0</td>\n",
1191
+ " <td>{'bytes': b'\\x89PNG\\r\\n\\x1a\\n\\x00\\x00\\x00\\rIHD...</td>\n",
1192
+ " <td>https://www.azbil.com/jp/ir/library/result/</td>\n",
1193
+ " <td>アズビル株式会社</td>\n",
1194
+ " <td>2022年度(2023年3月期) 決算説明資料</td>\n",
1195
+ " <td>https://www.azbil.com/jp/ir/library/result/__i...</td>\n",
1196
+ " <td>azbil_FY2022_4Q_amm-j-3.pdf</td>\n",
1197
+ " <td>53</td>\n",
1198
+ " </tr>\n",
1199
+ " <tr>\n",
1200
+ " <th>199</th>\n",
1201
+ " <td>1398</td>\n",
1202
+ " <td>circle</td>\n",
1203
+ " <td>2022年の社内取締役比率は何%か</td>\n",
1204
+ " <td>33.3</td>\n",
1205
+ " <td>r1/アズビル_2023年3月期_ページ53.jpg</td>\n",
1206
+ " <td>1478.72</td>\n",
1207
+ " <td>188.53</td>\n",
1208
+ " <td>2465.13</td>\n",
1209
+ " <td>798.98</td>\n",
1210
+ " <td>2667.0</td>\n",
1211
+ " <td>1500.0</td>\n",
1212
+ " <td>{'bytes': b'\\x89PNG\\r\\n\\x1a\\n\\x00\\x00\\x00\\rIHD...</td>\n",
1213
+ " <td>https://www.azbil.com/jp/ir/library/result/</td>\n",
1214
+ " <td>アズビル株式会社</td>\n",
1215
+ " <td>2022年度(2023年3月期) 決算説明資料</td>\n",
1216
+ " <td>https://www.azbil.com/jp/ir/library/result/__i...</td>\n",
1217
+ " <td>azbil_FY2022_4Q_amm-j-3.pdf</td>\n",
1218
+ " <td>53</td>\n",
1219
+ " </tr>\n",
1220
+ " </tbody>\n",
1221
+ "</table>\n",
1222
+ "<p>200 rows × 18 columns</p>\n",
1223
+ "</div>"
1224
+ ],
1225
+ "text/plain": [
1226
+ " id type question answer \\\n",
1227
+ "0 1 line 2022/3期の利益率は何%か 0.5 \n",
1228
+ "1 2 line 2024/3期の利益率は2023/3期より何%上がったか? 1.3 \n",
1229
+ "2 15 line グラフのタイトルは何か 売上高2019年比推移 \n",
1230
+ "3 16 line 23.1Qから24.3Qではどのくらい数字が上がったか? 25.4 \n",
1231
+ "4 17 line 配当性向が最も低い年は? 2019年 \n",
1232
+ ".. ... ... ... ... \n",
1233
+ "195 1032 circle 2023年3月期の保険の数値は何%か 6.1 \n",
1234
+ "196 1311 circle 地域別累積投資比率ではどの国が一番割合を占めているか。 日本 \n",
1235
+ "197 1312 circle 中国の数値は何%か 15 \n",
1236
+ "198 1397 circle 2021年の社内取締役比率は何%か 54.5 \n",
1237
+ "199 1398 circle 2022年の社内取締役比率は何%か 33.3 \n",
1238
+ "\n",
1239
+ " annotation_tag x1 y1 x2 y2 \\\n",
1240
+ "0 1-500/11359603927730a1c325f3_006.png 1828.31 480.24 2529.20 1379.13 \n",
1241
+ "1 1-500/11359603927730a1c325f3_006.png 1828.31 480.24 2529.20 1379.13 \n",
1242
+ "2 1-500/13da97c1bc2fb4e725d49d_010.png 521.73 199.58 1424.58 880.62 \n",
1243
+ "3 1-500/13da97c1bc2fb4e725d49d_010.png 521.73 199.58 1424.58 880.62 \n",
1244
+ "4 1-500/141da1caf1c3b99f1ec4a9_026.png 79.64 195.83 2310.54 1562.31 \n",
1245
+ ".. ... ... ... ... ... \n",
1246
+ "195 r1/TIS_2023年3月期_ページ09.jpg 244.19 812.40 1808.88 1439.27 \n",
1247
+ "196 r1/アイシン_2023年3月期_ページ14.jpg 1605.56 208.83 2620.52 1216.29 \n",
1248
+ "197 r1/アイシン_2023年3月期_ページ14.jpg 1605.56 208.83 2620.52 1216.29 \n",
1249
+ "198 r1/アズビル_2023年3月期_ページ53.jpg 1478.72 188.53 2465.13 798.98 \n",
1250
+ "199 r1/アズビル_2023年3月期_ページ53.jpg 1478.72 188.53 2465.13 798.98 \n",
1251
+ "\n",
1252
+ " width height image \\\n",
1253
+ "0 2667.0 1500.0 {'bytes': b'\\x89PNG\\r\\n\\x1a\\n\\x00\\x00\\x00\\rIHD... \n",
1254
+ "1 2667.0 1500.0 {'bytes': b'\\x89PNG\\r\\n\\x1a\\n\\x00\\x00\\x00\\rIHD... \n",
1255
+ "2 2667.0 1500.0 {'bytes': b'\\x89PNG\\r\\n\\x1a\\n\\x00\\x00\\x00\\rIHD... \n",
1256
+ "3 2667.0 1500.0 {'bytes': b'\\x89PNG\\r\\n\\x1a\\n\\x00\\x00\\x00\\rIHD... \n",
1257
+ "4 2339.0 1654.0 {'bytes': b'\\x89PNG\\r\\n\\x1a\\n\\x00\\x00\\x00\\rIHD... \n",
1258
+ ".. ... ... ... \n",
1259
+ "195 2000.0 1500.0 {'bytes': b'\\x89PNG\\r\\n\\x1a\\n\\x00\\x00\\x00\\rIHD... \n",
1260
+ "196 2667.0 1500.0 {'bytes': b'\\x89PNG\\r\\n\\x1a\\n\\x00\\x00\\x00\\rIHD... \n",
1261
+ "197 2667.0 1500.0 {'bytes': b'\\x89PNG\\r\\n\\x1a\\n\\x00\\x00\\x00\\rIHD... \n",
1262
+ "198 2667.0 1500.0 {'bytes': b'\\x89PNG\\r\\n\\x1a\\n\\x00\\x00\\x00\\rIHD... \n",
1263
+ "199 2667.0 1500.0 {'bytes': b'\\x89PNG\\r\\n\\x1a\\n\\x00\\x00\\x00\\rIHD... \n",
1264
+ "\n",
1265
+ " citation_source_url citation_company_name \\\n",
1266
+ "0 https://www.yaginet.co.jp/ir/library/presentat... 株式会社ヤギ \n",
1267
+ "1 https://www.yaginet.co.jp/ir/library/presentat... 株式会社ヤギ \n",
1268
+ "2 https://www.via-hd.co.jp/ir/library/session/ 株式会社ヴィア・ホールディングス \n",
1269
+ "3 https://www.via-hd.co.jp/ir/library/session/ 株式会社ヴィア・ホールディングス \n",
1270
+ "4 https://www.okr-ind.co.jp/ir/supplemental-doc/ 大倉工業株式会社 \n",
1271
+ ".. ... ... \n",
1272
+ "195 https://www.tis.co.jp/ir/finance/meeting/ TIS株式会社 \n",
1273
+ "196 https://www.aisin.com/jp/investors/settlement/ 株式会社アイシン \n",
1274
+ "197 https://www.aisin.com/jp/investors/settlement/ 株式会社アイシン \n",
1275
+ "198 https://www.azbil.com/jp/ir/library/result/ アズビル株式会社 \n",
1276
+ "199 https://www.azbil.com/jp/ir/library/result/ アズビル株式会社 \n",
1277
+ "\n",
1278
+ " citation_file_name \\\n",
1279
+ "0 2024年3月期 決算補足説明資料 \n",
1280
+ "1 2024年3月期 決算補足説明資料 \n",
1281
+ "2 2024年3月期 決算説明会資料 \n",
1282
+ "3 2024年3月期 決算説明会資料 \n",
1283
+ "4 2023年12月期決算説明資料 \n",
1284
+ ".. ... \n",
1285
+ "195 2023年3月期 決算説明資料 \n",
1286
+ "196 2023年3月期 決算説明会 \n",
1287
+ "197 2023年3月期 決算説明会 \n",
1288
+ "198 2022年度(2023年3月期) 決算説明資料 \n",
1289
+ "199 2022年度(2023年3月期) 決算説明資料 \n",
1290
+ "\n",
1291
+ " citation_pdf_url \\\n",
1292
+ "0 https://data.swcms.net/file/yaginet-corp/dam/j... \n",
1293
+ "1 https://data.swcms.net/file/yaginet-corp/dam/j... \n",
1294
+ "2 https://www.via-hd.co.jp/ir/library/session/as... \n",
1295
+ "3 https://www.via-hd.co.jp/ir/library/session/as... \n",
1296
+ "4 https://www.okr-ind.co.jp/wp/wp-content/upload... \n",
1297
+ ".. ... \n",
1298
+ "195 https://www.tis.co.jp/documents/jp/ir/finance/... \n",
1299
+ "196 https://www.aisin.com/jp/investors/settlement/... \n",
1300
+ "197 https://www.aisin.com/jp/investors/settlement/... \n",
1301
+ "198 https://www.azbil.com/jp/ir/library/result/__i... \n",
1302
+ "199 https://www.azbil.com/jp/ir/library/result/__i... \n",
1303
+ "\n",
1304
+ " local_file_name page_no \n",
1305
+ "0 140120240509587890.pdf 7 \n",
1306
+ "1 140120240509587890.pdf 7 \n",
1307
+ "2 20240614.pdf 15 \n",
1308
+ "3 20240614.pdf 15 \n",
1309
+ "4 20240221IR.pdf 27 \n",
1310
+ ".. ... ... \n",
1311
+ "195 230509_1.pdf 9 \n",
1312
+ "196 fy2023_q4_presentation-j.pdf 14 \n",
1313
+ "197 fy2023_q4_presentation-j.pdf 14 \n",
1314
+ "198 azbil_FY2022_4Q_amm-j-3.pdf 53 \n",
1315
+ "199 azbil_FY2022_4Q_amm-j-3.pdf 53 \n",
1316
+ "\n",
1317
+ "[200 rows x 18 columns]"
1318
+ ]
1319
+ },
1320
+ "execution_count": 7,
1321
+ "metadata": {},
1322
+ "output_type": "execute_result"
1323
+ }
1324
+ ],
1325
+ "source": [
1326
+ "merged_df"
1327
+ ]
1328
+ },
1329
+ {
1330
+ "cell_type": "code",
1331
+ "execution_count": null,
1332
+ "metadata": {},
1333
+ "outputs": [],
1334
+ "source": [
1335
+ "for i in range(0, 10, 2):\n",
1336
+ " text = f\"\"\"\n",
1337
+ " 質問1:{merged_df[\"question\"][i]}\n",
1338
+ " 回答1:{merged_df[\"answer\"][i]}\n",
1339
+ "\n",
1340
+ " 質問2:{merged_df[\"question\"][i+1]}\n",
1341
+ " 回答2:{merged_df[\"answer\"][i+1]}\n",
1342
+ " \"\"\"\n",
1343
+ " print(merged_df[\"id\"][i], merged_df[\"type\"][i])\n",
1344
+ " print(text)\n",
1345
+ "\n",
1346
+ " img_data = merged_df[\"image\"][i][\"bytes\"]\n",
1347
+ " img = Image.open(io.BytesIO(img_data))\n",
1348
+ " plt.figure(figsize=(10, 10))\n",
1349
+ " plt.imshow(img)\n",
1350
+ " plt.axis('off') # 軸を非表示\n",
1351
+ " plt.show()"
1352
+ ]
1353
+ },
1354
+ {
1355
+ "cell_type": "code",
1356
+ "execution_count": 9,
1357
+ "metadata": {},
1358
+ "outputs": [
1359
+ {
1360
+ "data": {
1361
+ "text/html": [
1362
+ "<div>\n",
1363
+ "<style scoped>\n",
1364
+ " .dataframe tbody tr th:only-of-type {\n",
1365
+ " vertical-align: middle;\n",
1366
+ " }\n",
1367
+ "\n",
1368
+ " .dataframe tbody tr th {\n",
1369
+ " vertical-align: top;\n",
1370
+ " }\n",
1371
+ "\n",
1372
+ " .dataframe thead th {\n",
1373
+ " text-align: right;\n",
1374
+ " }\n",
1375
+ "</style>\n",
1376
+ "<table border=\"1\" class=\"dataframe\">\n",
1377
+ " <thead>\n",
1378
+ " <tr style=\"text-align: right;\">\n",
1379
+ " <th></th>\n",
1380
+ " <th>id</th>\n",
1381
+ " <th>type</th>\n",
1382
+ " <th>question</th>\n",
1383
+ " <th>answer</th>\n",
1384
+ " <th>image</th>\n",
1385
+ " </tr>\n",
1386
+ " </thead>\n",
1387
+ " <tbody>\n",
1388
+ " <tr>\n",
1389
+ " <th>0</th>\n",
1390
+ " <td>1</td>\n",
1391
+ " <td>line</td>\n",
1392
+ " <td>2022/3期の利益率は何%か</td>\n",
1393
+ " <td>0.5</td>\n",
1394
+ " <td>{'bytes': b'\\x89PNG\\r\\n\\x1a\\n\\x00\\x00\\x00\\rIHD...</td>\n",
1395
+ " </tr>\n",
1396
+ " <tr>\n",
1397
+ " <th>1</th>\n",
1398
+ " <td>2</td>\n",
1399
+ " <td>line</td>\n",
1400
+ " <td>2024/3期の利益率は2023/3期より何%上がったか?</td>\n",
1401
+ " <td>1.3</td>\n",
1402
+ " <td>{'bytes': b'\\x89PNG\\r\\n\\x1a\\n\\x00\\x00\\x00\\rIHD...</td>\n",
1403
+ " </tr>\n",
1404
+ " <tr>\n",
1405
+ " <th>2</th>\n",
1406
+ " <td>15</td>\n",
1407
+ " <td>line</td>\n",
1408
+ " <td>グラフのタイトルは何か</td>\n",
1409
+ " <td>売上高2019年比推移</td>\n",
1410
+ " <td>{'bytes': b'\\x89PNG\\r\\n\\x1a\\n\\x00\\x00\\x00\\rIHD...</td>\n",
1411
+ " </tr>\n",
1412
+ " <tr>\n",
1413
+ " <th>3</th>\n",
1414
+ " <td>16</td>\n",
1415
+ " <td>line</td>\n",
1416
+ " <td>23.1Qから24.3Qではどのくらい数字が上がったか?</td>\n",
1417
+ " <td>25.4</td>\n",
1418
+ " <td>{'bytes': b'\\x89PNG\\r\\n\\x1a\\n\\x00\\x00\\x00\\rIHD...</td>\n",
1419
+ " </tr>\n",
1420
+ " <tr>\n",
1421
+ " <th>4</th>\n",
1422
+ " <td>17</td>\n",
1423
+ " <td>line</td>\n",
1424
+ " <td>配当性向が最も低い年は?</td>\n",
1425
+ " <td>2019年</td>\n",
1426
+ " <td>{'bytes': b'\\x89PNG\\r\\n\\x1a\\n\\x00\\x00\\x00\\rIHD...</td>\n",
1427
+ " </tr>\n",
1428
+ " <tr>\n",
1429
+ " <th>...</th>\n",
1430
+ " <td>...</td>\n",
1431
+ " <td>...</td>\n",
1432
+ " <td>...</td>\n",
1433
+ " <td>...</td>\n",
1434
+ " <td>...</td>\n",
1435
+ " </tr>\n",
1436
+ " <tr>\n",
1437
+ " <th>195</th>\n",
1438
+ " <td>1032</td>\n",
1439
+ " <td>circle</td>\n",
1440
+ " <td>2023年3月期の保険の数値は何%か</td>\n",
1441
+ " <td>6.1</td>\n",
1442
+ " <td>{'bytes': b'\\x89PNG\\r\\n\\x1a\\n\\x00\\x00\\x00\\rIHD...</td>\n",
1443
+ " </tr>\n",
1444
+ " <tr>\n",
1445
+ " <th>196</th>\n",
1446
+ " <td>1311</td>\n",
1447
+ " <td>circle</td>\n",
1448
+ " <td>地域別累積投資比率ではどの国が一番割合を占めているか。</td>\n",
1449
+ " <td>日本</td>\n",
1450
+ " <td>{'bytes': b'\\x89PNG\\r\\n\\x1a\\n\\x00\\x00\\x00\\rIHD...</td>\n",
1451
+ " </tr>\n",
1452
+ " <tr>\n",
1453
+ " <th>197</th>\n",
1454
+ " <td>1312</td>\n",
1455
+ " <td>circle</td>\n",
1456
+ " <td>中国の数値は何%か</td>\n",
1457
+ " <td>15</td>\n",
1458
+ " <td>{'bytes': b'\\x89PNG\\r\\n\\x1a\\n\\x00\\x00\\x00\\rIHD...</td>\n",
1459
+ " </tr>\n",
1460
+ " <tr>\n",
1461
+ " <th>198</th>\n",
1462
+ " <td>1397</td>\n",
1463
+ " <td>circle</td>\n",
1464
+ " <td>2021年の社内取締役比率は何%か</td>\n",
1465
+ " <td>54.5</td>\n",
1466
+ " <td>{'bytes': b'\\x89PNG\\r\\n\\x1a\\n\\x00\\x00\\x00\\rIHD...</td>\n",
1467
+ " </tr>\n",
1468
+ " <tr>\n",
1469
+ " <th>199</th>\n",
1470
+ " <td>1398</td>\n",
1471
+ " <td>circle</td>\n",
1472
+ " <td>2022年の社内取締役比率は何%か</td>\n",
1473
+ " <td>33.3</td>\n",
1474
+ " <td>{'bytes': b'\\x89PNG\\r\\n\\x1a\\n\\x00\\x00\\x00\\rIHD...</td>\n",
1475
+ " </tr>\n",
1476
+ " </tbody>\n",
1477
+ "</table>\n",
1478
+ "<p>200 rows × 5 columns</p>\n",
1479
+ "</div>"
1480
+ ],
1481
+ "text/plain": [
1482
+ " id type question answer \\\n",
1483
+ "0 1 line 2022/3期の利益率は何%か 0.5 \n",
1484
+ "1 2 line 2024/3期の利益率は2023/3期より何%上がったか? 1.3 \n",
1485
+ "2 15 line グラフのタイトルは何か 売上高2019年比推移 \n",
1486
+ "3 16 line 23.1Qから24.3Qではどのくらい数字が上がったか? 25.4 \n",
1487
+ "4 17 line 配当性向が最も低い年は? 2019年 \n",
1488
+ ".. ... ... ... ... \n",
1489
+ "195 1032 circle 2023年3月期の保険の数値は何%か 6.1 \n",
1490
+ "196 1311 circle 地域別累積投資比率ではどの国が一番割合を占めているか。 日本 \n",
1491
+ "197 1312 circle 中国の数値は何%か 15 \n",
1492
+ "198 1397 circle 2021年の社内取締役比率は何%か 54.5 \n",
1493
+ "199 1398 circle 2022年の社内取締役比率は何%か 33.3 \n",
1494
+ "\n",
1495
+ " image \n",
1496
+ "0 {'bytes': b'\\x89PNG\\r\\n\\x1a\\n\\x00\\x00\\x00\\rIHD... \n",
1497
+ "1 {'bytes': b'\\x89PNG\\r\\n\\x1a\\n\\x00\\x00\\x00\\rIHD... \n",
1498
+ "2 {'bytes': b'\\x89PNG\\r\\n\\x1a\\n\\x00\\x00\\x00\\rIHD... \n",
1499
+ "3 {'bytes': b'\\x89PNG\\r\\n\\x1a\\n\\x00\\x00\\x00\\rIHD... \n",
1500
+ "4 {'bytes': b'\\x89PNG\\r\\n\\x1a\\n\\x00\\x00\\x00\\rIHD... \n",
1501
+ ".. ... \n",
1502
+ "195 {'bytes': b'\\x89PNG\\r\\n\\x1a\\n\\x00\\x00\\x00\\rIHD... \n",
1503
+ "196 {'bytes': b'\\x89PNG\\r\\n\\x1a\\n\\x00\\x00\\x00\\rIHD... \n",
1504
+ "197 {'bytes': b'\\x89PNG\\r\\n\\x1a\\n\\x00\\x00\\x00\\rIHD... \n",
1505
+ "198 {'bytes': b'\\x89PNG\\r\\n\\x1a\\n\\x00\\x00\\x00\\rIHD... \n",
1506
+ "199 {'bytes': b'\\x89PNG\\r\\n\\x1a\\n\\x00\\x00\\x00\\rIHD... \n",
1507
+ "\n",
1508
+ "[200 rows x 5 columns]"
1509
+ ]
1510
+ },
1511
+ "execution_count": 9,
1512
+ "metadata": {},
1513
+ "output_type": "execute_result"
1514
+ }
1515
+ ],
1516
+ "source": [
1517
+ "output_df = merged_df.loc[:,['id','type','question','answer','image']]\n",
1518
+ "output_df"
1519
+ ]
1520
+ },
1521
+ {
1522
+ "cell_type": "code",
1523
+ "execution_count": null,
1524
+ "metadata": {},
1525
+ "outputs": [],
1526
+ "source": [
1527
+ "output_df.to_parquet(\"./jgraphqa.parquet\")"
1528
+ ]
1529
+ },
1530
+ {
1531
+ "cell_type": "code",
1532
+ "execution_count": null,
1533
+ "metadata": {},
1534
+ "outputs": [],
1535
+ "source": []
1536
+ }
1537
+ ],
1538
+ "metadata": {
1539
+ "colab": {
1540
+ "provenance": []
1541
+ },
1542
+ "kernelspec": {
1543
+ "display_name": "Python 3",
1544
+ "name": "python3"
1545
+ },
1546
+ "language_info": {
1547
+ "codemirror_mode": {
1548
+ "name": "ipython",
1549
+ "version": 3
1550
+ },
1551
+ "file_extension": ".py",
1552
+ "mimetype": "text/x-python",
1553
+ "name": "python",
1554
+ "nbconvert_exporter": "python",
1555
+ "pygments_lexer": "ipython3",
1556
+ "version": "3.10.12"
1557
+ }
1558
+ },
1559
+ "nbformat": 4,
1560
+ "nbformat_minor": 0
1561
+ }
jgraphqa.yaml ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ dataset_path: parquet
2
+ dataset_kwargs:
3
+ data_files: {'test': 'PATH_TO_PARQUET_FILE'}
4
+ task: "jgraphqa"
5
+ test_split: test
6
+ output_type: generate_until
7
+ doc_to_visual: !function utils.jgraphqa_doc_to_visual
8
+ doc_to_text: !function utils.jgraphqa_doc_to_text
9
+ doc_to_target: "answer"
10
+ generation_kwargs:
11
+ max_new_tokens: 256
12
+ temperature: 0
13
+ do_sample: False
14
+ process_results: !function utils.jgraphqa_process_results
15
+ metric_list:
16
+ - metric: jgraphqa_acc
17
+ aggregation: !function utils.jgraphqa_aggregate_results
18
+ higher_is_better: true
19
+ metadata:
20
+ - version: 0.0
21
+ lmms_eval_specific_kwargs:
22
+ default:
23
+ pre_prompt: ""
24
+ post_prompt: "。質問に対する回答を単語や短いフレーズで記入してください。"
25
+ qwen_vl:
26
+ pre_prompt: ""
27
+ post_prompt: " Answer:"
28
+
llava_onevision.py ADDED
@@ -0,0 +1,814 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Adopted from lmms-eval from https://github.com/EvolvingLMMs-Lab/lmms-eval. Below is the original copyright:
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ # This file was originally obtained from:
16
+ # https://github.com/EvolvingLMMs-Lab/lmms-eval/blob/main/lmms_eval/models/llava_onevision.py
17
+ #
18
+ # Minor modification by Akira Kinoshita on 2025-07-24:
19
+
20
+ import copy
21
+ import json
22
+ import logging
23
+ import math
24
+ import re
25
+ import warnings
26
+ from datetime import timedelta
27
+ from typing import List, Optional, Tuple, Union
28
+
29
+ import numpy as np
30
+ import PIL
31
+ import torch
32
+ import transformers
33
+ from accelerate import Accelerator, DistributedType, InitProcessGroupKwargs
34
+ from accelerate.state import AcceleratorState
35
+ from decord import VideoReader, cpu
36
+ from packaging import version
37
+ from tqdm import tqdm
38
+ from transformers import AutoConfig
39
+
40
+ from lmms_eval import utils
41
+ from lmms_eval.api.instance import Instance
42
+ from lmms_eval.api.model import lmms
43
+ from lmms_eval.api.registry import register_model
44
+ from lmms_eval.models.model_utils.load_video import read_video_pyav
45
+
46
+ # Suppress warnings
47
+ warnings.filterwarnings("ignore")
48
+
49
+ # Configure logging
50
+ eval_logger = logging.getLogger("lmms-eval")
51
+
52
+ # Enable TF32 for CUDA
53
+ torch.backends.cuda.matmul.allow_tf32 = True
54
+
55
+ # Import LLaVA modules
56
+ try:
57
+ from llava.constants import (
58
+ DEFAULT_IM_END_TOKEN,
59
+ DEFAULT_IM_START_TOKEN,
60
+ DEFAULT_IMAGE_TOKEN,
61
+ IGNORE_INDEX,
62
+ IMAGE_TOKEN_INDEX,
63
+ )
64
+ from llava.conversation import SeparatorStyle, conv_templates
65
+ from llava.mm_utils import (
66
+ KeywordsStoppingCriteria,
67
+ get_model_name_from_path,
68
+ process_images,
69
+ tokenizer_image_token,
70
+ )
71
+ from llava.model.builder import load_pretrained_model
72
+ except ImportError as e:
73
+ eval_logger.debug(f"LLaVA is not installed. Please install LLaVA to use this model.\nError: {e}")
74
+
75
+
76
+ # Determine best attention implementation
77
+ if version.parse(torch.__version__) >= version.parse("2.1.2"):
78
+ best_fit_attn_implementation = "sdpa"
79
+ else:
80
+ best_fit_attn_implementation = "eager"
81
+
82
+
83
+ @register_model("llava_onevision")
84
+ class Llava_OneVision(lmms):
85
+ """
86
+ Llava Model
87
+ """
88
+
89
+ def __init__(
90
+ self,
91
+ pretrained: str = "lmms-lab/llava-onevision-qwen2-7b-ov",
92
+ truncation: Optional[bool] = True,
93
+ device: Optional[str] = "cuda:0",
94
+ batch_size: Optional[Union[int, str]] = 1,
95
+ model_name: Optional[str] = None,
96
+ attn_implementation: Optional[str] = best_fit_attn_implementation,
97
+ device_map: Optional[str] = "cuda:0",
98
+ conv_template: Optional[str] = "qwen_1_5",
99
+ use_cache: Optional[bool] = True,
100
+ truncate_context: Optional[bool] = False, # whether to truncate the context in generation, set it False for LLaVA-1.6
101
+ customized_config: Optional[str] = None, # ends in json
102
+ max_frames_num: Optional[int] = 32,
103
+ mm_spatial_pool_stride: Optional[int] = 2,
104
+ mm_spatial_pool_mode: Optional[str] = "bilinear",
105
+ token_strategy: Optional[str] = "single", # could be "single" or "multiple", "multiple" denotes adding multiple <image> tokens for each frame
106
+ video_decode_backend: str = "decord",
107
+ **kwargs,
108
+ ) -> None:
109
+ super().__init__()
110
+ # Do not use kwargs for now
111
+ assert kwargs == {}, f"Unexpected kwargs: {kwargs}"
112
+
113
+ accelerator_kwargs = InitProcessGroupKwargs(timeout=timedelta(weeks=52))
114
+ accelerator = Accelerator(kwargs_handlers=[accelerator_kwargs])
115
+ if accelerator.num_processes > 1:
116
+ self._device = torch.device(f"cuda:{accelerator.local_process_index}")
117
+ self.device_map = f"cuda:{accelerator.local_process_index}"
118
+ elif accelerator.num_processes == 1 and device_map == "auto":
119
+ self._device = torch.device(device)
120
+ self.device_map = device_map
121
+ else:
122
+ self._device = torch.device(f"cuda:{accelerator.local_process_index}")
123
+ self.device_map = f"cuda:{accelerator.local_process_index}"
124
+
125
+ llava_model_args = {
126
+ "multimodal": True,
127
+ }
128
+ if customized_config is not None:
129
+ llava_model_args["customized_config"] = customized_config
130
+ if attn_implementation is not None:
131
+ llava_model_args["attn_implementation"] = attn_implementation
132
+ if "use_flash_attention_2" in kwargs:
133
+ llava_model_args["use_flash_attention_2"] = kwargs["use_flash_attention_2"]
134
+ model_name = model_name if model_name is not None else get_model_name_from_path(pretrained)
135
+
136
+ self.pretrained = pretrained
137
+ self.token_strategy = token_strategy
138
+ self.max_frames_num = max_frames_num
139
+ self.mm_spatial_pool_stride = mm_spatial_pool_stride
140
+ self.mm_spatial_pool_mode = mm_spatial_pool_mode
141
+ self.video_decode_backend = video_decode_backend
142
+
143
+ overwrite_config = {}
144
+ overwrite_config["mm_spatial_pool_stride"] = self.mm_spatial_pool_stride
145
+ overwrite_config["mm_spatial_pool_mode"] = self.mm_spatial_pool_mode
146
+ cfg_pretrained = AutoConfig.from_pretrained(self.pretrained)
147
+
148
+ llava_model_args["overwrite_config"] = overwrite_config
149
+ try:
150
+ # Try to load the model with the multimodal argument
151
+ self._tokenizer, self._model, self._image_processor, self._max_length = load_pretrained_model(pretrained, None, model_name, device_map=self.device_map, **llava_model_args)
152
+ except TypeError:
153
+ # for older versions of LLaVA that don't have multimodal argument
154
+ llava_model_args.pop("multimodal", None)
155
+ self._tokenizer, self._model, self._image_processor, self._max_length = load_pretrained_model(pretrained, None, model_name, device_map=self.device_map, **llava_model_args)
156
+
157
+ self._config = self._model.config
158
+ self.model.eval()
159
+ self.truncation = truncation
160
+ self.batch_size_per_gpu = int(batch_size)
161
+ self.conv_template = conv_template
162
+ self.use_cache = use_cache
163
+ self.truncate_context = truncate_context
164
+ assert self.batch_size_per_gpu == 1, "Llava currently does not support batched generation. See https://github.com/haotian-liu/LLaVA/issues/754. HF Llava also has this issue."
165
+
166
+ if accelerator.num_processes > 1:
167
+ assert accelerator.distributed_type in [DistributedType.FSDP, DistributedType.MULTI_GPU, DistributedType.DEEPSPEED], "Unsupported distributed type provided. Only DDP and FSDP are supported."
168
+ # If you want to use DistributedType.DEEPSPEED, you have to run accelerate config before using the model
169
+ # Also, you have to select zero stage 0 (equivalent to DDP) in order to make the prepare model works
170
+ # I tried to set different parameters in the kwargs to let default zero 2 stage works, but it didn't work.
171
+ if accelerator.distributed_type == DistributedType.DEEPSPEED:
172
+ kwargs = {
173
+ "train_micro_batch_size_per_gpu": self.batch_size_per_gpu,
174
+ "train_batch_size": self.batch_size_per_gpu * accelerator.num_processes,
175
+ }
176
+ AcceleratorState().deepspeed_plugin.deepspeed_config_process(must_match=True, **kwargs)
177
+ eval_logger.info("Detected that you are using DistributedType.DEEPSPEED. Make sure you run `accelerate config` and set zero stage to 0")
178
+
179
+ if accelerator.distributed_type == DistributedType.FSDP or accelerator.distributed_type == DistributedType.DEEPSPEED:
180
+ self._model = accelerator.prepare(self.model)
181
+ else:
182
+ self._model = accelerator.prepare_model(self.model, evaluation_mode=True)
183
+ self.accelerator = accelerator
184
+ if self.accelerator.is_local_main_process:
185
+ eval_logger.info(f"Using {accelerator.num_processes} devices with data parallelism")
186
+ self._rank = self.accelerator.local_process_index
187
+ self._world_size = self.accelerator.num_processes
188
+
189
+ elif accelerator.num_processes == 1 and device_map == "auto":
190
+ eval_logger.info(f"Using {accelerator.num_processes} devices with tensor parallelism")
191
+ self._rank = 0
192
+ self._world_size = 1
193
+
194
+ else:
195
+ eval_logger.info(f"Using single device: {self._device}")
196
+ self.model.to(self._device)
197
+ self._rank = 0
198
+ self._world_size = 1
199
+
200
+ @property
201
+ def config(self):
202
+ # return the associated transformers.AutoConfig for the given pretrained model.
203
+ return self._config
204
+
205
+ @property
206
+ def tokenizer(self):
207
+ return self._tokenizer
208
+
209
+ @property
210
+ def model(self):
211
+ # returns the model, unwrapping it if using Accelerate
212
+ if hasattr(self, "accelerator"):
213
+ return self.accelerator.unwrap_model(self._model)
214
+ else:
215
+ return self._model
216
+
217
+ @property
218
+ def eot_token_id(self):
219
+ # we use EOT because end of *text* is more accurate for what we're doing than end of *sentence*
220
+ return self.tokenizer.eos_token_id
221
+
222
+ @property
223
+ def max_length(self):
224
+ return self._max_length
225
+
226
+ def pad_sequence(self, input_ids, batch_first, padding_value):
227
+ if self.tokenizer.padding_side == "left":
228
+ input_ids = [torch.flip(_input_ids, [0]) for _input_ids in input_ids]
229
+ input_ids = torch.nn.utils.rnn.pad_sequence(input_ids, batch_first=batch_first, padding_value=padding_value)
230
+ if self.tokenizer.padding_side == "left":
231
+ input_ids = torch.flip(input_ids, [1])
232
+ return input_ids
233
+
234
+ @property
235
+ def batch_size(self):
236
+ return self.batch_size_per_gpu
237
+
238
+ @property
239
+ def device(self):
240
+ return self._device
241
+
242
+ @property
243
+ def rank(self):
244
+ return self._rank
245
+
246
+ @property
247
+ def world_size(self):
248
+ return self._world_size
249
+
250
+ def tok_encode(self, string: str, left_truncate_len=None, add_special_tokens=None) -> List[int]:
251
+ """ """
252
+ add_special_tokens = False if add_special_tokens is None else add_special_tokens
253
+ encoding = self.tokenizer.encode(string, add_special_tokens=add_special_tokens)
254
+ # left-truncate the encoded context to be at most `left_truncate_len` tokens long
255
+ if left_truncate_len:
256
+ encoding = encoding[-left_truncate_len:]
257
+ return encoding
258
+
259
+ def tok_decode(self, tokens):
260
+ try:
261
+ return self.tokenizer.decode(tokens)
262
+ except:
263
+ return self.tokenizer.decode([tokens])
264
+
265
+ def loglikelihood(self, requests: List[Instance]) -> List[Tuple[float, bool]]:
266
+ res = []
267
+ pbar = tqdm(total=len(requests), disable=(self.rank != 0), desc="Model Responding")
268
+
269
+ origin_image_aspect_ratio = getattr(self._config, "image_aspect_ratio", None)
270
+
271
+ for contexts, doc_to_target, doc_to_visual, doc_id, task, split in [reg.args for reg in requests]:
272
+ visual = doc_to_visual(self.task_dict[task][split][doc_id])
273
+
274
+ if origin_image_aspect_ratio is not None and self._config.image_aspect_ratio != origin_image_aspect_ratio:
275
+ self._config.image_aspect_ratio = origin_image_aspect_ratio
276
+ eval_logger.info(f"Resetting image aspect ratio to {origin_image_aspect_ratio}")
277
+
278
+ if visual is None or visual == []:
279
+ visual = None
280
+ task_type = "text"
281
+ image_tensor = None
282
+ else:
283
+ if len(visual) > 1 or "image_aspect_ratio" not in self._config.__dict__:
284
+ self._config.image_aspect_ratio = "pad"
285
+ eval_logger.info(f"In Multi-Image setting, image aspect ratio: {self._config.image_aspect_ratio}")
286
+
287
+ if "task_type" in self.metadata and self.metadata["task_type"] == "video" and "sample_frames" in self.metadata:
288
+ assert type(visual) == list, "sample_frames must be specified for video task"
289
+ sample_indices = np.linspace(0, len(visual) - 1, self.metadata["sample_frames"], dtype=int)
290
+ visual = [visual[i] for i in sample_indices]
291
+ assert len(visual) == self.metadata["sample_frames"]
292
+
293
+ image_tensor = process_images(visual, self._image_processor, self._config)
294
+ if type(image_tensor) is list:
295
+ image_tensor = [_image.to(dtype=torch.float16, device=self.device) for _image in image_tensor]
296
+ else:
297
+ image_tensor = image_tensor.to(dtype=torch.float16, device=self.device)
298
+
299
+ task_type = "video"
300
+
301
+ # elif type(visual[0]) == PIL.Image.Image:
302
+ elif isinstance(visual[0], PIL.Image.Image):
303
+ # image_tensor = process_images(visual, self._image_processor, self._config)
304
+ inputs = self._image_processor(visual)
305
+ image_tensor = torch.tensor(inputs['pixel_values']).to(dtype=torch.float16, device=self.device)
306
+ image_tensor = [image_tensor]
307
+ # if type(image_tensor) is list:
308
+ # image_tensor = [_image.to(dtype=torch.float16, device=self.device) for _image in image_tensor]
309
+ # else:
310
+ # image_tensor = image_tensor.to(dtype=torch.float16, device=self.device)
311
+
312
+ task_type = "image"
313
+
314
+ elif type(visual[0]) == str:
315
+ image_tensor = []
316
+ try:
317
+ if self.video_decode_backend == "decord":
318
+ frames = self.load_video(visual, self.max_frames_num)
319
+ elif self.video_decode_backend == "pyav":
320
+ frames = read_video_pyav(visual[0], num_frm=self.max_frames_num)
321
+ frames = self._image_processor.preprocess(frames, return_tensors="pt")["pixel_values"].half().cuda()
322
+ image_tensor.append(frames)
323
+ except Exception as e:
324
+ eval_logger.error(f"Error {e} in loading video")
325
+ image_tensor = None
326
+
327
+ task_type = "video"
328
+
329
+ if image_tensor is not None and len(image_tensor) != 0 and DEFAULT_IMAGE_TOKEN not in contexts:
330
+ placeholder_count = len(visual) if isinstance(visual, list) else 1
331
+ if task_type == "video":
332
+ placeholder_count = len(frames) if self.token_strategy == "multiple" else 1
333
+ image_tokens = [DEFAULT_IMAGE_TOKEN] * placeholder_count
334
+ image_tokens = " ".join(image_tokens)
335
+ prompts_input = image_tokens + "\n" + contexts
336
+ else:
337
+ prompts_input = contexts
338
+
339
+ if "llama_3" in self.conv_template:
340
+ conv = copy.deepcopy(conv_templates[self.conv_template])
341
+ else:
342
+ conv = conv_templates[self.conv_template].copy()
343
+
344
+ conv.append_message(conv.roles[0], prompts_input)
345
+ conv.append_message(conv.roles[1], None)
346
+ prompt = conv.get_prompt()
347
+
348
+ input_ids = tokenizer_image_token(prompt, self.tokenizer, IMAGE_TOKEN_INDEX, return_tensors="pt").unsqueeze(0).to(self.device)
349
+
350
+ if type(doc_to_target) == str:
351
+ continuation = doc_to_target
352
+ else:
353
+ continuation = doc_to_target(self.task_dict[task][split][doc_id])
354
+
355
+ conv.messages[-1][1] = continuation
356
+ full_prompt = conv.get_prompt()
357
+ full_input_ids = tokenizer_image_token(full_prompt, self.tokenizer, IMAGE_TOKEN_INDEX, return_tensors="pt").unsqueeze(0).to(self.device)
358
+
359
+ labels = full_input_ids.clone()
360
+ labels[0, : input_ids.shape[1]] = -100
361
+
362
+ kwargs = {}
363
+ if task_type == "image":
364
+ kwargs["image_sizes"] = [[v.size[0], v.size[1]] for v in visual] if isinstance(visual, list) else [[visual.size[0], visual.size[1]]]
365
+ _image_grid_thw = torch.tensor(inputs['image_grid_thw'], dtype=torch.long)
366
+ kwargs["image_grid_thws"] = [_image_grid_thw]
367
+ elif task_type == "video":
368
+ kwargs["modalities"] = ["video"]
369
+ self._config.mm_spatial_pool_stride = self.mm_spatial_pool_stride
370
+ self._config.mm_spatial_pool_mode = self.mm_spatial_pool_mode
371
+
372
+ with torch.inference_mode():
373
+ outputs = self.model(input_ids=full_input_ids, labels=labels, images=image_tensor, use_cache=True, **kwargs)
374
+
375
+ loss = outputs["loss"]
376
+ logits = outputs["logits"]
377
+ greedy_tokens = logits.argmax(dim=-1)
378
+ cont_toks = full_input_ids[:, input_ids.shape[1] :]
379
+ greedy_tokens = greedy_tokens[:, input_ids.shape[1] : full_input_ids.shape[1]]
380
+ max_equal = (greedy_tokens == cont_toks).all()
381
+
382
+ res.append((float(loss.item()), bool(max_equal)))
383
+ pbar.update(1)
384
+
385
+ pbar.close()
386
+ return res
387
+
388
+ def flatten(self, input):
389
+ if not input or any(i is None for i in input):
390
+ return []
391
+ new_list = []
392
+ for i in input:
393
+ if i:
394
+ for j in i:
395
+ new_list.append(j)
396
+ return new_list
397
+
398
+ def load_video(self, video_path, max_frames_num):
399
+ if type(video_path) == str:
400
+ vr = VideoReader(video_path, ctx=cpu(0))
401
+ else:
402
+ vr = VideoReader(video_path[0], ctx=cpu(0))
403
+ total_frame_num = len(vr)
404
+ uniform_sampled_frames = np.linspace(0, total_frame_num - 1, max_frames_num, dtype=int)
405
+ frame_idx = uniform_sampled_frames.tolist()
406
+ spare_frames = vr.get_batch(frame_idx).asnumpy()
407
+ return spare_frames # (frames, height, width, channels)
408
+
409
+ def generate_until(self, requests: List[Instance]) -> List[str]:
410
+ res = []
411
+
412
+ def _collate(x):
413
+ # the negative sign on len(toks) sorts descending - this has a few advantages:
414
+ # - time estimates will always be over not underestimates, which is more useful for planning
415
+ # - to know the size of a batch when going through the list, you know the first one is always the batch
416
+ # padded context length. this is useful to simplify the batching logic and more importantly to make
417
+ # automatic adaptive batches much much easier to implement
418
+ # - any OOMs will happen right away rather than near the end
419
+ toks = self.tok_encode(x[0])
420
+ return -len(toks), x[0]
421
+
422
+ # we group requests by their generation_kwargs,
423
+ # so that we don't try to execute e.g. greedy sampling and temp=0.8 sampling
424
+ # in the same batch.
425
+ metadata = requests[0].metadata
426
+ re_ords = utils.Collator([reg.args for reg in requests], _collate, grouping=True)
427
+ chunks = re_ords.get_batched(n=self.batch_size, batch_fn=None)
428
+ num_iters = len(requests) // self.batch_size if len(requests) % self.batch_size == 0 else len(requests) // self.batch_size + 1
429
+ pbar = tqdm(total=num_iters, disable=(self.rank != 0), desc="Model Responding")
430
+
431
+ origin_image_aspect_ratio = getattr(self._config, "image_aspect_ratio", None)
432
+
433
+ for chunk in chunks:
434
+ batched_contexts, all_gen_kwargs, batched_doc_to_visual, batched_doc_id, batched_task, batched_split = zip(*chunk)
435
+ task = batched_task[0]
436
+ split = batched_split[0]
437
+ batched_visuals = [batched_doc_to_visual[0](self.task_dict[task][split][ids]) for ids in batched_doc_id] # [B, N]
438
+ assert len(batched_visuals) == 1
439
+
440
+ # we assume all gen kwargs in the batch are the same
441
+ # this is safe to assume because the `grouper` object ensures it.
442
+ gen_kwargs = all_gen_kwargs[0]
443
+ if "until" in gen_kwargs:
444
+ gen_kwargs.pop("until")
445
+
446
+ question_input = []
447
+ # import ipdb; ipdb.set_trace()
448
+ for visual, context in zip(batched_visuals, batched_contexts):
449
+ if origin_image_aspect_ratio is not None and self._config.image_aspect_ratio != origin_image_aspect_ratio:
450
+ self._config.image_aspect_ratio = origin_image_aspect_ratio
451
+ eval_logger.info(f"Resetting image aspect ratio to {origin_image_aspect_ratio}")
452
+
453
+ if visual is None or visual == []: # for text-only tasks.
454
+ visual = None
455
+ task_type = "text"
456
+ placeholder_count = 0
457
+ image_tensor = None
458
+ else:
459
+ if len(visual) > 1 or "image_aspect_ratio" not in self._config.__dict__: # for multi image case, we treat per image aspect ratio as "pad" by default.
460
+ self._config.image_aspect_ratio = getattr(gen_kwargs, "image_aspect_ratio", "pad")
461
+ eval_logger.info(f"In Multi-Image setting, image aspect ratio: {self._config.image_aspect_ratio}")
462
+
463
+ if "task_type" in metadata and metadata["task_type"] == "video" and "sample_frames" in metadata: # overwrite logic for video task with multiple static image frames
464
+ assert type(visual) == list, "sample_frames must be specified for video task"
465
+ sample_indices = np.linspace(0, len(visual) - 1, metadata["sample_frames"], dtype=int)
466
+ visual = [visual[i] for i in sample_indices]
467
+ assert len(visual) == metadata["sample_frames"]
468
+
469
+ image_tensor = process_images(visual, self._image_processor, self._config)
470
+ if type(image_tensor) is list:
471
+ image_tensor = [_image.to(dtype=torch.float16, device=self.device) for _image in image_tensor]
472
+ else:
473
+ image_tensor = image_tensor.to(dtype=torch.float16, device=self.device)
474
+
475
+ task_type = "video"
476
+ placeholder_count = 1
477
+
478
+ elif type(visual[0]) == PIL.Image.Image: # For image, multi-image tasks
479
+ # image_tensor = process_images(visual, self._image_processor, self._config)
480
+ inputs = self._image_processor(visual)
481
+ image_tensor = torch.tensor(inputs['pixel_values']).to(dtype=torch.float16, device=self.device)
482
+ image_tensor = [image_tensor]
483
+ if type(image_tensor) is list:
484
+ image_tensor = [_image.to(dtype=torch.float16, device=self.device) for _image in image_tensor]
485
+ else:
486
+ image_tensor = image_tensor.to(dtype=torch.float16, device=self.device)
487
+
488
+ task_type = "image"
489
+ placeholder_count = len(visual) if isinstance(visual, list) else 1
490
+
491
+ elif type(visual[0]) == str: # For video task
492
+ image_tensor = []
493
+ try:
494
+ if self.video_decode_backend == "decord":
495
+ frames = self.load_video(visual, self.max_frames_num)
496
+ elif self.video_decode_backend == "pyav":
497
+ frames = read_video_pyav(visual[0], num_frm=self.max_frames_num)
498
+ frames = self._image_processor.preprocess(frames, return_tensors="pt")["pixel_values"].half().cuda()
499
+ image_tensor.append(frames)
500
+ except Exception as e:
501
+ eval_logger.error(f"Error {e} in loading video")
502
+ image_tensor = None
503
+
504
+ task_type = "video"
505
+ placeholder_count = len(frames) if self.token_strategy == "multiple" else 1
506
+
507
+ if image_tensor is not None and len(image_tensor) != 0 and DEFAULT_IMAGE_TOKEN not in context:
508
+ """
509
+ Three senarios:
510
+ 1. No image, and there for, no image token should be added.
511
+ 2. image token is already specified in the context, so we don't need to add it.
512
+ 3. image token is not specified in the context and there is image inputs, so we need to add it. In this case, we add the image token at the beginning of the context and add a new line.
513
+ 4. For video tasks, we could add a <image> token or multiple <image> tokens for each frame in the context. This depends on the training strategy and should balance in test to decide which is better
514
+ """
515
+ # if task_type == "image": # indeed in multi-image case, not the video in frames.
516
+ # image_tokens = [DEFAULT_IMAGE_TOKEN] * placeholder_count if isinstance(visual, list) else [DEFAULT_IMAGE_TOKEN]
517
+ # elif task_type == "video":
518
+ # image_tokens = [DEFAULT_IMAGE_TOKEN] * placeholder_count if self.token_strategy == "multiple" else [DEFAULT_IMAGE_TOKEN]
519
+ image_tokens = [DEFAULT_IMAGE_TOKEN] * placeholder_count
520
+ image_tokens = " ".join(image_tokens)
521
+ question = image_tokens + "\n" + context
522
+ else:
523
+ question = context
524
+
525
+ # This is much safer for llama3, as we now have some object type in it
526
+ if "llama_3" in self.conv_template:
527
+ conv = copy.deepcopy(conv_templates[self.conv_template])
528
+ else:
529
+ conv = conv_templates[self.conv_template].copy()
530
+
531
+ if utils.is_json(question): # conversational question input
532
+ question = json.loads(question)
533
+ for idx, item in enumerate(question):
534
+ role = conv.roles[idx % 2]
535
+ message = item["value"]
536
+ conv.append_message(role, message)
537
+
538
+ assert len(conv.messages) % 2 == 1
539
+ conv.append_message(conv.roles[1], None)
540
+ prompt_question = conv.get_prompt()
541
+ question_input.append(prompt_question)
542
+ else: # only simple string for question
543
+ conv.append_message(conv.roles[0], question)
544
+ conv.append_message(conv.roles[1], None)
545
+ prompt_question = conv.get_prompt()
546
+ question_input.append(prompt_question)
547
+
548
+ # preconfigure gen_kwargs with defaults
549
+ if "max_new_tokens" not in gen_kwargs:
550
+ gen_kwargs["max_new_tokens"] = 1024
551
+ if "temperature" not in gen_kwargs:
552
+ gen_kwargs["temperature"] = 0
553
+ if "do_sample" not in gen_kwargs:
554
+ gen_kwargs["do_sample"] = False
555
+ if "top_p" not in gen_kwargs:
556
+ gen_kwargs["top_p"] = None
557
+ if "num_beams" not in gen_kwargs:
558
+ gen_kwargs["num_beams"] = 1
559
+
560
+ input_ids_list = [tokenizer_image_token(prompt, self.tokenizer, IMAGE_TOKEN_INDEX, return_tensors="pt") for prompt in question_input]
561
+ pad_token_ids = self.tokenizer.pad_token_id if self.tokenizer.pad_token_id is not None else self.tokenizer.eos_token_id
562
+ input_ids = self.pad_sequence(input_ids_list, batch_first=True, padding_value=pad_token_ids).to(self.device)
563
+ attention_masks = input_ids.ne(pad_token_ids).to(self.device)
564
+
565
+ if task_type == "image":
566
+ gen_kwargs["image_sizes"] = [batched_visuals[0][idx].size for idx in range(len(batched_visuals[0]))]
567
+ _image_grid_thw = torch.tensor(inputs['image_grid_thw'], dtype=torch.long)
568
+ gen_kwargs["image_grid_thws"] = [_image_grid_thw]
569
+ elif task_type == "video":
570
+ stop_str = conv.sep if conv.sep_style != SeparatorStyle.TWO else conv.sep2
571
+ keywords = [stop_str]
572
+ stopping_criteria = KeywordsStoppingCriteria(keywords, self.tokenizer, input_ids)
573
+ gen_kwargs["modalities"] = ["video"]
574
+ gen_kwargs["stopping_criteria"] = [stopping_criteria]
575
+ self._config.mm_spatial_pool_stride = self.mm_spatial_pool_stride
576
+ self._config.mm_spatial_pool_mode = self.mm_spatial_pool_mode
577
+
578
+ # These steps are not in LLaVA's original code, but are necessary for generation to work
579
+ # TODO: attention to this major generation step...
580
+ if "image_aspect_ratio" in gen_kwargs.keys():
581
+ gen_kwargs.pop("image_aspect_ratio")
582
+ try:
583
+ with torch.inference_mode():
584
+ cont = self.model.generate(input_ids, attention_mask=attention_masks, pad_token_id=pad_token_ids, images=image_tensor, use_cache=self.use_cache, **gen_kwargs)
585
+ # cont = self.model.generate(qwen_input_ids, pad_token_id=pad_token_ids, images=image_tensor, use_cache=self.use_cache, **gen_kwargs)
586
+
587
+ text_outputs = self.tokenizer.batch_decode(cont, skip_special_tokens=True)
588
+ except Exception as e:
589
+ raise e
590
+
591
+ text_outputs = [response.strip() for response in text_outputs]
592
+ res.extend(text_outputs)
593
+ self.cache_hook.add_partial("generate_until", (context, gen_kwargs), text_outputs)
594
+ pbar.update(1)
595
+ # reorder this group of results back to original unsorted form
596
+ res = re_ords.get_original(res)
597
+
598
+ pbar.close()
599
+ return res
600
+
601
+ def generate_until_multi_round(self, requests: List[Instance]) -> List[str]:
602
+ res = []
603
+
604
+ def _collate(x):
605
+ # the negative sign on len(toks) sorts descending - this has a few advantages:
606
+ # - time estimates will always be over not underestimates, which is more useful for planning
607
+ # - to know the size of a batch when going through the list, you know the first one is always the batch
608
+ # padded context length. this is useful to simplify the batching logic and more importantly to make
609
+ # automatic adaptive batches much much easier to implement
610
+ # - any OOMs will happen right away rather than near the end
611
+ toks = self.tok_encode(x[0])
612
+ return -len(toks), x[0]
613
+
614
+ # we group requests by their generation_kwargs,
615
+ # so that we don't try to execute e.g. greedy sampling and temp=0.8 sampling
616
+ # in the same batch.
617
+ metadata = requests[0].metadata
618
+ re_ords = utils.Collator([reg.args for reg in requests], _collate, grouping=True)
619
+ chunks = re_ords.get_batched(n=self.batch_size, batch_fn=None)
620
+ num_iters = len(requests) // self.batch_size if len(requests) % self.batch_size == 0 else len(requests) // self.batch_size + 1
621
+ pbar = tqdm(total=num_iters, disable=(self.rank != 0), desc="Model Responding")
622
+
623
+ origin_image_aspect_ratio = getattr(self._config, "image_aspect_ratio", None)
624
+
625
+ for chunk in chunks:
626
+ batched_contexts, all_gen_kwargs, batched_doc_to_visual, batched_doc_to_text, batched_doc_id, batched_task, batched_split = zip(*chunk)
627
+ task = batched_task[0]
628
+ split = batched_split[0]
629
+ batched_visuals = [batched_doc_to_visual[0](self.task_dict[task][split][ids]) for ids in batched_doc_id] # [B, N]
630
+ assert len(batched_visuals) == 1
631
+
632
+ # we assume all gen kwargs in the batch are the same
633
+ # this is safe to assume because the `grouper` object ensures it.
634
+ gen_kwargs = all_gen_kwargs[0]
635
+ if "until" in gen_kwargs:
636
+ gen_kwargs.pop("until")
637
+
638
+ # multi round inference: terminate when receiving signal from the doc_to_text
639
+ round_idx = 0
640
+ batched_round_res = []
641
+ batched_previous_round_info = None
642
+ while True:
643
+ question_input = []
644
+
645
+ if round_idx != 0: # get current round visual and context from doc_to_text function
646
+ batched_visuals, batched_contexts, batched_terminal_singal, batched_round_res, batched_previous_round_info = list(
647
+ zip(
648
+ *[
649
+ batched_doc_to_text[0](
650
+ self.task_dict[task][split][ids],
651
+ previous_output=[round_res[ids_idx] for round_res in batched_round_res],
652
+ round_idx=round_idx,
653
+ previous_round_info=batched_previous_round_info[ids_idx] if batched_previous_round_info is not None else None,
654
+ )
655
+ for ids_idx, ids in enumerate(batched_doc_id)
656
+ ]
657
+ )
658
+ )
659
+ # import ipdb; ipdb.set_trace()
660
+ batched_round_res = list(zip(*batched_round_res)) # [(r1_1, r1_2), (r2_1, r2_2), ...]
661
+ if batched_terminal_singal[0]: # terminal signal from doc_to_text function
662
+ break
663
+
664
+ for visual, context in zip(batched_visuals, batched_contexts):
665
+ if origin_image_aspect_ratio is not None and self._config.image_aspect_ratio != origin_image_aspect_ratio:
666
+ self._config.image_aspect_ratio = origin_image_aspect_ratio
667
+ eval_logger.info(f"Resetting image aspect ratio to {origin_image_aspect_ratio}")
668
+
669
+ if visual is None or visual == []: # for text-only tasks.
670
+ visual = None
671
+ task_type = "text"
672
+ placeholder_count = 0
673
+ image_tensor = None
674
+ else:
675
+ if len(visual) > 1 or "image_aspect_ratio" not in self._config.__dict__: # for multi image case, we treat per image aspect ratio as "pad" by default.
676
+ self._config.image_aspect_ratio = getattr(gen_kwargs, "image_aspect_ratio", "pad")
677
+ eval_logger.info(f"In Multi-Image setting, image aspect ratio: {self._config.image_aspect_ratio}")
678
+
679
+ if "task_type" in metadata and metadata["task_type"] == "video" and "sample_frames" in metadata: # overwrite logic for video task with multiple static image frames
680
+ assert type(visual) == list, "sample_frames must be specified for video task"
681
+ sample_indices = np.linspace(0, len(visual) - 1, metadata["sample_frames"], dtype=int)
682
+ visual = [visual[i] for i in sample_indices]
683
+ assert len(visual) == metadata["sample_frames"]
684
+
685
+ image_tensor = process_images(visual, self._image_processor, self._config)
686
+ if type(image_tensor) is list:
687
+ image_tensor = [_image.to(dtype=torch.float16, device=self.device) for _image in image_tensor]
688
+ else:
689
+ image_tensor = image_tensor.to(dtype=torch.float16, device=self.device)
690
+
691
+ task_type = "video"
692
+ placeholder_count = 1
693
+
694
+ elif type(visual[0]) == PIL.Image.Image: # For image, multi-image tasks
695
+ image_tensor = process_images(visual, self._image_processor, self._config)
696
+ if type(image_tensor) is list:
697
+ image_tensor = [_image.to(dtype=torch.float16, device=self.device) for _image in image_tensor]
698
+ else:
699
+ image_tensor = image_tensor.to(dtype=torch.float16, device=self.device)
700
+
701
+ task_type = "image"
702
+ placeholder_count = len(visual) if isinstance(visual, list) else 1
703
+
704
+ elif type(visual[0]) == str: # For video task
705
+ image_tensor = []
706
+ try:
707
+ if self.video_decode_backend == "decord":
708
+ frames = self.load_video(visual, self.max_frames_num)
709
+ elif self.video_decode_backend == "pyav":
710
+ frames = read_video_pyav(visual[0], num_frm=self.max_frames_num)
711
+ frames = self._image_processor.preprocess(frames, return_tensors="pt")["pixel_values"].half().cuda()
712
+ image_tensor.append(frames)
713
+ except Exception as e:
714
+ eval_logger.error(f"Error {e} in loading video")
715
+ image_tensor = None
716
+
717
+ task_type = "video"
718
+ placeholder_count = len(frames) if self.token_strategy == "multiple" else 1
719
+
720
+ if image_tensor is not None and len(image_tensor) != 0 and DEFAULT_IMAGE_TOKEN not in context:
721
+ """
722
+ Three senarios:
723
+ 1. No image, and there for, no image token should be added.
724
+ 2. image token is already specified in the context, so we don't need to add it.
725
+ 3. image token is not specified in the context and there is image inputs, so we need to add it. In this case, we add the image token at the beginning of the context and add a new line.
726
+ 4. For video tasks, we could add a <image> token or multiple <image> tokens for each frame in the context. This depends on the training strategy and should balance in test to decide which is better
727
+ """
728
+ # if task_type == "image": # indeed in multi-image case, not the video in frames.
729
+ # image_tokens = [DEFAULT_IMAGE_TOKEN] * placeholder_count if isinstance(visual, list) else [DEFAULT_IMAGE_TOKEN]
730
+ # elif task_type == "video":
731
+ # image_tokens = [DEFAULT_IMAGE_TOKEN] * placeholder_count if self.token_strategy == "multiple" else [DEFAULT_IMAGE_TOKEN]
732
+ image_tokens = [DEFAULT_IMAGE_TOKEN] * placeholder_count
733
+ image_tokens = " ".join(image_tokens)
734
+ question = image_tokens + "\n" + context
735
+ else:
736
+ question = context
737
+
738
+ # This is much safer for llama3, as we now have some object type in it
739
+ if "llama_3" in self.conv_template:
740
+ conv = copy.deepcopy(conv_templates[self.conv_template])
741
+ else:
742
+ conv = conv_templates[self.conv_template].copy()
743
+
744
+ if utils.is_json(question): # conversational question input
745
+ question = json.loads(question)
746
+ for idx, item in enumerate(question):
747
+ role = conv.roles[idx % 2]
748
+ message = item["value"]
749
+ conv.append_message(role, message)
750
+
751
+ assert len(conv.messages) % 2 == 1
752
+ conv.append_message(conv.roles[1], None)
753
+ prompt_question = conv.get_prompt()
754
+ question_input.append(prompt_question)
755
+ else: # only simple string for question
756
+ conv.append_message(conv.roles[0], question)
757
+ conv.append_message(conv.roles[1], None)
758
+ prompt_question = conv.get_prompt()
759
+ question_input.append(prompt_question)
760
+
761
+ # preconfigure gen_kwargs with defaults
762
+ if "max_new_tokens" not in gen_kwargs:
763
+ gen_kwargs["max_new_tokens"] = 1024
764
+ if "temperature" not in gen_kwargs:
765
+ gen_kwargs["temperature"] = 0
766
+ if "do_sample" not in gen_kwargs:
767
+ gen_kwargs["do_sample"] = False
768
+ if "top_p" not in gen_kwargs:
769
+ gen_kwargs["top_p"] = None
770
+ if "num_beams" not in gen_kwargs:
771
+ gen_kwargs["num_beams"] = 1
772
+
773
+ input_ids_list = [tokenizer_image_token(prompt, self.tokenizer, IMAGE_TOKEN_INDEX, return_tensors="pt") for prompt in question_input]
774
+ pad_token_ids = self.tokenizer.pad_token_id if self.tokenizer.pad_token_id is not None else self.tokenizer.eos_token_id
775
+ input_ids = self.pad_sequence(input_ids_list, batch_first=True, padding_value=pad_token_ids).to(self.device)
776
+ attention_masks = input_ids.ne(pad_token_ids).to(self.device)
777
+
778
+ if task_type == "image":
779
+ gen_kwargs["image_sizes"] = [batched_visuals[0][idx].size for idx in range(len(batched_visuals[0]))]
780
+ elif task_type == "video":
781
+ stop_str = conv.sep if conv.sep_style != SeparatorStyle.TWO else conv.sep2
782
+ keywords = [stop_str]
783
+ stopping_criteria = KeywordsStoppingCriteria(keywords, self.tokenizer, input_ids)
784
+ gen_kwargs["modalities"] = ["video"]
785
+ gen_kwargs["stopping_criteria"] = [stopping_criteria]
786
+ self._config.mm_spatial_pool_stride = self.mm_spatial_pool_stride
787
+ self._config.mm_spatial_pool_mode = self.mm_spatial_pool_mode
788
+
789
+ # These steps are not in LLaVA's original code, but are necessary for generation to work
790
+ # TODO: attention to this major generation step...
791
+ if "image_aspect_ratio" in gen_kwargs.keys():
792
+ gen_kwargs.pop("image_aspect_ratio")
793
+ try:
794
+ with torch.inference_mode():
795
+ cont = self.model.generate(input_ids, attention_mask=attention_masks, pad_token_id=pad_token_ids, images=image_tensor, use_cache=self.use_cache, **gen_kwargs)
796
+ # cont = self.model.generate(qwen_input_ids, pad_token_id=pad_token_ids, images=image_tensor, use_cache=self.use_cache, **gen_kwargs)
797
+
798
+ text_outputs = self.tokenizer.batch_decode(cont, skip_special_tokens=True)
799
+ except Exception as e:
800
+ raise e
801
+
802
+ text_outputs = [response.strip() for response in text_outputs]
803
+ batched_round_res.append(text_outputs)
804
+
805
+ round_idx += 1
806
+
807
+ res.extend(list(zip(*batched_round_res)))
808
+ self.cache_hook.add_partial("generate_until_multi_round", (context, gen_kwargs), batched_round_res)
809
+ pbar.update(1)
810
+ # reorder this group of results back to original unsorted form
811
+ res = re_ords.get_original(res)
812
+
813
+ pbar.close()
814
+ return res
source.csv ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ annotation_tag,citation_source_url,citation_company_name,citation_file_name,citation_pdf_url,local_file_name,page_no
2
+ 1-500/11359603927730a1c325f3_006.png,https://www.yaginet.co.jp/ir/library/presentation.html,������Ѓ��M,2024�N3���� ���Z�⑫��������,https://data.swcms.net/file/yaginet-corp/dam/jcr:08bfcdfe-c201-4ee5-b4a2-81c5e7684414/140120240509587890.pdf,140120240509587890.pdf,7
3
+ 1-500/13da97c1bc2fb4e725d49d_010.png,https://www.via-hd.co.jp/ir/library/session/,������Ѓ��B�A�E�z�[���f�B���O�X,2024�N�R���� ���Z�������,https://www.via-hd.co.jp/ir/library/session/assets/pdf/20240614.pdf,20240614.pdf,15
4
+ 1-500/141da1caf1c3b99f1ec4a9_026.png,https://www.okr-ind.co.jp/ir/supplemental-doc/,��q�H�Ɗ������,2023�N12�������Z��������,https://www.okr-ind.co.jp/wp/wp-content/uploads/20240221IR.pdf,20240221IR.pdf,27
5
+ 1-500/141da1caf1c3b99f1ec4a9_036.png,https://www.okr-ind.co.jp/ir/supplemental-doc/,��q�H�Ɗ������,2023�N12�������Z��������,https://www.okr-ind.co.jp/wp/wp-content/uploads/20240221IR.pdf,20240221IR.pdf,37
6
+ 1-500/14cb03f0a9ef31ee990171_051.png,https://openhouse-group.co.jp/ir/library/library_07.html,������ЃI�[�v���n�E�X�O���[�v,2024�N9���� ��Q�l���� ���Z��������,https://openhouse-group.co.jp/ir/upload_file/m005-m005_07/kessan_202492q.pdf,kessan_202492q.pdf,52
7
+ 1-500/14cb03f0a9ef31ee990171_052.png,https://openhouse-group.co.jp/ir/library/library_07.html,������ЃI�[�v���n�E�X�O���[�v,2024�N9���� ��Q�l���� ���Z��������,https://openhouse-group.co.jp/ir/upload_file/m005-m005_07/kessan_202492q.pdf,kessan_202492q.pdf,53
8
+ 1-500/14cb03f0a9ef31ee990171_054.png,https://openhouse-group.co.jp/ir/library/library_07.html,������ЃI�[�v���n�E�X�O���[�v,2024�N9���� ��Q�l���� ���Z��������,https://openhouse-group.co.jp/ir/upload_file/m005-m005_07/kessan_202492q.pdf,kessan_202492q.pdf,55
9
+ 1-500/14cb03f0a9ef31ee990171_057.png,https://openhouse-group.co.jp/ir/library/library_07.html,������ЃI�[�v���n�E�X�O���[�v,2024�N9���� ��Q�l���� ���Z��������,https://openhouse-group.co.jp/ir/upload_file/m005-m005_07/kessan_202492q.pdf,kessan_202492q.pdf,58
10
+ 1-500/14cb03f0a9ef31ee990171_061.png,https://openhouse-group.co.jp/ir/library/library_07.html,������ЃI�[�v���n�E�X�O���[�v,2024�N9���� ��Q�l���� ���Z��������,https://openhouse-group.co.jp/ir/upload_file/m005-m005_07/kessan_202492q.pdf,kessan_202492q.pdf,62
11
+ 1-500/154f7e7eeb18abc07b54f9_008.png,https://www.nittagroup.com/jp/investment/library/presentation/,�j�b�^�������,2024�N3�������Z���Z��������,https://pdf.irpocket.com/C5186/RLCz/yQ5k/EqhI.pdf,EqhI.pdf,10
12
+ 1-500/15b05762aec8614cd46548_006.png,https://photosynth.co.jp/ir/library/presentation/,�������Photosynth,2024�N12���� ��P�l���� ���Z��������,https://contents.xj-storage.jp/xcontents/AS71272/10081a80/3c3b/4bd7/a70f/d014c0f2a4ef/140120240515597492.pdf,140120240515597492.pdf,7
13
+ 1-500/170b36f8f22aec4d651d54_012.png,https://www.ystable.co.jp/corporate/ir/library4.html,������Ѓ��C�Y�e�[�u���R�[�|���[�V����,2024�N2���� ���Z��������,https://ssl4.eir-parts.net/doc/2798/ir_material2/228037/00.pdf,00.pdf,13
14
+ 1-500/184d24730e188a3782cde6_018.png,https://www.stella-chemifa.co.jp/ir/material/,�X�e���P�~�t�@�������,2024�N3���� �� �Z �� �� �� ��,https://www.stella-chemifa.co.jp/ir/material/files/IG_20240510.pdf,IG_20240510.pdf,19
15
+ 1-500/193bb0d846a01088535a67_008.png,https://www.ryugin.co.jp/corporate/news/73909/,�����������s,2024�N3�������Z���\,https://www.ryugin.co.jp/common/uploads/IRshiry20240510.pdf,IRshiry20240510.pdf,9
16
+ 1-500/193bb0d846a01088535a67_047.png,https://www.ryugin.co.jp/corporate/news/73909/,�����������s,2024�N3�������Z���\,https://www.ryugin.co.jp/common/uploads/IRshiry20240510.pdf,IRshiry20240510.pdf,48
17
+ 1-500/19c5c51865c56cefa0117d_053.png,https://www.sunfrt.co.jp/ir_info/ir_doc/statement-of-accounts/,�T���t�����e�B�A�s���Y�������,2024�N3���� ���Z��������,https://www.sunfrt.co.jp/news_release/files/2405_0005/240510_02.pdf,240510_02.pdf,54
18
+ 1-500/2d8f98263a80904ecc9a84_027.png,https://www.visional.inc/ja/ir/library/presentation.html,�r�W���i���������,FY2024/7 2Q ���Z��������,https://www.visional.inc/ja/ir/library/presentation/main/0/teaserItems1/0112/linkList/0/link/FY24_2Q_Financial_Release_JPN.pdf,FY24_2Q_Financial_Release_JPN.pdf,28
19
+ 1-500/2f3081ef18aebbeb549cce_010.png,https://www.gunmabank.co.jp/ir/library/materials/index.html,������ЌQ�n��s,2023�N9���� ���Z������,https://www.gunmabank.co.jp/ir/library/pdf/2023/ir1b.pdf,ir1b.pdf,11
20
+ 1-500/2fcd4247dac0286a9c6a93_013.png,https://www.nitto-kohki.co.jp/ir/library/supplemental/,�����H�튔�����,2024�N3�������� ���Z�������,https://ssl4.eir-parts.net/doc/6151/ir_material_for_fiscal_ym3/146020/00.pdf,00 (1).pdf,14
21
+ 1-500/3361d922cf953e40775aff_057.png,https://www.wadakohsan.co.jp/investors/library/library02,�a�c���Y�������,2024�N2�����i��58���j���Z��������,https://contents.xj-storage.jp/xcontents/89310/427e3da3/83dd/458d/97ba/f36260f528f5/20240419155225084s.pdf,20240419155225084s.pdf,57
22
+ 1-500/36d565bb3cecd5bed6c356_007.png,https://www.careergift.co.jp/ir/ir_library/ir_material.html,������ЃL�����A,2024 �N 9 ������ 3 �l���� ���Z��������,https://contents.xj-storage.jp/xcontents/AS71063/fa65ecd1/6cc8/418a/bcb2/97b2a690345e/140120240813571579.pdf,140120240813571579.pdf,8
23
+ 1-500/2f258b9d14ae2438ad1d27_021.png,https://ceres-inc.jp/ir/presentation/,������ЃZ���X,2024�N12������P�l�������Z��������,https://ssl4.eir-parts.net/doc/3696/ir_material_for_fiscal_ym1/154970/00.pdf,00 (2).pdf,22
24
+ 1-500/8f3c47f72a0bd0a74a9248_011.png,https://www.tohobank.co.jp/company/ir/library/data/,������Г��M��s,2023�N�x ���Z�̊T�v,https://www.tohobank.co.jp/assets/pdf/company/ir/library/data/2023/2023.pdf,2023.pdf,12
25
+ 1001-1500/7c7492bfd27e9ce500cdcb_019.png,https://www.okinawafg.co.jp/shareholder_investor/ir_presentation_materials/,������Ђ����Ȃ�t�B�i���V�����O���[�v,���Z�������,https://www.okinawafg.co.jp/_files/00054119/2023_9.pdf,2023_9.pdf,20
26
+ 1989ec528ade15352db518_034.png,https://www.rakus.co.jp/ir/materials/,������Ѓ��N�X,2024�N3�������Z��������,https://ssl4.eir-parts.net/doc/3923/tdnet/2439772/00.pdf,00 (3).pdf,35
27
+ 6036990c41c174cf7f3fe6_036.png,https://www.kyokuyo.co.jp/ir/library/presentation/index.html,������Ћɗm,2024�N3���� ��2�l�������Z IR�������,https://www.kyokuyo.co.jp/files/20231208.pdf,20231208.pdf,37
28
+ 6af889640c1db3a0b12f42_013.png,https://www.m-mart.co.jp/ir/library/presentations.html,������Ђl�}�[�g,��Q�S���i202�S�N�P�����j�ʊ����Z �y�� ��А�������,https://contents.xj-storage.jp/xcontents/AS02975/e4332490/97a4/4f82/a84c/9a2d0df48793/140120240321556567.pdf,140120240321556567.pdf,14
29
+ 825c06c9748934418136e8_026.png,https://www.frontier-mgmt.com/ir/library/presentation/,�t�����e�B�A�E�}�l�W�����g�������,2024�N12���� ��1�l�������Z��������,https://contents.xj-storage.jp/xcontents/AS71152/ab9da9a8/d064/4cbd/a05b/c59d9a690b4b/20240913090355285s.pdf,20240913090355285s.pdf,27
30
+ 9044be4bca6d19c644bc1e_011.png,https://www.sus-g.co.jp/ir/library/presentation/,������ЃG�X���[�G�X,2024�N�X����(FY2024)��Q�l�������Z�������,https://contents.xj-storage.jp/xcontents/AS97535/8fbd695c/53a4/4ba8/9ec3/3b8a9e803113/140120240515597728.pdf,140120240515597728.pdf,12
31
+ 9082633c6abe7a7036af2c_040.png,https://www.eole.co.jp/ir/library/presentations.html,������ЃC�I��,2024�N�x3�����@���Z�⑫��������,https://contents.xj-storage.jp/xcontents/AS02822/4ccd8b3d/f00f/46be/acdd/09f1a3599b1f/140120240514595634.pdf,140120240514595634.pdf,41
32
+ 9144b6564a3cdbe6175c99_046.png,https://www.ikk-grp.jp/ir/library/presentationmaterials.html,�A�C�E�P�C�E�P�C�z�[���f�B���O�X�������,2024�N10������1�l�������Z�i�⑫�����j,https://www.ikk-grp.jp/ir/library/presentationmaterials/main/0/teaserItems1/06/linkList/00/link/20240314setsumei.pdf,20240314setsumei.pdf,47
33
+ 9559b5b3666430666ce6ac_004.png,https://www.fkd.co.jp/ir/library/earning/,��������c�g,2023�N12�����@���Z��������,https://www.fkd.co.jp/wp-content/uploads/2024/02/2023_explain.pdf,2023_explain.pdf,5
34
+ a0d9f3d0568a96c2c69a78_006.png,https://www.j-oil.com/ir/library/presentation.html,�������J-�I�C���~���Y,2024�N3�����i2023�N�x�j ��3�l�������Z�T��,https://ssl4.eir-parts.net/doc/2613/tdnet/2391420/00.pdf,00 (4).pdf,7
35
+ abba4faad8b25cea956d9a_057.png,https://inforich.net/ir/library/presentation/,�������INFORICH,2024�N12���� ��1�l���� ���Z��������,https://ssl4.eir-parts.net/doc/9338/tdnet/2438609/00.pdf,00 (5).pdf,60
36
+ b9a5e74bca727f9823dd24_021.png,https://www.b-lot.co.jp/ir/briefings.html,������Ѓr�[���b�g,2023�N12�������Z��������,https://ssl4.eir-parts.net/doc/3452/ir_material_for_fiscal_ym1/150627/00.pdf,00 (6).pdf,22
37
+ c0947ec7c71c42ed77d07d_005.png,https://www.dhtd.co.jp/ir/lib/quarterly_report.html,�_�C�n�c�f�B�[�[���������,2024�N3���� ��2�l�������Z��������,https://ssl4.eir-parts.net/doc/6023/ir_material_for_fiscal_ym/144274/00.pdf,00 (7).pdf,6
38
+ c0b2ff883a7f9b2588fd5d_038.png,https://www.dinsgr.co.jp/ir/library/presentation/,?�h�‹��������,2024�N�R�������Z��������,https://ssl4.eir-parts.net/doc/9336/tdnet/2435490/00.pdf,00 (8).pdf,39
39
+ r1/GMO�y�C�����g�Q�[�g�E�F�C_2022�N9����_�y�[�W11.jpg,https://www.gmo-pg.com/ir/library/presentation/,GMO�y�C�����g�Q�[�g�E�F�C�������,2022 �N�X���� ���Z������,https://www.gmo-pg.com/news/pdf/20221115_gmo-pg_kessan.pdf,20221115_gmo-pg_kessan.pdf,11
40
+ r1/GMO�y�C�����g�Q�[�g�E�F�C_2022�N9����_�y�[�W18.jpg,https://www.gmo-pg.com/ir/library/presentation/,GMO�y�C�����g�Q�[�g�E�F�C�������,2022 �N�X���� ���Z������,https://www.gmo-pg.com/news/pdf/20221115_gmo-pg_kessan.pdf,20221115_gmo-pg_kessan.pdf,18
41
+ r1/GMO�y�C�����g�Q�[�g�E�F�C_2022�N9����_�y�[�W30.jpg,https://www.gmo-pg.com/ir/library/presentation/,GMO�y�C�����g�Q�[�g�E�F�C�������,2022 �N�X���� ���Z������,https://www.gmo-pg.com/news/pdf/20221115_gmo-pg_kessan.pdf,20221115_gmo-pg_kessan.pdf,30
42
+ r1/GMO�y�C�����g�Q�[�g�E�F�C_2022�N9����_�y�[�W33.jpg,https://www.gmo-pg.com/ir/library/presentation/,GMO�y�C�����g�Q�[�g�E�F�C�������,2022 �N�X���� ���Z������,https://www.gmo-pg.com/news/pdf/20221115_gmo-pg_kessan.pdf,20221115_gmo-pg_kessan.pdf,33
43
+ r1/GMO�y�C�����g�Q�[�g�E�F�C_2022�N9����_�y�[�W35.jpg,https://www.gmo-pg.com/ir/library/presentation/,GMO�y�C�����g�Q�[�g�E�F�C�������,2022 �N�X���� ���Z������,https://www.gmo-pg.com/news/pdf/20221115_gmo-pg_kessan.pdf,20221115_gmo-pg_kessan.pdf,35
44
+ r1/GMO�y�C�����g�Q�[�g�E�F�C_2022�N9����_�y�[�W36.jpg,https://www.gmo-pg.com/ir/library/presentation/,GMO�y�C�����g�Q�[�g�E�F�C�������,2022 �N�X���� ���Z������,https://www.gmo-pg.com/news/pdf/20221115_gmo-pg_kessan.pdf,20221115_gmo-pg_kessan.pdf,36
45
+ r1/GMO�y�C�����g�Q�[�g�E�F�C_2022�N9����_�y�[�W38.jpg,https://www.gmo-pg.com/ir/library/presentation/,GMO�y�C�����g�Q�[�g�E�F�C�������,2022 �N�X���� ���Z������,https://www.gmo-pg.com/news/pdf/20221115_gmo-pg_kessan.pdf,20221115_gmo-pg_kessan.pdf,38
46
+ r1/GMO�y�C�����g�Q�[�g�E�F�C_2022�N9����_�y�[�W27.jpg,https://www.gmo-pg.com/ir/library/presentation/,GMO�y�C�����g�Q�[�g�E�F�C�������,2022 �N�X���� ���Z������,https://www.gmo-pg.com/news/pdf/20221115_gmo-pg_kessan.pdf,20221115_gmo-pg_kessan.pdf,27
47
+ r1/LIXIL_2023�N3����_�y�[�W05.jpg,https://www.lixil.com/jp/investor/ir_event/results.html,�������LIXIL,2023�N3?�����Z���������kIFRS�l,https://ssl4.eir-parts.net/doc/5938/tdnet/2268024/00.pdf,00 (9).pdf,5
48
+ r1/SBI�z�[���f�B���O�X_2023�N3����_�y�[�W117.jpg,https://www.sbigroup.co.jp/investors/disclosure/sbiholdings/,SBI�z�[���f�B���O�X�������,2023�N3����SBI�z�[���f�B���O�X������Ќ��Z������,https://www.sbigroup.co.jp/investors/library/presentation/pdf/presen230512.pdf,presen230512.pdf,117
49
+ r1/SBI�z�[���f�B���O�X_2023�N3����_�y�[�W120.jpg,https://www.sbigroup.co.jp/investors/disclosure/sbiholdings/,SBI�z�[���f�B���O�X�������,2023�N3����SBI�z�[���f�B���O�X������Ќ��Z������,https://www.sbigroup.co.jp/investors/library/presentation/pdf/presen230512.pdf,presen230512.pdf,120
50
+ r1/SBI�z�[���f�B���O�X_2023�N3����_�y�[�W121.jpg,https://www.sbigroup.co.jp/investors/disclosure/sbiholdings/,SBI�z�[���f�B���O�X�������,2023�N3����SBI�z�[���f�B���O�X������Ќ��Z������,https://www.sbigroup.co.jp/investors/library/presentation/pdf/presen230512.pdf,presen230512.pdf,121
51
+ r1/SBI�z�[���f�B���O�X_2023�N3����_�y�[�W129.jpg,https://www.sbigroup.co.jp/investors/disclosure/sbiholdings/,SBI�z�[���f�B���O�X�������,2023�N3����SBI�z�[���f�B���O�X������Ќ��Z������,https://www.sbigroup.co.jp/investors/library/presentation/pdf/presen230512.pdf,presen230512.pdf,129
52
+ r1/SBI�z�[���f�B���O�X_2023�N3����_�y�[�W178.jpg,https://www.sbigroup.co.jp/investors/disclosure/sbiholdings/,SBI�z�[���f�B���O�X�������,2023�N3����SBI�z�[���f�B���O�X������Ќ��Z������,https://www.sbigroup.co.jp/investors/library/presentation/pdf/presen230512.pdf,presen230512.pdf,178
53
+ r1/SBI�z�[���f�B���O�X_2023�N3����_�y�[�W19.jpg,https://www.sbigroup.co.jp/investors/disclosure/sbiholdings/,SBI�z�[���f�B���O�X�������,2023�N3����SBI�z�[���f�B���O�X������Ќ��Z������,https://www.sbigroup.co.jp/investors/library/presentation/pdf/presen230512.pdf,presen230512.pdf,19
54
+ r1/SBI�z�[���f�B���O�X_2023�N3����_�y�[�W24.jpg,https://www.sbigroup.co.jp/investors/disclosure/sbiholdings/,SBI�z�[���f�B���O�X�������,2023�N3����SBI�z�[���f�B���O�X������Ќ��Z������,https://www.sbigroup.co.jp/investors/library/presentation/pdf/presen230512.pdf,presen230512.pdf,24
55
+ r1/SBI�z�[���f�B���O�X_2023�N3����_�y�[�W43.jpg,https://www.sbigroup.co.jp/investors/disclosure/sbiholdings/,SBI�z�[���f�B���O�X�������,2023�N3����SBI�z�[���f�B���O�X������Ќ��Z������,https://www.sbigroup.co.jp/investors/library/presentation/pdf/presen230512.pdf,presen230512.pdf,43
56
+ r1/SBI�z�[���f�B���O�X_2023�N3����_�y�[�W47.jpg,https://www.sbigroup.co.jp/investors/disclosure/sbiholdings/,SBI�z�[���f�B���O�X�������,2023�N3����SBI�z�[���f�B���O�X������Ќ��Z������,https://www.sbigroup.co.jp/investors/library/presentation/pdf/presen230512.pdf,presen230512.pdf,47
57
+ r1/SBI�z�[���f�B���O�X_2023�N3����_�y�[�W48.jpg,https://www.sbigroup.co.jp/investors/disclosure/sbiholdings/,SBI�z�[���f�B���O�X�������,2023�N3����SBI�z�[���f�B���O�X������Ќ��Z������,https://www.sbigroup.co.jp/investors/library/presentation/pdf/presen230512.pdf,presen230512.pdf,48
58
+ r1/SBI�z�[���f�B���O�X_2023�N3����_�y�[�W50.jpg,https://www.sbigroup.co.jp/investors/disclosure/sbiholdings/,SBI�z�[���f�B���O�X�������,2023�N3����SBI�z�[���f�B���O�X������Ќ��Z������,https://www.sbigroup.co.jp/investors/library/presentation/pdf/presen230512.pdf,presen230512.pdf,50
59
+ r1/SBI�z�[���f�B���O�X_2023�N3����_�y�[�W51.jpg,https://www.sbigroup.co.jp/investors/disclosure/sbiholdings/,SBI�z�[���f�B���O�X�������,2023�N3����SBI�z�[���f�B���O�X������Ќ��Z������,https://www.sbigroup.co.jp/investors/library/presentation/pdf/presen230512.pdf,presen230512.pdf,51
60
+ r1/SBI�z�[���f�B���O�X_2023�N3����_�y�[�W52.jpg,https://www.sbigroup.co.jp/investors/disclosure/sbiholdings/,SBI�z�[���f�B���O�X�������,2023�N3����SBI�z�[���f�B���O�X������Ќ��Z������,https://www.sbigroup.co.jp/investors/library/presentation/pdf/presen230512.pdf,presen230512.pdf,52
61
+ r1/SBI�z�[���f�B���O�X_2023�N3����_�y�[�W62.jpg,https://www.sbigroup.co.jp/investors/disclosure/sbiholdings/,SBI�z�[���f�B���O�X�������,2023�N3����SBI�z�[���f�B���O�X������Ќ��Z������,https://www.sbigroup.co.jp/investors/library/presentation/pdf/presen230512.pdf,presen230512.pdf,62
62
+ r1/SBI�z�[���f�B���O�X_2023�N3����_�y�[�W77.jpg,https://www.sbigroup.co.jp/investors/disclosure/sbiholdings/,SBI�z�[���f�B���O�X�������,2023�N3����SBI�z�[���f�B���O�X������Ќ��Z������,https://www.sbigroup.co.jp/investors/library/presentation/pdf/presen230512.pdf,presen230512.pdf,77
63
+ r1/SCSK_2023�N3����_�y�[�W12.jpg,https://www.scsk.jp/ir/library/archives/index.html,SCSK�������,2�R�N�R���� �A���Ɛыy�� �Q4�N3�����A���Ɛї\�z�ɂ‚���,https://www.scsk.jp/ir/library/archives/pdf/scsk/20230428_presentation_2.pdf,20230428_presentation_2.pdf,12
64
+ r1/SCSK_2023�N3����_�y�[�W14.jpg,https://www.scsk.jp/ir/library/archives/index.html,SCSK�������,2�R�N�R���� �A���Ɛыy�� �Q4�N3�����A���Ɛї\�z�ɂ‚���,https://www.scsk.jp/ir/library/archives/pdf/scsk/20230428_presentation_2.pdf,20230428_presentation_2.pdf,14
65
+ r1/SG�z�[���f�B���O�X_2023�N3����_�y�[�W09.jpg,https://www.sg-hldgs.co.jp/ir/library/presentation/,SG�z�[���f�B���O�X�������,2023�N3�������Z��������,https://ssl4.eir-parts.net/doc/9143/ir_material_for_fiscal_ym/134260/00.pdf,00 (10).pdf,9
66
+ r1/TBS�z�[���f�B���O�X_2023�N3����_�y�[�W06.jpg,https://www.tbsholdings.co.jp/ir/library/presentation.html,�������TBS�z�[���f�B���O�X,2022�N�x ���Z����,https://www.tbsholdings.co.jp/ir/library/pdf/FY2022/2022_Q4.pdf?20230511,2022_Q4.pdf,6
67
+ r1/TBS�z�[���f�B���O�X_2023�N3����_�y�[�W24.jpg,https://www.tbsholdings.co.jp/ir/library/presentation.html,�������TBS�z�[���f�B���O�X,2022�N�x ���Z����,https://www.tbsholdings.co.jp/ir/library/pdf/FY2022/2022_Q4.pdf?20230511,2022_Q4.pdf,24
68
+ r1/TBS�z�[���f�B���O�X_2023�N3����_�y�[�W25.jpg,https://www.tbsholdings.co.jp/ir/library/presentation.html,�������TBS�z�[���f�B���O�X,2022�N�x ���Z����,https://www.tbsholdings.co.jp/ir/library/pdf/FY2022/2022_Q4.pdf?20230511,2022_Q4.pdf,25
69
+ r1/TBS�z�[���f�B���O�X_2023�N3����_�y�[�W34.jpg,https://www.tbsholdings.co.jp/ir/library/presentation.html,�������TBS�z�[���f�B���O�X,2022�N�x ���Z����,https://www.tbsholdings.co.jp/ir/library/pdf/FY2022/2022_Q4.pdf?20230511,2022_Q4.pdf,34
70
+ r1/TBS�z�[���f�B���O�X_2023�N3����_�y�[�W40.jpg,https://www.tbsholdings.co.jp/ir/library/presentation.html,�������TBS�z�[���f�B���O�X,2022�N�x ���Z����,https://www.tbsholdings.co.jp/ir/library/pdf/FY2022/2022_Q4.pdf?20230511,2022_Q4.pdf,40
71
+ 1e361ea46ac9d76aada84b_015.png,https://www.yamada-cg.co.jp/ir/library/briefing_session/,�R�c�R���T���e�B���O�O���[�v�������,2024�N3���� ���Z������,https://ssl4.eir-parts.net/doc/4792/ir_material_for_fiscal_ym1/155622/00.pdf,00 (11).pdf,16
72
+ 1e971a732d54ae699ceb30_017.png,https://www.raysum.co.jp/ir/library/,������Ѓ��[�T��,2024�N3�������Z��������,https://www.raysum.co.jp/wp/wp-content/uploads/2024/05/20240510_04.pdf,20240510_04.pdf,18
73
+ 1fb739a2f8488ffbe58a14_030.png,https://www.sanyo-steel.co.jp/shareholder/ir_document/shareholder11.php,�R�z���ꐻ�|�������,2023�N�x���Z�̊T�v,https://www.sanyo-steel.co.jp/system/upload/ir_data/20240430_3.pdf,20240430_3.pdf,31
74
+ 692ee4d0b17fef611f0a33_043.png,https://www.monexgroup.jp/jp/investor/ir_library/presentation.html,�}�l�b�N�X�O���[�v�������,�}�l�b�N�X�O���[�v2024�N3�������Z��������,https://www.monexgroup.jp/jp/investor/ir_library/presentation/main/018/teaserItems1/00/linkList/010/link/JP_FinancialResult_20240425.pdf,JP_FinancialResult_20240425.pdf,44
75
+ 6fb3a85950d29981ee8d26_012.png,https://www.osg.co.jp/about_us/ir/financial/ir-library/result.html,�I�[�G�X�W�[�������,2024�N11���� ��1�l���� ���Z��������,https://www.osg.co.jp/about_us/ir/financial/file/OSG_fy2024_1q_financialresultsreport_jp.pdf,OSG_fy2024_1q_financialresultsreport_jp.pdf,13
76
+ 720e3023878d51d4680323_006.png,https://www.nihonkohden.co.jp/ir/library/result.html,���{���d�H�Ɗ������,2024�N�R�������Z������,https://data.swcms.net/file/nihonkohden/dam/jcr:b8500594-311e-45ad-aef4-db259a484b89/140120240513592936.pdf,140120240513592936.pdf,7
77
+ 73768b18aa28f337b9a66e_037.png,https://www.goodcomasset.co.jp/investors/present.html,������ЃO�b�h�R���A�Z�b�g,2024�N10���� ��P�l���� ���Z��������,https://ssl4.eir-parts.net/doc/3475/ir_material_for_fiscal_ym/152510/00.pdf,00 (12).pdf,38
78
+ 799504937eb4fae1f3d0e1_015.png,http://www.hitocom-hd.com/ja/ir/library/presentation.html,������Ѓq�g�E�R�~���j�P�[�V�����Y�E�z�[���f�B���O�X,2024�N8���� ��2�l���� ���Z��������,http://www.hitocom-hd.com/ja/ir/library/presentation/main/01/teaserItems1/04/linkList/01/link/setsumei_202408_2Q_20240417.pdf,setsumei_202408_2Q_20240417.pdf,16
79
+ 866a8a62d3bda046cd4057_039.png,https://www.copro-h.co.jp/ir/library/briefing.html,������ЃR�v���E�z�[���f�B���O�X,2024�N3�����i18���j �ʊ����Z��������,https://www.copro-h.co.jp/ir/upload_file/m005-m005_07/presentationFYE2024.pdf,presentationFYE2024.pdf,40
80
+ 8a80b7d406c2bff66ef8b5_019.png,https://www.koryo-j.co.jp/ir/presen.html,���ˏZ�̊������,2023�N9���� ���Z��������,https://contents.xj-storage.jp/xcontents/AS01852/907a870d/d52c/4adc/9be7/8c10a94313d9/140120231130597278.pdf,140120231130597278.pdf,20
81
+ a59f14cea6a19e50bcfa0e_010.png,https://www.fibergate.co.jp/ir/presentation/#ir202406,������Ѓt�@�C�o�[�Q�[�g,2024�N6������3�l�������Z��������,https://ssl4.eir-parts.net/doc/9450/ir_material_for_fiscal_ym/155623/00.pdf,00 (13).pdf,11
82
+ b5dac8aeea6adb09f998d1_050.png,https://buysell-technologies.com/ir/settlement/,�������BuySell Technologies,2024�N12���� ��1�l���� ���Z��������,https://ssl4.eir-parts.net/doc/7685/tdnet/2438764/00.pdf,00 (14).pdf,51
83
+ bd0d8ccc4b4e8a2fa3aab1_081.png,https://www.uluru.biz/ir/presentation.html,������Ђ����,2024�N3���� �ʊ��y�ё�4�l���� ���Z��������,https://ssl4.eir-parts.net/doc/3979/ir_material_for_fiscal_ym2/155642/00.pdf,00 (15).pdf,82
84
+ r1/GMO�y�C�����g�Q�[�g�E�F�C_2022�N9����_�y�[�W26.jpg,https://www.gmo-pg.com/ir/library/presentation/,GMO�y�C�����g�Q�[�g�E�F�C�������,2022 �N�X���� ���Z������,https://www.gmo-pg.com/news/pdf/20221115_gmo-pg_kessan.pdf,20221115_gmo-pg_kessan.pdf,26
85
+ r1/TIS_2023�N3����_�y�[�W09.jpg,https://www.tis.co.jp/ir/finance/meeting/,TIS�������,2023�N3���� ���Z��������,https://www.tis.co.jp/documents/jp/ir/finance/meeting/230509_1.pdf,230509_1.pdf,9
86
+ r1/�A�C�V��_2023�N3����_�y�[�W14.jpg,https://www.aisin.com/jp/investors/settlement/,������ЃA�C�V��,2023�N3���� ���Z������,https://www.aisin.com/jp/investors/settlement/fy2023_q4_presentation-j.pdf,fy2023_q4_presentation-j.pdf,14
87
+ r1/�A�Y�r��_2023�N3����_�y�[�W53.jpg,https://www.azbil.com/jp/ir/library/result/,�A�Y�r���������,2022�N�x�i2023�N�R�����j ���Z��������,https://www.azbil.com/jp/ir/library/result/__icsFiles/afieldfile/2023/11/01/azbil_FY2022_4Q_amm-j-3.pdf,azbil_FY2022_4Q_amm-j-3.pdf,53
utils.py ADDED
@@ -0,0 +1,262 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Adopted from lmms-eval from https://github.com/EvolvingLMMs-Lab/lmms-eval. Below is the original copyright:
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ # This file was originally obtained from:
16
+ # https://github.com/EvolvingLMMs-Lab/lmms-eval/blob/main/lmms_eval/tasks/jmmmu/utils.py
17
+ #
18
+ # Minor modification by Akira Kinoshita on 2025-07-24:
19
+
20
+ from PIL import Image
21
+ import io
22
+ import re
23
+ from collections import defaultdict
24
+
25
+ def jgraphqa_doc_to_visual(doc):
26
+ img_data = doc["image"]["bytes"]
27
+ img = Image.open(io.BytesIO(img_data))
28
+ return [img.convert("RGB")]
29
+
30
+
31
+ def jgraphqa_doc_to_text(doc, lmms_eval_specific_kwargs):
32
+ question = doc["question"]
33
+ pre_prompt = lmms_eval_specific_kwargs["pre_prompt"]
34
+ post_prompt = lmms_eval_specific_kwargs["post_prompt"]
35
+ return f"{pre_prompt}{question}{post_prompt}"
36
+
37
+
38
+ def jgraphqa_process_results(doc, results):
39
+ pred = results[0]
40
+ parsed_pred = parse_open_response(pred)
41
+ id = doc["id"]
42
+ jgraphqa_acc = {"id": id, "subdomain": doc["type"], "answer": doc["answer"], "parsed_pred": parsed_pred}
43
+ return {
44
+ "jgraphqa_acc": jgraphqa_acc,
45
+ "submission": {
46
+ id: pred,
47
+ },
48
+ }
49
+
50
+
51
+ def jgraphqa_aggregate_results(results):
52
+ evaluation_result = {}
53
+ subset_to_eval_samples = defaultdict(list)
54
+ for result in results:
55
+ subset_to_eval_samples[result["subdomain"]].append(result)
56
+ for subset, sub_eval_samples in subset_to_eval_samples.items():
57
+ judge_dict, metric_dict = evaluate_jgraphqa(sub_eval_samples)
58
+ metric_dict.update({"num_example": len(sub_eval_samples)})
59
+ evaluation_result[subset] = metric_dict
60
+ printable_results = {}
61
+ for domain, in_domain_cats in DOMAIN_CAT2SUB_CAT.items():
62
+ in_domain_cat_results = {}
63
+ for cat_name in in_domain_cats:
64
+ if cat_name in evaluation_result.keys():
65
+ in_domain_cat_results[cat_name] = evaluation_result[cat_name]
66
+ else:
67
+ pass
68
+ in_domain_ins_acc = calculate_ins_level_acc(in_domain_cat_results)
69
+ in_domain_data_num = sum([cat_results["num_example"] for cat_results in in_domain_cat_results.values()])
70
+ printable_results["Overall-" + domain] = {
71
+ "num": int(in_domain_data_num),
72
+ "acc": round(in_domain_ins_acc, 5),
73
+ }
74
+ # add sub category
75
+ for cat_name, cat_results in in_domain_cat_results.items():
76
+ printable_results[cat_name] = {
77
+ "num": int(cat_results["num_example"]),
78
+ "acc": round(cat_results["acc"], 5),
79
+ }
80
+ all_ins_acc = calculate_ins_level_acc(evaluation_result)
81
+ printable_results["Overall"] = {
82
+ "num": sum([cat_results["num_example"] for cat_results in evaluation_result.values()]),
83
+ "acc": round(all_ins_acc, 5),
84
+ }
85
+ return printable_results["Overall"]["acc"]
86
+
87
+
88
+ ##################
89
+ # Helper functions written by official MMMU repo.
90
+ ##################
91
+
92
+
93
+ def calculate_ins_level_acc(results):
94
+ """Calculate the instruction level accuracy for given Subject results
95
+ https://github.com/MMMU-Benchmark/MMMU/blob/51ce7f3e829c16bb44bc5445782686b4c3508794/eval/eval_utils.py#L246
96
+ """
97
+ acc = 0
98
+ ins_num = 0
99
+ for cat_results in results.values():
100
+ acc += cat_results["acc"] * cat_results["num_example"]
101
+ ins_num += cat_results["num_example"]
102
+ if ins_num == 0:
103
+ return 0
104
+ return acc / ins_num
105
+
106
+
107
+ DOMAIN_CAT2SUB_CAT = {
108
+ "GENERAL": [
109
+ "line",
110
+ "table",
111
+ "bar",
112
+ "circle",
113
+ ],
114
+ }
115
+
116
+
117
+ def eval_open(gold_i, pred_i):
118
+ """
119
+ Evaluate an open question instance
120
+ https://github.com/MMMU-Benchmark/MMMU/blob/51ce7f3e829c16bb44bc5445782686b4c3508794/eval/eval_utils.py#L191
121
+ """
122
+ correct = False
123
+ if isinstance(gold_i, list):
124
+ # use float to avoid trivial matches
125
+ norm_answers = []
126
+ for answer in gold_i:
127
+ norm_answers.extend(normalize_str(answer))
128
+ else:
129
+ norm_answers = normalize_str(gold_i)
130
+ for pred in pred_i: # pred is already normalized in parse response phase
131
+ if isinstance(pred, str): # if it's a string, then find if ans in the pred_i
132
+ for norm_ans in norm_answers:
133
+ # only see if the string answer in the string pred
134
+ if isinstance(norm_ans, str) and norm_ans in pred:
135
+ if not correct:
136
+ correct = True
137
+ break
138
+ else: # it's a float number
139
+ if pred in norm_answers:
140
+ if not correct:
141
+ correct = True
142
+ break
143
+ return correct
144
+
145
+
146
+ def evaluate_jgraphqa(samples):
147
+ """
148
+ Batch evaluation for multiple choice and open questions.
149
+ https://github.com/MMMU-Benchmark/MMMU/blob/51ce7f3e829c16bb44bc5445782686b4c3508794/eval/eval_utils.py#L219
150
+ """
151
+ pred_correct = 0
152
+ judge_dict = dict()
153
+ for sample in samples:
154
+ gold_i = sample["answer"]
155
+ pred_i = sample["parsed_pred"]
156
+ correct = eval_open(gold_i, pred_i)
157
+
158
+ if correct:
159
+ judge_dict[sample["id"]] = "Correct"
160
+ pred_correct += 1
161
+ else:
162
+ judge_dict[sample["id"]] = "Wrong"
163
+
164
+ if len(samples) == 0:
165
+ return {"acc": 0}
166
+ return judge_dict, {"acc": pred_correct / len(samples)}
167
+
168
+
169
+ def extract_numbers(string):
170
+ """
171
+ Exact all forms of numbers from a string with regex.
172
+ """
173
+ # Pattern for numbers with commas
174
+ pattern_commas = r"-?\b\d{1,3}(?:,\d{3})+\b"
175
+ # Pattern for scientific notation
176
+ pattern_scientific = r"-?\d+(?:\.\d+)?[eE][+-]?\d+"
177
+ # pattern_simple = r'-?\d+(?:\.\d+)?(?![eE][+-]?\d+)'
178
+ pattern_simple = r"-?(?:\d+\.\d+|\.\d+|\d+)(?![eE][+-]?\d+)(?![,\d])"
179
+ # Pattern for Japanese numbers
180
+ pattern_japanese = r"(\d+)(?:つ|個|度|円|人|年|匹|台|%)"
181
+
182
+ # Extract numbers with commas
183
+ numbers_with_commas = re.findall(pattern_commas, string)
184
+ # Extract numbers in scientific notation
185
+ numbers_scientific = re.findall(pattern_scientific, string)
186
+ # Extract simple numbers without commas
187
+ numbers_simple = re.findall(pattern_simple, string)
188
+ # Extract Japanese numbers
189
+ numbers_japanese = re.findall(pattern_japanese, string)
190
+ # Combine all extracted numbers
191
+ all_numbers = numbers_with_commas + numbers_scientific + numbers_simple + numbers_japanese
192
+ return all_numbers
193
+
194
+
195
+ def normalize_str(string):
196
+ """
197
+ Normalize the str to lower case and make them float numbers if possible.
198
+ https://github.com/MMMU-Benchmark/MMMU/blob/51ce7f3e829c16bb44bc5445782686b4c3508794/eval/eval_utils.py#L76
199
+ """
200
+ string = string.strip()
201
+ string = string.replace(",", "")
202
+ string = string.replace(" ", "")
203
+ string = string.replace(" ", "")
204
+ string = string.lower()
205
+ if len(string) == 1:
206
+ return [" " + string, string + " "] # avoid trivial matches
207
+ return [string]
208
+
209
+
210
+ def parse_open_response(response):
211
+ """
212
+ Parse the prediction from the generated response.
213
+ Return a list of predicted strings or numbers.
214
+ https://github.com/MMMU-Benchmark/MMMU/blob/51ce7f3e829c16bb44bc5445782686b4c3508794/eval/eval_utils.py#L122
215
+ """
216
+
217
+ # content = content.strip("\n").strip(".").strip(" ")
218
+ def get_key_subresponses(response):
219
+ key_responses = []
220
+ response = response.strip().strip("。")
221
+ sub_responses = re.split(r"[。!?.]\s*|\n", response)
222
+
223
+ indicators_of_keys = ["よって", "よって、", "答えは", "答えは、", "最終的に", "最終的に、", "解答は", "解答は、" "回答は", "回答は、"]
224
+ key_responses = []
225
+ for index, resp in enumerate(sub_responses):
226
+ # if last one, accept it's an equation (the entire response can be just one sentence with equation)
227
+ if index == len(sub_responses) - 1:
228
+ indicators_of_keys.extend(["=", "="])
229
+ shortest_key_response = None # the shortest response that may contain the answer (tail part of the response)
230
+ for indicator in indicators_of_keys:
231
+ if indicator in resp:
232
+ if not shortest_key_response:
233
+ shortest_key_response = resp.split(indicator)[-1].strip()
234
+ else:
235
+ if len(resp.split(indicator)[-1].strip()) < len(shortest_key_response):
236
+ shortest_key_response = resp.split(indicator)[-1].strip()
237
+ # key_responses.append(resp.split(indicator)[1].strip())
238
+
239
+ if shortest_key_response:
240
+ # and it's not trivial
241
+ if shortest_key_response.strip() not in [",", ".", "!", "?", ";", ":", "'", "、", "。", "!", "?", ";", ":"]:
242
+ key_responses.append(shortest_key_response)
243
+ if len(key_responses) == 0: # did not found any
244
+ return [response]
245
+ return key_responses
246
+
247
+ # pdb.set_trace()
248
+ key_responses = get_key_subresponses(response)
249
+
250
+ pred_list = key_responses.copy() # keep the original string response
251
+ for resp in key_responses:
252
+ pred_list.extend(extract_numbers(resp))
253
+
254
+ tmp_pred_list = []
255
+ for i in range(len(pred_list)):
256
+ tmp_pred_list.extend(normalize_str(pred_list[i]))
257
+ pred_list = tmp_pred_list
258
+
259
+ # remove duplicates
260
+ pred_list = list(set(pred_list))
261
+
262
+ return pred_list