File size: 3,353 Bytes
b5beb60
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 2788/2788 [00:09<00:00, 286.38it/s]\n"
     ]
    }
   ],
   "source": [
    "import os\n",
    "import json\n",
    "save_dir = \"/user/konglingyu/VLMEvalKit/public_eval/dr_800_emma/EMMA_train_prompt_sampling/20250424\"\n",
    "data = {}\n",
    "for i in range(8):\n",
    "    assert os.path.exists(f\"{save_dir}/results_{i}.json\")\n",
    "    data.update(json.load(open(f\"{save_dir}/results_{i}.json\", \"r\")))\n",
    "assert len(data) == 2788\n",
    "with open(f\"{save_dir}/results.json\", \"w\") as f:\n",
    "    json.dump(data, f, indent=4)\n",
    "from EMMA.evaluation.evaluate import gen_true_false\n",
    "from EMMA.evaluation.calculate_acc import gen_score\n",
    "gen_true_false(f\"{save_dir}/results.json\")\n",
    "gen_score(f\"{save_dir}/results.json\", f\"{save_dir}/results_acc.json\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Looking in indexes: https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple, https://pypi.ngc.nvidia.com\n",
      "Collecting word2number\n",
      "  Downloading https://mirrors.tuna.tsinghua.edu.cn/pypi/web/packages/4a/29/a31940c848521f0725f0df6b25dca8917f13a2025b0e8fcbe5d0457e45e6/word2number-1.1.zip (9.7 kB)\n",
      "  Preparing metadata (setup.py) ... \u001b[?25ldone\n",
      "\u001b[?25hBuilding wheels for collected packages: word2number\n",
      "  Building wheel for word2number (setup.py) ... \u001b[?25ldone\n",
      "\u001b[?25h  Created wheel for word2number: filename=word2number-1.1-py3-none-any.whl size=5625 sha256=10743444572815e697e0ed1faa83d7468f568bad5e9f9683d681fd6de2a964cd\n",
      "  Stored in directory: /tmp/pip-ephem-wheel-cache-q98517p9/wheels/99/3a/6c/d8c11ef6bc6ecfba03cda750ca0ed469689c0494af888bc94b\n",
      "Successfully built word2number\n",
      "Installing collected packages: word2number\n",
      "Successfully installed word2number-1.1\n",
      "\u001b[33mWARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager, possibly rendering your system unusable. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv. Use the --root-user-action option if you know what you are doing and want to suppress this warning.\u001b[0m\u001b[33m\n",
      "\u001b[0m\u001b[31mERROR: Operation cancelled by user\u001b[0m\u001b[31m\n",
      "\u001b[0m^C\n",
      "Note: you may need to restart the kernel to use updated packages.\n"
     ]
    }
   ],
   "source": [
    "%pip install word2number -i https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}