{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.10.10","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"markdown","source":"**This notebook is a baseline for fine-tuning the `esm2` model.**\n\n- I used a `Colab Pro+ V100 high-memory instance` for training and inference.\n- I made some modifications to the evaluation code provided by the competition host (such as minor adjustments like float to float16).\n- The hyperparameter settings are arbitrary.\n\n\n**Reference code & discussions:**\n- https://www.kaggle.com/code/gusthema/cafa-5-protein-function-with-tensorflow\n- https://www.kaggle.com/code/henriupton/proteinet-pytorch-ems2-t5-protbert-embeddings\n- https://www.kaggle.com/code/sergeifironov/validate-ridge\n- https://www.kaggle.com/competitions/cafa-5-protein-function-prediction/discussion/407220\n- https://www.kaggle.com/code/yasufuminakama/fb3-deberta-v3-base-baseline-train (NLP pipeline)","metadata":{}},{"cell_type":"code","source":"# make submission (run only this cell)\nimport pandas as pd\nsubmission = pd.read_csv(\"/kaggle/input/cafa5-exp001/submission.tsv\", sep=\"\\t\", header=None)\nsubmission.to_csv(\"submission.tsv\",sep=\"\\t\", header=False, index=False)","metadata":{"execution":{"iopub.status.busy":"2026-08-14T11:11:04.902079Z","iopub.execute_input":"2026-08-14T11:11:04.902423Z","iopub.status.idle":"2026-08-14T11:11:05.183139Z","shell.execute_reply.started":"2026-08-14T11:11:04.902401Z","shell.execute_reply":"2026-08-14T11:11:05.181739Z"},"trusted":true},"outputs":[{"traceback":["\u001b[0;31m---------------------------------------------------------------------------\u001b[0m","\u001b[0;31mFileNotFoundError\u001b[0m                         Traceback (most recent call last)","Cell \u001b[0;32mIn[134], line 3\u001b[0m\n\u001b[1;32m      1\u001b[0m \u001b[38;5;66;03m# make submission (run only this cell)\u001b[39;00m\n\u001b[1;32m      2\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mpandas\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m \u001b[38;5;21;01mpd\u001b[39;00m\n\u001b[0;32m----> 3\u001b[0m submission \u001b[38;5;241m=\u001b[39m \u001b[43mpd\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mread_csv\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43m/kaggle/input/cafa5-exp001/submission.tsv\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43msep\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;130;43;01m\\t\u001b[39;49;00m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mheader\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mNone\u001b[39;49;00m\u001b[43m)\u001b[49m\n\u001b[1;32m      4\u001b[0m submission\u001b[38;5;241m.\u001b[39mto_csv(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124msubmission.tsv\u001b[39m\u001b[38;5;124m\"\u001b[39m,sep\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;130;01m\\t\u001b[39;00m\u001b[38;5;124m\"\u001b[39m, header\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mFalse\u001b[39;00m, index\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mFalse\u001b[39;00m)\n","File \u001b[0;32m/opt/conda/lib/python3.10/site-packages/pandas/util/_decorators.py:211\u001b[0m, in \u001b[0;36mdeprecate_kwarg.<locals>._deprecate_kwarg.<locals>.wrapper\u001b[0;34m(*args, **kwargs)\u001b[0m\n\u001b[1;32m    209\u001b[0m     \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m    210\u001b[0m         kwargs[new_arg_name] \u001b[38;5;241m=\u001b[39m new_arg_value\n\u001b[0;32m--> 211\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mfunc\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n","File \u001b[0;32m/opt/conda/lib/python3.10/site-packages/pandas/util/_decorators.py:331\u001b[0m, in \u001b[0;36mdeprecate_nonkeyword_arguments.<locals>.decorate.<locals>.wrapper\u001b[0;34m(*args, **kwargs)\u001b[0m\n\u001b[1;32m    325\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mlen\u001b[39m(args) \u001b[38;5;241m>\u001b[39m num_allow_args:\n\u001b[1;32m    326\u001b[0m     warnings\u001b[38;5;241m.\u001b[39mwarn(\n\u001b[1;32m    327\u001b[0m         msg\u001b[38;5;241m.\u001b[39mformat(arguments\u001b[38;5;241m=\u001b[39m_format_argument_list(allow_args)),\n\u001b[1;32m    328\u001b[0m         \u001b[38;5;167;01mFutureWarning\u001b[39;00m,\n\u001b[1;32m    329\u001b[0m         stacklevel\u001b[38;5;241m=\u001b[39mfind_stack_level(),\n\u001b[1;32m    330\u001b[0m     )\n\u001b[0;32m--> 331\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mfunc\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n","File \u001b[0;32m/opt/conda/lib/python3.10/site-packages/pandas/io/parsers/readers.py:950\u001b[0m, in \u001b[0;36mread_csv\u001b[0;34m(filepath_or_buffer, sep, delimiter, header, names, index_col, usecols, squeeze, prefix, mangle_dupe_cols, dtype, engine, converters, true_values, false_values, skipinitialspace, skiprows, skipfooter, nrows, na_values, keep_default_na, na_filter, verbose, skip_blank_lines, parse_dates, infer_datetime_format, keep_date_col, date_parser, dayfirst, cache_dates, iterator, chunksize, compression, thousands, decimal, lineterminator, quotechar, quoting, doublequote, escapechar, comment, encoding, encoding_errors, dialect, error_bad_lines, warn_bad_lines, on_bad_lines, delim_whitespace, low_memory, memory_map, float_precision, storage_options)\u001b[0m\n\u001b[1;32m    935\u001b[0m kwds_defaults \u001b[38;5;241m=\u001b[39m _refine_defaults_read(\n\u001b[1;32m    936\u001b[0m     dialect,\n\u001b[1;32m    937\u001b[0m     delimiter,\n\u001b[0;32m   (...)\u001b[0m\n\u001b[1;32m    946\u001b[0m     defaults\u001b[38;5;241m=\u001b[39m{\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mdelimiter\u001b[39m\u001b[38;5;124m\"\u001b[39m: \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m,\u001b[39m\u001b[38;5;124m\"\u001b[39m},\n\u001b[1;32m    947\u001b[0m )\n\u001b[1;32m    948\u001b[0m kwds\u001b[38;5;241m.\u001b[39mupdate(kwds_defaults)\n\u001b[0;32m--> 950\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43m_read\u001b[49m\u001b[43m(\u001b[49m\u001b[43mfilepath_or_buffer\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mkwds\u001b[49m\u001b[43m)\u001b[49m\n","File \u001b[0;32m/opt/conda/lib/python3.10/site-packages/pandas/io/parsers/readers.py:605\u001b[0m, in \u001b[0;36m_read\u001b[0;34m(filepath_or_buffer, kwds)\u001b[0m\n\u001b[1;32m    602\u001b[0m _validate_names(kwds\u001b[38;5;241m.\u001b[39mget(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mnames\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;28;01mNone\u001b[39;00m))\n\u001b[1;32m    604\u001b[0m \u001b[38;5;66;03m# Create the parser.\u001b[39;00m\n\u001b[0;32m--> 605\u001b[0m parser \u001b[38;5;241m=\u001b[39m \u001b[43mTextFileReader\u001b[49m\u001b[43m(\u001b[49m\u001b[43mfilepath_or_buffer\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwds\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m    607\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m chunksize \u001b[38;5;129;01mor\u001b[39;00m iterator:\n\u001b[1;32m    608\u001b[0m     \u001b[38;5;28;01mreturn\u001b[39;00m parser\n","File \u001b[0;32m/opt/conda/lib/python3.10/site-packages/pandas/io/parsers/readers.py:1442\u001b[0m, in \u001b[0;36mTextFileReader.__init__\u001b[0;34m(self, f, engine, **kwds)\u001b[0m\n\u001b[1;32m   1439\u001b[0m     \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39moptions[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mhas_index_names\u001b[39m\u001b[38;5;124m\"\u001b[39m] \u001b[38;5;241m=\u001b[39m kwds[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mhas_index_names\u001b[39m\u001b[38;5;124m\"\u001b[39m]\n\u001b[1;32m   1441\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mhandles: IOHandles \u001b[38;5;241m|\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[0;32m-> 1442\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_engine \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_make_engine\u001b[49m\u001b[43m(\u001b[49m\u001b[43mf\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mengine\u001b[49m\u001b[43m)\u001b[49m\n","File \u001b[0;32m/opt/conda/lib/python3.10/site-packages/pandas/io/parsers/readers.py:1735\u001b[0m, in \u001b[0;36mTextFileReader._make_engine\u001b[0;34m(self, f, engine)\u001b[0m\n\u001b[1;32m   1733\u001b[0m     \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mb\u001b[39m\u001b[38;5;124m\"\u001b[39m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;129;01min\u001b[39;00m mode:\n\u001b[1;32m   1734\u001b[0m         mode \u001b[38;5;241m+\u001b[39m\u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mb\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m-> 1735\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mhandles \u001b[38;5;241m=\u001b[39m \u001b[43mget_handle\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m   1736\u001b[0m \u001b[43m    \u001b[49m\u001b[43mf\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m   1737\u001b[0m \u001b[43m    \u001b[49m\u001b[43mmode\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m   1738\u001b[0m \u001b[43m    \u001b[49m\u001b[43mencoding\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43moptions\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mencoding\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43;01mNone\u001b[39;49;00m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m   1739\u001b[0m \u001b[43m    \u001b[49m\u001b[43mcompression\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43moptions\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mcompression\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43;01mNone\u001b[39;49;00m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m   1740\u001b[0m \u001b[43m    \u001b[49m\u001b[43mmemory_map\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43moptions\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mmemory_map\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m   1741\u001b[0m \u001b[43m    \u001b[49m\u001b[43mis_text\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mis_text\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m   1742\u001b[0m \u001b[43m    \u001b[49m\u001b[43merrors\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43moptions\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mencoding_errors\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mstrict\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m   1743\u001b[0m \u001b[43m    \u001b[49m\u001b[43mstorage_options\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43moptions\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mstorage_options\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43;01mNone\u001b[39;49;00m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m   1744\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m   1745\u001b[0m \u001b[38;5;28;01massert\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mhandles \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[1;32m   1746\u001b[0m f \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mhandles\u001b[38;5;241m.\u001b[39mhandle\n","File \u001b[0;32m/opt/conda/lib/python3.10/site-packages/pandas/io/common.py:856\u001b[0m, in \u001b[0;36mget_handle\u001b[0;34m(path_or_buf, mode, encoding, compression, memory_map, is_text, errors, storage_options)\u001b[0m\n\u001b[1;32m    851\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(handle, \u001b[38;5;28mstr\u001b[39m):\n\u001b[1;32m    852\u001b[0m     \u001b[38;5;66;03m# Check whether the filename is to be opened in binary mode.\u001b[39;00m\n\u001b[1;32m    853\u001b[0m     \u001b[38;5;66;03m# Binary mode does not support 'encoding' and 'newline'.\u001b[39;00m\n\u001b[1;32m    854\u001b[0m     \u001b[38;5;28;01mif\u001b[39;00m ioargs\u001b[38;5;241m.\u001b[39mencoding \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mb\u001b[39m\u001b[38;5;124m\"\u001b[39m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;129;01min\u001b[39;00m ioargs\u001b[38;5;241m.\u001b[39mmode:\n\u001b[1;32m    855\u001b[0m         \u001b[38;5;66;03m# Encoding\u001b[39;00m\n\u001b[0;32m--> 856\u001b[0m         handle \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mopen\u001b[39;49m\u001b[43m(\u001b[49m\n\u001b[1;32m    857\u001b[0m \u001b[43m            \u001b[49m\u001b[43mhandle\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m    858\u001b[0m \u001b[43m            \u001b[49m\u001b[43mioargs\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmode\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m    859\u001b[0m \u001b[43m            \u001b[49m\u001b[43mencoding\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mioargs\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mencoding\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m    860\u001b[0m \u001b[43m            \u001b[49m\u001b[43merrors\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43merrors\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m    861\u001b[0m \u001b[43m            \u001b[49m\u001b[43mnewline\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\n\u001b[1;32m    862\u001b[0m \u001b[43m        \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m    863\u001b[0m     \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m    864\u001b[0m         \u001b[38;5;66;03m# Binary mode\u001b[39;00m\n\u001b[1;32m    865\u001b[0m         handle \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mopen\u001b[39m(handle, ioargs\u001b[38;5;241m.\u001b[39mmode)\n","\u001b[0;31mFileNotFoundError\u001b[0m: [Errno 2] No such file or directory: '/kaggle/input/cafa5-exp001/submission.tsv'"],"ename":"FileNotFoundError","evalue":"[Errno 2] No such file or directory: '/kaggle/input/cafa5-exp001/submission.tsv'","output_type":"error"}],"execution_count":134},{"cell_type":"markdown","source":"## Install","metadata":{}},{"cell_type":"code","source":"! pip install biopython -q\n! pip install polars\n! pip install transformers -q\n! pip install wandb -q\n! pip install torchmetrics -q","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-14T11:11:19.523053Z","iopub.execute_input":"2026-08-14T11:11:19.52342Z"}},"outputs":[{"name":"stdout","text":"\u001b[33mWARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv\u001b[0m\u001b[33m\n\u001b[0mRequirement already satisfied: polars in /opt/conda/lib/python3.10/site-packages (0.17.15)\n\u001b[33mWARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv\u001b[0m\u001b[33m\n\u001b[0m\u001b[33mWARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv\u001b[0m\u001b[33m\n\u001b[0m\u001b[33mWARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv\u001b[0m\u001b[33m\n\u001b[0m\u001b[33mWARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv\u001b[0m\u001b[33m\n\u001b[0m","output_type":"stream"}],"execution_count":null},{"cell_type":"code","source":"import sys\nimport os\nimport json\nimport logging\nimport datetime\nimport requests\nimport gc\nimport joblib\nimport tempfile\nfrom pathlib import Path\n\nfrom Bio import SeqIO\nimport pandas as pd\nimport numpy as np\nimport polars as pl\nfrom tqdm import tqdm\nimport torch\nimport torch.nn as nn\nimport wandb\n\nfrom sklearn.model_selection import KFold\n\nfrom transformers import AutoTokenizer, AutoModel, AutoConfig\nfrom torch.utils.data import DataLoader, Dataset\nfrom torch.cuda.amp import autocast, GradScaler\nfrom torch.optim import Adam, AdamW\nfrom torch.optim.lr_scheduler import (\n    CosineAnnealingWarmRestarts,\n    CosineAnnealingLR,\n    MultiStepLR,\n    ReduceLROnPlateau,\n)\n\nfrom transformers import get_linear_schedule_with_warmup, get_cosine_schedule_with_warmup\nfrom transformers import DataCollatorWithPadding\nfrom torchmetrics.classification import MultilabelF1Score\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-14T13:17:20.771534Z","iopub.execute_input":"2026-08-14T13:17:20.772324Z","iopub.status.idle":"2026-08-14T13:17:20.777663Z","shell.execute_reply.started":"2026-08-14T13:17:20.772301Z","shell.execute_reply":"2026-08-14T13:17:20.776868Z"}},"outputs":[],"execution_count":306},{"cell_type":"markdown","source":"## Config","metadata":{}},{"cell_type":"code","source":"class Config:\n    train = True\n    evaluation = True\n    inference = True\n    submission = True\n\n    max_label = 512\n    n_fold = 5\n    trn_fold = [0]\n\n    max_epochs = 8\n    train_batch_size = 24\n    valid_batch_size = 64\n    num_workers = 4\n    seed = 8823\n    name = \"exp001\"\n    competition = \"cafa-5-protein-function-prediction\"\n    debug = False\n    model = \"facebook/esm2_t6_8M_UR50D\"\n    max_len = 512\n    gradient_checkpointing = False\n    gradient_accumulation_steps = 1\n    clip_grad_norm = 1000\n\n    optimizer = dict(\n        optimizer_name=\"AdamW\",\n        lr=2e-5,\n        weight_decay=1e-2,\n        eps=1e-6,\n        beta=(0.9, 0.999),\n        encoder_lr=2e-5,\n        decoder_lr=2e-5,\n    )\n\n    scheduler = dict(\n        scheduler_name=\"cosine_restarts\",\n        first_cycle_steps_ratio=0.5,\n        cycle_mult=1.0,\n        max_lr=2e-5,\n        min_lr=1e-7,\n        warmup_steps=100,\n        gamma=0.8,\n    )\n    batch_scheduler = True\n\n\nif Config.debug:\n    Config.max_label = 100\n    Config.max_epochs = 2\n    Config.max_len = 100\n    Config.n_fold = 2\n    Config.trn_fold = [0, 1]","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-14T12:53:48.011709Z","iopub.execute_input":"2026-08-14T12:53:48.012127Z","iopub.status.idle":"2026-08-14T12:53:48.019822Z","shell.execute_reply.started":"2026-08-14T12:53:48.012105Z","shell.execute_reply":"2026-08-14T12:53:48.018738Z"}},"outputs":[],"execution_count":240},{"cell_type":"code","source":"config = Config()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-14T12:53:52.403035Z","iopub.execute_input":"2026-08-14T12:53:52.403395Z","iopub.status.idle":"2026-08-14T12:53:52.409929Z","shell.execute_reply.started":"2026-08-14T12:53:52.40337Z","shell.execute_reply":"2026-08-14T12:53:52.408861Z"}},"outputs":[],"execution_count":241},{"cell_type":"code","source":"# constants\n# HOME改为Kaggle工作目录\nHOME = Path(\"/kaggle/working\")\n# API这一行是Colab谷歌网盘路径，Kaggle不需要，注释掉\n# API = Path(\"/content/drive/MyDrive/competition/kaggle.json\")\n\n# 下面这行是Colab内网接口，Kaggle无法运行，直接注释\n# NOTEBOOK_NAME = requests.get(\"http://172.28.0.12:9000/api/sessions\").json()[0][\"name\"][:-6]\n# 手动指定实验名称，名字可以自己修改\nEXP_NAME = Config.name if Config.name is not None else \"cafa5_exp01\"\n\nINPUTS = HOME / \"inputs\"\nOUTPUTS = HOME / \"outputs\"\nINTERMEDIATES = HOME / \"intermediates\" # intermediate outputs\nSUBMISSIONS = HOME / \"submissions\"\nOUTPUTS_EXP = OUTPUTS / EXP_NAME\nEXP_MODELS = OUTPUTS_EXP / \"models\"\nEXP_REPORTS = OUTPUTS_EXP / \"reports\"\nEXP_PREDS = OUTPUTS_EXP / \"predictions\"\n\nSCRIPTS = HOME / \"scripts\"\nCAFA_EVALUATOR = SCRIPTS / \"CAFA_evaluator\"","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-14T12:53:55.28356Z","iopub.execute_input":"2026-08-14T12:53:55.283947Z","iopub.status.idle":"2026-08-14T12:53:55.289922Z","shell.execute_reply.started":"2026-08-14T12:53:55.283926Z","shell.execute_reply":"2026-08-14T12:53:55.289106Z"}},"outputs":[],"execution_count":242},{"cell_type":"markdown","source":"## Setup","metadata":{}},{"cell_type":"code","source":"def setup(Config):\n    for d in [\n        HOME,\n        INPUTS,\n        SUBMISSIONS,\n        EXP_MODELS,\n        EXP_REPORTS,\n        EXP_PREDS,\n        INTERMIDIATES,\n        SCRIPTS,\n        CAFA_EVALUATOR,\n    ]:\n        d.mkdir(parents=True, exist_ok=True)\n\n  \n    if not (CAFA_EVALUATOR / \"src\").is_dir():\n        import subprocess\n        subprocess.run([\"git\", \"clone\", \"https://github.com/BioComputingUP/CAFA-evaluator.git\", str(CAFA_EVALUATOR)])\n\n\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-14T12:53:59.183294Z","iopub.execute_input":"2026-08-14T12:53:59.183608Z","iopub.status.idle":"2026-08-14T12:53:59.189027Z","shell.execute_reply.started":"2026-08-14T12:53:59.183573Z","shell.execute_reply":"2026-08-14T12:53:59.188016Z"}},"outputs":[],"execution_count":243},{"cell_type":"code","source":"from pathlib import Path\nimport sys\nimport torch\n\nHOME = Path(\"/kaggle/working\")\nINPUTS = HOME / \"../input\"\n\n# 全部路径一次性定义\nINTERMEDIATES = HOME / \"intermediates\"\nSUBMISSIONS = HOME / \"submission\"\nEXP_MODELS = HOME / \"exp_models\"\nEXP_REPORTS = HOME / \"exp_reports\"\nEXP_PREDS = HOME / \"exp_preds\"\nSCRIPTS = HOME / \"scripts\"\nCAFA_EVALUATOR = SCRIPTS / \"CAFA_evaluator\"\n\n# 批量建文件夹\nfor p in [INTERMEDIATES, SUBMISSIONS, EXP_MODELS, EXP_REPORTS, EXP_PREDS, SCRIPTS, CAFA_EVALUATOR]:\n    p.mkdir(parents=True, exist_ok=True)\n\n# Config类，不再二次重复赋值\nclass Config:\n    competition = \"cafa5\"\n    max_label = 1500\n    max_seq_len = 1024\n    batch_size = 32\n    epochs = 5\n    lr = 1e-4\n    model = \"facebook/esm2-t6-35M-ur50S\"\n    seed = 42\n    debug = False\n\ncfg = Config()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-14T12:54:06.983314Z","iopub.execute_input":"2026-08-14T12:54:06.983922Z","iopub.status.idle":"2026-08-14T12:54:06.990886Z","shell.execute_reply.started":"2026-08-14T12:54:06.983897Z","shell.execute_reply":"2026-08-14T12:54:06.989871Z"}},"outputs":[],"execution_count":246},{"cell_type":"code","source":"def setup(cfg):\n    import subprocess\n    if not (SCRIPTS / \"CAFA_evaluator\").exists():\n        subprocess.run([\n            \"git\",\n            \"clone\",\n            \"https://github.com/BioPandas/CAFA‑evaluator.git\",\n            str(CAFA_EVALUATOR)\n        ])","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-14T12:54:11.536569Z","iopub.execute_input":"2026-08-14T12:54:11.536919Z","iopub.status.idle":"2026-08-14T12:54:11.542319Z","shell.execute_reply.started":"2026-08-14T12:54:11.536898Z","shell.execute_reply":"2026-08-14T12:54:11.541063Z"}},"outputs":[],"execution_count":247},{"cell_type":"code","source":"setup(Config)\n\n# LOGGER = Logger(OUTPUTS_EXP.as_posix())\n# 等你把Logger类的定义放到前面之后，再取消上一行注释\n\nDEVICE = torch.device(\"cuda\" if torch.cuda.is_available() else \"cpu\")\n# wandb.login()\nsys.path.append((CAFA_EVALUATOR / \"src\").as_posix())","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-14T12:54:15.955916Z","iopub.execute_input":"2026-08-14T12:54:15.956254Z","iopub.status.idle":"2026-08-14T12:54:15.961328Z","shell.execute_reply.started":"2026-08-14T12:54:15.956234Z","shell.execute_reply":"2026-08-14T12:54:15.96054Z"}},"outputs":[],"execution_count":248},{"cell_type":"markdown","source":"## Metrics","metadata":{}},{"cell_type":"code","source":"# competition metrics\ndef get_score(gt_df, pred_df, th_step=0.05, max_terms=None, use_cache=False, n_cpu=1):\n    from parser import obo_parser, gt_parser, pred_parser, ia_parser\n    from graph import Graph\n    from evaluation import evaluate_prediction\n\n    pred_df = pred_df.astype({\"preds\": np.float16})\n    gt_df = gt_df[[\"EntryID\", \"term\"]]\n\n    with tempfile.TemporaryDirectory() as tmp_dir:\n        dirpath = Path(tmp_dir)\n\n        # set filepath and parameter\n        gt_file, pred_file = dirpath / \"gt.tsv\", dirpath / \"pred.tsv\"\n        ia = INPUTS / \"IA.txt\"\n        obo_file = INPUTS / \"Train\" / \"go-basic.obo\"\n        no_orphans = False\n        prop = \"max\"\n        norm = \"cafa\"\n        parsed_gt_file = INTERMIDIATES / \"parsed_gt.pkl\"\n\n        # save evaluator inputs to tmpdir\n        gt_df.to_csv(gt_file, header=False, index=False, sep=\"\\t\")\n        pred_df.to_csv(pred_file, header=False, index=False, sep=\"\\t\")\n\n        # main\n        ia_dict = None if ia is None else ia_parser(ia)\n        tau_arr = np.arange(0.01, 1, th_step)\n        ontologies = [\n            Graph(ns, terms_dict, ia_dict, not no_orphans)\n            for ns, terms_dict in obo_parser(obo_file).items()\n        ]\n\n        if use_cache:\n            if not parsed_gt_file.is_file():\n                # to save time\n                gt = gt_parser(gt_file, ontologies)\n                joblib.dump(gt, parsed_gt_file)\n            gt = joblib.load(parsed_gt_file)\n        else:\n            gt = gt_parser(gt_file, ontologies)\n\n        df_pred = evaluate_prediction(  # too heavy and slow...\n            prediction=pred_parser(pred_file, ontologies, gt, prop_mode=prop, max_terms=max_terms),\n            gt=gt,\n            ontologies=ontologies,\n            tau_arr=tau_arr,\n            normalization=norm,\n            n_cpu=n_cpu,\n        )\n    score = df_pred.groupby(\"ns\").agg({\"f\": \"max\"}).values.mean()\n    return score, df_pred.reset_index(drop=True)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-14T12:54:19.643855Z","iopub.execute_input":"2026-08-14T12:54:19.64425Z","iopub.status.idle":"2026-08-14T12:54:19.653646Z","shell.execute_reply.started":"2026-08-14T12:54:19.644228Z","shell.execute_reply":"2026-08-14T12:54:19.652647Z"}},"outputs":[],"execution_count":249},{"cell_type":"markdown","source":"## Load Data","metadata":{}},{"cell_type":"code","source":"import polars as pl\n\ntrain_label_df_wide = train_label_df.pivot(\n    columns=\"term\",\n    index=\"EntryID\",\n    values=\"count\",\n    aggregate_function=\"sum\"\n).fill_null(0)\n\ntrain_label_df_pd = train_label_df_wide.to_pandas().reset_index()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-14T12:54:24.95243Z","iopub.execute_input":"2026-08-14T12:54:24.953185Z","iopub.status.idle":"2026-08-14T12:54:25.001293Z","shell.execute_reply.started":"2026-08-14T12:54:24.953163Z","shell.execute_reply":"2026-08-14T12:54:25.00001Z"}},"outputs":[],"execution_count":250},{"cell_type":"code","source":"train_df, target_columns = make_train_dataset(train_seq_df, train_label_df_pd, max_label=Config.max_label)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-14T12:54:29.59197Z","iopub.execute_input":"2026-08-14T12:54:29.592325Z","iopub.status.idle":"2026-08-14T12:54:29.685792Z","shell.execute_reply.started":"2026-08-14T12:54:29.592302Z","shell.execute_reply":"2026-08-14T12:54:29.684791Z"}},"outputs":[],"execution_count":251},{"cell_type":"code","source":"print(train_label_df_pd.shape)\nprint(train_label_df_pd.columns[:5].tolist())\nprint(train_label_df_pd.dtypes)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-14T12:54:32.790397Z","iopub.execute_input":"2026-08-14T12:54:32.790698Z","iopub.status.idle":"2026-08-14T12:54:32.798642Z","shell.execute_reply.started":"2026-08-14T12:54:32.790679Z","shell.execute_reply":"2026-08-14T12:54:32.797276Z"}},"outputs":[{"name":"stdout","text":"(69, 762)\n['index', 'EntryID', 'GO:0008152', 'GO:0072523', 'GO:0044237']\nindex          int64\nEntryID       object\nGO:0008152    uint32\nGO:0072523    uint32\nGO:0044237    uint32\n               ...  \nGO:1903514    uint32\nGO:0008654    uint32\nGO:0006663    uint32\nGO:0046474    uint32\nGO:0018904    uint32\nLength: 762, dtype: object\n","output_type":"stream"}],"execution_count":252},{"cell_type":"code","source":"train_label_df_pd = train_label_df_pd.drop(columns=[\"index\"])","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-14T12:54:39.644383Z","iopub.execute_input":"2026-08-14T12:54:39.644731Z","iopub.status.idle":"2026-08-14T12:54:39.651792Z","shell.execute_reply.started":"2026-08-14T12:54:39.644706Z","shell.execute_reply":"2026-08-14T12:54:39.650126Z"}},"outputs":[],"execution_count":253},{"cell_type":"code","source":"print(train_label_df_pd.columns[:5].tolist())","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-14T12:54:43.262206Z","iopub.execute_input":"2026-08-14T12:54:43.262518Z","iopub.status.idle":"2026-08-14T12:54:43.267488Z","shell.execute_reply.started":"2026-08-14T12:54:43.262498Z","shell.execute_reply":"2026-08-14T12:54:43.266317Z"}},"outputs":[{"name":"stdout","text":"['EntryID', 'GO:0008152', 'GO:0072523', 'GO:0044237', 'GO:1901360']\n","output_type":"stream"}],"execution_count":254},{"cell_type":"code","source":"import os\nfrom pathlib import Path\nfilepath = INTERMEDIATES / \"sorted_GO_list.pkl\"\nif filepath.exists():\n    os.remove(str(filepath))\n\ntrain_df, target_columns = make_train_dataset(train_seq_df, train_label_df_pd, max_label=Config.max_label)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-14T12:57:07.892577Z","iopub.execute_input":"2026-08-14T12:57:07.892931Z","iopub.status.idle":"2026-08-14T12:57:07.993259Z","shell.execute_reply.started":"2026-08-14T12:57:07.892911Z","shell.execute_reply":"2026-08-14T12:57:07.992426Z"}},"outputs":[],"execution_count":259},{"cell_type":"code","source":"import pandas as pd\nimport polars as pl\nimport joblib\nimport gc\nfrom pathlib import Path\n\nINTERMIDIATES = Path(\"./intermediates\")\n\ndef make_train_terms_crosstab(train_terms_df):\n    filepath = INTERMIDIATES / \"train_terms_crosstab.pkl\"\n\n    if not filepath.is_file():\n        # train_terms_df 如果是pl.DataFrame先转pandas，避免pivot行为差异\n        if isinstance(train_terms_df, pl.DataFrame):\n            train_terms_df = train_terms_df.to_pandas()\n\n        crosstab_df = train_terms_df.pivot(\n            values=\"aspect\", index=\"EntryID\", columns=\"term\", aggregatefunc=\"count\"\n        ).fillna(0)\n        crosstab_df = crosstab_df.astype(bool).reset_index()\n\n        joblib.dump(crosstab_df, filepath)\n        del crosstab_df\n        gc.collect()\n\n    return joblib.load(filepath).sort_values(\"EntryID\").reset_index(drop=True)\n\n\ndef make_sequence_df(input_fasta):\n    sequence_df = (\n        pd.DataFrame([[x.name, x.seq] for x in input_fasta], columns=[\"EntryID\", \"seq\"])\n        .sort_values(\"EntryID\")\n        .reset_index(drop=True)\n    )\n    return sequence_df\n\ndef make_train_dataset(train_seq_df, train_label_df, max_label=None):\n    import pandas as pd\n    import joblib\n    from pathlib import Path\n    INTERMEDIATES = Path(\"./intermediates\")\n    INTERMEDIATES.mkdir(exist_ok=True)\n\n    # 如果传进来的是polars DataFrame，转成pandas\n    if hasattr(train_label_df, \"to_pandas\"):\n        train_label_df = train_label_df.to_pandas()\n\n    if max_label is None:\n        max_label = train_label_df.shape[1]\n\n    filepath = INTERMEDIATES / \"sorted_GO_list.pkl\"\n    if not filepath.is_file():\n        label_cols = [c for c in train_label_df.columns if c != \"EntryID\"]\n        col_sum = train_label_df[label_cols].sum(axis=0)\n        target_columns = col_sum.sort_values(ascending=False).index.tolist()\n        joblib.dump(target_columns, filepath)\n\n    # 下面这一段必须在if外面，无论文件是否存在都会执行\n    target_columns = joblib.load(filepath)[:max_label]\n    target_columns = [c for c in target_columns if c in train_label_df.columns]\n\n    # 替换原来concat，改用merge按EntryID合并\n    train_df = pd.merge(\n        train_seq_df,\n        train_label_df[[\"EntryID\"] + target_columns],\n        on=\"EntryID\",\n        how=\"inner\"\n    )\n\n    return train_df, target_columns\n\n   \n\n   \n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-14T12:57:12.256687Z","iopub.execute_input":"2026-08-14T12:57:12.257812Z","iopub.status.idle":"2026-08-14T12:57:12.26966Z","shell.execute_reply.started":"2026-08-14T12:57:12.257778Z","shell.execute_reply":"2026-08-14T12:57:12.268609Z"}},"outputs":[],"execution_count":260},{"cell_type":"code","source":"\nimport polars as pl\nfrom pathlib import Path\n\ndef make_train_terms_crosstab(train_terms_df: pl.DataFrame, intermediates_dir: Path):\n    filepath = intermediates_dir / \"train_terms_sparse.parquet\"\n    if not filepath.is_file():\n        crosstab_df = (\n            train_terms_df\n            .group_by([\"EntryID\", \"term\"])\n            .agg(pl.count(\"*\").alias(\"count\"))\n        )\n        crosstab_df.write_parquet(filepath)\n    else:\n        crosstab_df = pl.read_parquet(filepath)\n    return crosstab_df\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-14T12:57:19.629908Z","iopub.execute_input":"2026-08-14T12:57:19.630279Z","iopub.status.idle":"2026-08-14T12:57:19.635313Z","shell.execute_reply.started":"2026-08-14T12:57:19.630253Z","shell.execute_reply":"2026-08-14T12:57:19.634562Z"}},"outputs":[],"execution_count":261},{"cell_type":"code","source":"import os\npkl_path = str(INTERMEDIATES / \"sorted_GO_list.pkl\")\nif os.path.exists(pkl_path):\n    os.remove(pkl_path)\n    print(\"缓存文件已删除\")\nelse:\n    print(\"缓存文件本来就不存在\")","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-14T12:57:24.626163Z","iopub.execute_input":"2026-08-14T12:57:24.626525Z","iopub.status.idle":"2026-08-14T12:57:24.633081Z","shell.execute_reply.started":"2026-08-14T12:57:24.626496Z","shell.execute_reply":"2026-08-14T12:57:24.631925Z"}},"outputs":[{"name":"stdout","text":"缓存文件已删除\n","output_type":"stream"}],"execution_count":262},{"cell_type":"code","source":"train_df, target_columns = make_train_dataset(train_seq_df, train_label_df_pd, max_label=Config.max_label)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-14T12:57:28.751981Z","iopub.execute_input":"2026-08-14T12:57:28.752362Z","iopub.status.idle":"2026-08-14T12:57:28.841015Z","shell.execute_reply.started":"2026-08-14T12:57:28.75234Z","shell.execute_reply":"2026-08-14T12:57:28.839626Z"}},"outputs":[],"execution_count":263},{"cell_type":"markdown","source":"## CV Split","metadata":{}},{"cell_type":"code","source":"def add_fold_idx(config, train_df, target_columns):\n    fold = KFold(n_splits=config.n_fold, shuffle=True, random_state=config.seed)\n    train_df[\"fold\"] = -1\n    for i_fold, (train_index, val_index) in enumerate(fold.split(train_df, train_df[target_columns])):\n        train_df.iloc[val_index, train_df.columns.get_loc(\"fold\")] = int(i_fold)\n    train_df[\"fold\"] = train_df[\"fold\"].astype(int)\n    return train_df\n\n# 调用放在函数外面，仅此一处改动\ntrain_df, target_columns = make_train_dataset(train_seq_df, train_label_df_pd, max_label=Config.max_label)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-14T13:04:51.854152Z","iopub.execute_input":"2026-08-14T13:04:51.854464Z","iopub.status.idle":"2026-08-14T13:04:51.944476Z","shell.execute_reply.started":"2026-08-14T13:04:51.854445Z","shell.execute_reply":"2026-08-14T13:04:51.943619Z"}},"outputs":[],"execution_count":282},{"cell_type":"code","source":"train_df = add_fold_idx(config=config, train_df=train_df, target_columns=target_columns)\ntrain_df.head()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-14T13:04:39.189324Z","iopub.execute_input":"2026-08-14T13:04:39.18964Z","iopub.status.idle":"2026-08-14T13:04:39.203501Z","shell.execute_reply.started":"2026-08-14T13:04:39.189619Z","shell.execute_reply":"2026-08-14T13:04:39.202721Z"}},"outputs":[{"execution_count":280,"output_type":"execute_result","data":{"text/plain":"      EntryID                                                seq  fold\n0  A0A009IHW8  (M, S, L, E, Q, K, K, G, A, D, I, I, S, K, I, ...     0\n1  A0A009IHW8  (M, S, L, E, Q, K, K, G, A, D, I, I, S, K, I, ...     2\n2  A0A009IHW8  (M, S, L, E, Q, K, K, G, A, D, I, I, S, K, I, ...     3\n3  A0A009IHW8  (M, S, L, E, Q, K, K, G, A, D, I, I, S, K, I, ...     1\n4  A0A009IHW8  (M, S, L, E, Q, K, K, G, A, D, I, I, S, K, I, ...     1","text/html":"<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>EntryID</th>\n      <th>seq</th>\n      <th>fold</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>A0A009IHW8</td>\n      <td>(M, S, L, E, Q, K, K, G, A, D, I, I, S, K, I, ...</td>\n      <td>0</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>A0A009IHW8</td>\n      <td>(M, S, L, E, Q, K, K, G, A, D, I, I, S, K, I, ...</td>\n      <td>2</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>A0A009IHW8</td>\n      <td>(M, S, L, E, Q, K, K, G, A, D, I, I, S, K, I, ...</td>\n      <td>3</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>A0A009IHW8</td>\n      <td>(M, S, L, E, Q, K, K, G, A, D, I, I, S, K, I, ...</td>\n      <td>1</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>A0A009IHW8</td>\n      <td>(M, S, L, E, Q, K, K, G, A, D, I, I, S, K, I, ...</td>\n      <td>1</td>\n    </tr>\n  </tbody>\n</table>\n</div>"},"metadata":{}}],"execution_count":280},{"cell_type":"code","source":"train_df[\"fold\"].value_counts()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-14T12:57:43.296172Z","iopub.execute_input":"2026-08-14T12:57:43.296541Z","iopub.status.idle":"2026-08-14T12:57:43.303516Z","shell.execute_reply.started":"2026-08-14T12:57:43.296516Z","shell.execute_reply":"2026-08-14T12:57:43.302667Z"}},"outputs":[{"execution_count":266,"output_type":"execute_result","data":{"text/plain":"0    14\n1    14\n2    14\n3    14\n4    13\nName: fold, dtype: int64"},"metadata":{}}],"execution_count":266},{"cell_type":"markdown","source":"## Dataset","metadata":{}},{"cell_type":"code","source":"import torch\nimport numpy as np\nfrom torch.utils.data import Dataset\n\ndef find_max_length(tokenizer, texts: list[str]):\n    \"\"\"\n    [memo]\n    train : facebook/esm2_t6_8M_UR50D : 35377\n    \"\"\"\n    lengths = [\n        len(tokenizer(text, add_special_tokens=False)[\"input_ids\"])\n        for text in tqdm(texts, total=len(texts))\n    ]\n    return lengths\n\n\ndef prepare_input(config, tokenizer, text):\n    inputs = tokenizer.encode_plus(\n        text,\n        return_tensors=None,\n        add_special_tokens=True,\n        max_length=config.max_len,\n        padding=\"max_length\",\n        truncation=True,\n    )\n    for k, v in inputs.items():\n        inputs[k] = torch.tensor(v, dtype=torch.long)\n    return inputs\n\n\nclass TrainDataset(Dataset):\n    def __init__(self, config, tokenizer, texts: list[str], targets: list | np.ndarray):\n        self.config = config\n        self.texts = texts\n        self.targets = targets\n        self.tokenizer = tokenizer\n\n    def __len__(self):\n        return len(self.texts)\n\n    def __getitem__(self, item):\n        inputs = prepare_input(config=self.config, tokenizer=self.tokenizer, text=self.texts[item])\n        targets = torch.tensor(self.targets[item], dtype=torch.float16)  # label\n        return {\n            \"input_ids\": inputs[\"input_ids\"],\n            \"attention_mask\": inputs[\"attention_mask\"],\n            \"targets\": targets,\n        }\n\n\nclass TestDataset(Dataset):\n    def __init__(self, config, tokenizer, texts: list[str]):\n        self.config = config\n        self.texts = texts\n        self.tokenizer = tokenizer\n\n    def __len__(self):\n        return len(self.texts)\n\n    def __getitem__(self, item):\n        inputs = prepare_input(config=self.config, tokenizer=self.tokenizer, text=self.texts[item])\n        return inputs\n\n\ndef collate(inputs):\n    mask_len = int(inputs[\"attention_mask\"].sum(axis=1).max())\n    for k, v in inputs.items():\n        if k != \"targets\":\n            inputs[k] = inputs[k][:, :mask_len]\n    return inputs","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-14T13:06:01.096734Z","iopub.execute_input":"2026-08-14T13:06:01.097068Z","iopub.status.idle":"2026-08-14T13:06:01.106908Z","shell.execute_reply.started":"2026-08-14T13:06:01.097048Z","shell.execute_reply":"2026-08-14T13:06:01.105898Z"}},"outputs":[],"execution_count":287},{"cell_type":"markdown","source":"## Model","metadata":{}},{"cell_type":"code","source":"import torch\nimport torch.nn as nn\ndef get_model_config(config):\n    model_config = AutoConfig.from_pretrained(config.model, output_hidden_states=True)\n    model_config.hidden_dropout = 0.0\n    model_config.hidden_dropout_prob = 0.0\n    model_config.attention_dropout = 0.0\n    model_config.attention_probs_dropout_prob = 0.0\n    return model_config\n\n\nclass CustomModel(nn.Module):\n    def __init__(self, config, num_label, pretrained=False):\n        super().__init__()\n        self.model_config = get_model_config(config=config)\n\n        if pretrained:\n            self.model = AutoModel.from_pretrained(config.model, config=self.model_config)\n        else:\n            self.model = AutoModel.from_config(self.model_config)\n\n        if config.gradient_checkpointing:\n            self.model.gradient_checkpointing_enable()\n\n        self.fc = nn.Linear(self.model_config.hidden_size, num_label)\n        self._init_weights(self.fc)\n\n    def _init_weights(self, module):\n        if isinstance(module, nn.Linear):\n            module.weight.data.normal_(mean=0.0, std=self.model_config.initializer_range)\n            if module.bias is not None:\n                module.bias.data.zero_()\n        elif isinstance(module, nn.Embedding):\n            module.weight.data.normal_(mean=0.0, std=self.model_config.initializer_range)\n            if module.padding_idx is not None:\n                module.weight.data[module.padding_idx].zero_()\n        elif isinstance(module, nn.LayerNorm):\n            module.bias.data.zero_()\n            module.weight.data.fill_(1.0)\n\n    def feature(self, input_ids, attention_mask):\n        outputs = self.model(input_ids=input_ids, attention_mask=attention_mask)\n        feature = outputs[0][:, 0, :]\n        return feature\n\n    def forward(self, batch):\n        feature = self.feature(batch[\"input_ids\"], batch[\"attention_mask\"])\n        output = self.fc(feature)\n        return output","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-14T12:57:53.172605Z","iopub.execute_input":"2026-08-14T12:57:53.172955Z","iopub.status.idle":"2026-08-14T12:57:53.183324Z","shell.execute_reply.started":"2026-08-14T12:57:53.172932Z","shell.execute_reply":"2026-08-14T12:57:53.182275Z"}},"outputs":[],"execution_count":268},{"cell_type":"markdown","source":"## Funcs","metadata":{}},{"cell_type":"code","source":"def train_fn(\n    config,\n    model,\n    dataloader,\n    criterion,\n    optimizer,\n    scheduler,\n    device,\n    wandb_logger,\n    _custom_step,\n):\n    model.train()\n    scaler = torch.cuda.amp.GradScaler()\n    losses = []\n\n    tbar = tqdm(enumerate(dataloader), total=len(dataloader))\n    for step, batch in tbar:\n        batch = collate(batch)\n        for k, v in batch.items():\n            batch[k] = v.to(device)\n        targets = batch[\"targets\"]\n        batch_size = targets.size(0)\n\n        with torch.cuda.amp.autocast():\n            batch_outputs = model(batch)\n            loss = criterion(batch_outputs, targets)\n\n        if config.gradient_accumulation_steps > 1:\n            loss = loss / config.gradient_accumulation_steps\n\n        scaler.scale(loss).backward()\n        if config.clip_grad_norm is not None:\n            torch.nn.utils.clip_grad_norm_(model.parameters(), config.clip_grad_norm)\n\n        if (step + 1) % config.gradient_accumulation_steps == 0:\n            scaler.step(optimizer)\n            scaler.update()\n            optimizer.zero_grad()\n            _custom_step += 1\n            if config.batch_scheduler:\n                scheduler.step()\n\n        wandb_logger.log(\n            {\"train_loss\": loss, \"lr\": scheduler.get_lr()[0], \"train_step\": _custom_step}\n        )\n\n        losses.append(float(loss))\n        tbar.set_description(f\"loss: {np.mean(losses):.4f} lr: {scheduler.get_lr()[0]:.6f}\")\n\n    loss = np.mean(losses)\n    return loss, _custom_step\n\n\ndef valid_fn(\n    config,\n    model,\n    dataloader,\n    criterion,\n    device,\n    wandb_logger,\n    _custom_step,\n):\n    model.eval()\n    outputs, targets = [], []\n    losses = []\n\n    tbar = tqdm(enumerate(dataloader), total=len(dataloader))\n    for step, batch in tbar:\n        batch = collate(batch)\n        targets.append(batch[\"targets\"])\n\n        for k, v in batch.items():\n            batch[k] = v.to(device)\n\n        batch_size = batch[\"targets\"].size(0)\n        with torch.no_grad():\n            batch_outputs = model(batch)\n            loss = criterion(batch_outputs, batch[\"targets\"])\n\n        if config.gradient_accumulation_steps > 1:\n            loss = loss / config.gradient_accumulation_steps\n\n        batch_outputs = torch.sigmoid(batch_outputs)  # to proba\n        batch_outputs = batch_outputs.to(\"cpu\").numpy()\n        outputs.append(batch_outputs)\n\n        wandb_logger.log({\"valid_loss\": loss, \"valid_step\": _custom_step})\n        _custom_step += 1\n        losses.append(float(loss))\n\n        tbar.set_description(f\"loss: {np.mean(losses):.4f}\")\n\n    outputs = np.concatenate(outputs)\n    targets = np.concatenate(targets)\n\n    loss = np.mean(losses)\n    return (loss, outputs, targets, _custom_step)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-14T12:57:57.889173Z","iopub.execute_input":"2026-08-14T12:57:57.889478Z","iopub.status.idle":"2026-08-14T12:57:57.900895Z","shell.execute_reply.started":"2026-08-14T12:57:57.889458Z","shell.execute_reply":"2026-08-14T12:57:57.899711Z"}},"outputs":[],"execution_count":269},{"cell_type":"code","source":"def get_optimizer(optimizer_config, model):\n    if optimizer_config[\"optimizer_name\"] == \"AdamW\":\n        param_optimizer = list(model.named_parameters())\n        no_decay = [\"bias\", \"LayerNorm.bias\", \"LayerNorm.weight\"]\n        optimizer_parameters = [\n            {\n                \"params\": [\n                    p\n                    for n, p in model.model.named_parameters()\n                    if not any(nd in n for nd in no_decay)\n                ],\n                \"lr\": optimizer_config[\"encoder_lr\"],\n                \"weight_decay\": optimizer_config[\"weight_decay\"],\n            },\n            {\n                \"params\": [\n                    p for n, p in model.model.named_parameters() if any(nd in n for nd in no_decay)\n                ],\n                \"lr\": optimizer_config[\"encoder_lr\"],\n                \"weight_decay\": 0.0,\n            },\n            {\n                \"params\": [p for n, p in model.named_parameters() if \"model\" not in n],\n                \"lr\": optimizer_config[\"decoder_lr\"],\n                \"weight_decay\": 0.0,\n            },\n        ]\n        optimizer = AdamW(\n            optimizer_parameters,\n            lr=optimizer_config[\"lr\"],\n            betas=optimizer_config[\"beta\"],\n            eps=optimizer_config[\"eps\"],\n        )\n        return optimizer\n    else:\n        raise NotImplementedError\n\n\ndef get_scheduler(scheduler_config, optimizer, num_train_steps):\n    if scheduler_config[\"scheduler_name\"] == \"linear\":\n        scheduler = get_linear_schedule_with_warmup(\n            optimizer,\n            num_warmup_steps=int(scheduler_config[\"num_warmup_steps_rate\"] * num_train_steps),\n            num_training_steps=num_train_steps,\n        )\n        return scheduler\n\n    elif scheduler_config[\"scheduler_name\"] == \"cosine\":\n        scheduler = get_cosine_schedule_with_warmup(\n            optimizer,\n            num_warmup_steps=int(scheduler_config[\"num_warmup_steps_rate\"] * num_train_steps),\n            num_training_steps=num_train_steps,\n            num_cycles=scheduler_config[\"num_cycles\"],\n        )\n        return scheduler\n\n    elif scheduler_config[\"scheduler_name\"] == \"cosine_restarts\":\n        \"\"\"\n        example:\n            first_cycle_steps_ratio = 0.25,\n            cycle_mult = 1.0,\n            max_lr = 2e-5,\n            min_lr = 1e-7,\n            warmup_steps=100,\n            gamma=0.8)\n        \"\"\"\n        scheduler = CosineAnnealingWarmupRestarts(\n            optimizer,\n            first_cycle_steps=int(num_train_steps * scheduler_config[\"first_cycle_steps_ratio\"]),\n            cycle_mult=scheduler_config[\"cycle_mult\"],\n            max_lr=scheduler_config[\"max_lr\"],\n            min_lr=scheduler_config[\"min_lr\"],\n            warmup_steps=scheduler_config[\"warmup_steps\"],\n            gamma=scheduler_config[\"gamma\"],\n        )\n        return scheduler\n\n    else:\n        raise NotImplementedError\n\n\ndef train_loop(config, name, train_df, valid_df, target_columns, tokenizer, device):\n    LOGGER.info(f\"========== {name} training ==========\")\n\n    # set wandb logger\n    wandb.init(\n        project=config.competition,\n        name=name,\n        group=f\"{config.name}\",\n        job_type=\"train\",\n        anonymous=None,\n        reinit=True,\n    )\n\n    # dataset, dataloader\n    train_dataset = TrainDataset(\n        config=config,\n        texts=train_df[\"seq\"].tolist(),\n        targets=train_df[target_columns].to_numpy(),\n        tokenizer=tokenizer,\n    )\n    valid_dataset = TrainDataset(\n        config=config,\n        texts=valid_df[\"seq\"].tolist(),\n        targets=valid_df[target_columns].to_numpy(),\n        tokenizer=tokenizer,\n    )\n    train_dataloader = DataLoader(\n        train_dataset,\n        batch_size=config.train_batch_size,\n        shuffle=True,\n        num_workers=config.num_workers,\n        pin_memory=True,\n        drop_last=True,\n    )\n    valid_dataloader = DataLoader(\n        valid_dataset,\n        batch_size=config.valid_batch_size,\n        shuffle=False,\n        num_workers=config.num_workers,\n        pin_memory=True,\n        drop_last=False,\n    )\n\n    # set model & optimizer\n    model = CustomModel(config=config, num_label=len(target_columns), pretrained=True)\n    model.to(device)\n    optimizer = get_optimizer(optimizer_config=config.optimizer, model=model)\n\n    # set scheduler\n    num_train_steps = int(\n        len(train_dataloader) * config.max_epochs // config.gradient_accumulation_steps\n    )\n    scheduler = get_scheduler(\n        scheduler_config=config.scheduler, optimizer=optimizer, num_train_steps=num_train_steps\n    )\n\n    # loop\n    criterion = nn.BCEWithLogitsLoss()\n    score_fn = MultilabelF1Score(num_labels=len(target_columns))  # TODO : use custom f1\n\n    best_score = -np.inf\n    tr_step, val_step = 0, 0\n    for epoch in range(Config.max_epochs):\n        # training\n        loss, tr_step = train_fn(\n            config=config,\n            model=model,\n            dataloader=train_dataloader,\n            criterion=criterion,\n            optimizer=optimizer,\n            scheduler=scheduler,\n            device=device,\n            wandb_logger=wandb,\n            _custom_step=tr_step,\n        )\n\n        # validation\n        val_loss, val_outputs, val_targets, val_step = valid_fn(\n            config=config,\n            model=model,\n            dataloader=valid_dataloader,\n            criterion=criterion,\n            device=device,\n            wandb_logger=wandb,\n            _custom_step=val_step,\n        )\n\n        # calc score (the higher, the better)\n        eval_score = score_fn(torch.tensor(val_outputs).float(), torch.tensor(val_targets).float())\n        logs = {\n            \"Epoch\": epoch,\n            \"eval_score\": eval_score,\n            \"train_loss_epoch\": loss.item(),\n            \"valid_loss_epoch\": val_loss.item(),\n        }\n        wandb.log(logs)\n        LOGGER.info(logs)\n\n        if best_score < eval_score:\n            best_score = eval_score\n            LOGGER.info(f\"epoch {epoch} - best score: {best_score:.4f} model\")\n\n            torch.save(model.state_dict(), EXP_MODELS / f\"{name}.pth\")  # save model weight\n            joblib.dump(val_outputs, EXP_PREDS / f\"{name}.pkl\")  # save outputs\n\n        if not config.batch_scheduler:\n            scheduler.step()\n\n    torch.cuda.empty_cache()\n    gc.collect()\n    wandb.finish(quiet=True)\n\n    # save best predictions with id\n    best_val_outputs = joblib.load(EXP_PREDS / f\"{name}.pkl\")\n    outputs = {\n        \"id\": valid_df.index.tolist(),\n        \"target_names\": target_columns,\n        \"predictions\": best_val_outputs,\n    }\n    joblib.dump(outputs, EXP_PREDS / f\"{name}_best.pkl\")\n\n    return outputs","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-14T13:06:15.334969Z","iopub.execute_input":"2026-08-14T13:06:15.335385Z","iopub.status.idle":"2026-08-14T13:06:15.354223Z","shell.execute_reply.started":"2026-08-14T13:06:15.335357Z","shell.execute_reply":"2026-08-14T13:06:15.352736Z"}},"outputs":[],"execution_count":289},{"cell_type":"code","source":"def inference_fn(test_dataloader, model, device):\n    preds, targets_masks = [], []\n    model.eval()\n    model.to(device)\n\n    tbar = tqdm(test_dataloader, total=len(test_dataloader))\n    for batch in tbar:\n        for k, v in batch.items():\n            batch[k] = v.to(device)\n\n        with torch.no_grad():\n            outputs = model(batch)\n            outputs = torch.sigmoid(outputs)\n\n        outputs = outputs.cpu().detach().numpy()\n        preds.append(outputs)\n\n    return np.concatenate(preds)\n\n\ndef get_predictions(config, test_df, tokenizer, model_path, target_columns, device):\n    test_dataset = TestDataset(config=config, tokenizer=tokenizer, texts=test_df[\"seq\"])\n    test_dataloader = DataLoader(\n        test_dataset,\n        batch_size=config.valid_batch_size,\n        shuffle=False,\n        collate_fn=DataCollatorWithPadding(tokenizer=tokenizer, padding=\"longest\"),\n        num_workers=config.num_workers,\n        pin_memory=True,\n        drop_last=False,\n    )\n\n    # get model\n    model = CustomModel(config=config, num_label=len(target_columns), pretrained=False)\n    state = torch.load(model_path)\n    model.load_state_dict(state)\n    predictions = inference_fn(test_dataloader, model, device)\n\n    del model, state, test_dataloader\n    gc.collect()\n    torch.cuda.empty_cache()\n\n    outputs = {\n        \"id\": test_df.index.tolist(),\n        \"target_names\": target_columns,\n        \"predictions\": predictions,\n    }\n    return outputs","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-14T13:06:21.731678Z","iopub.execute_input":"2026-08-14T13:06:21.732767Z","iopub.status.idle":"2026-08-14T13:06:21.740996Z","shell.execute_reply.started":"2026-08-14T13:06:21.732733Z","shell.execute_reply":"2026-08-14T13:06:21.740064Z"}},"outputs":[],"execution_count":290},{"cell_type":"markdown","source":"## Training","metadata":{}},{"cell_type":"code","source":"import os\nos.environ[\"HF_ENDPOINT\"] = \"https://hf-mirror.com\"\nfrom transformers import AutoTokenizer\n# 这里引号内的模型名要和config.model的值一模一样\ntokenizer = AutoTokenizer.from_pretrained(\"nvidia/esm2_t33_650M_UR50D\")","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-14T13:28:21.093048Z","iopub.execute_input":"2026-08-14T13:28:21.093359Z","iopub.status.idle":"2026-08-14T13:28:53.593005Z","shell.execute_reply.started":"2026-08-14T13:28:21.093338Z","shell.execute_reply":"2026-08-14T13:28:53.591136Z"}},"outputs":[{"traceback":["\u001b[0;31m---------------------------------------------------------------------------\u001b[0m","\u001b[0;31mgaierror\u001b[0m                                  Traceback (most recent call last)","File \u001b[0;32m/opt/conda/lib/python3.10/site-packages/urllib3/connection.py:174\u001b[0m, in \u001b[0;36mHTTPConnection._new_conn\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m    173\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 174\u001b[0m     conn \u001b[38;5;241m=\u001b[39m \u001b[43mconnection\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcreate_connection\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m    175\u001b[0m \u001b[43m        \u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_dns_host\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mport\u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mtimeout\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mextra_kw\u001b[49m\n\u001b[1;32m    176\u001b[0m \u001b[43m    \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m    178\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m SocketTimeout:\n","File \u001b[0;32m/opt/conda/lib/python3.10/site-packages/urllib3/util/connection.py:72\u001b[0m, in \u001b[0;36mcreate_connection\u001b[0;34m(address, timeout, source_address, socket_options)\u001b[0m\n\u001b[1;32m     68\u001b[0m     \u001b[38;5;28;01mreturn\u001b[39;00m six\u001b[38;5;241m.\u001b[39mraise_from(\n\u001b[1;32m     69\u001b[0m         LocationParseError(\u001b[38;5;124mu\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;132;01m%s\u001b[39;00m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m, label empty or too long\u001b[39m\u001b[38;5;124m\"\u001b[39m \u001b[38;5;241m%\u001b[39m host), \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[1;32m     70\u001b[0m     )\n\u001b[0;32m---> 72\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m res \u001b[38;5;129;01min\u001b[39;00m \u001b[43msocket\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mgetaddrinfo\u001b[49m\u001b[43m(\u001b[49m\u001b[43mhost\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mport\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mfamily\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43msocket\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mSOCK_STREAM\u001b[49m\u001b[43m)\u001b[49m:\n\u001b[1;32m     73\u001b[0m     af, socktype, proto, canonname, sa \u001b[38;5;241m=\u001b[39m res\n","File \u001b[0;32m/opt/conda/lib/python3.10/socket.py:955\u001b[0m, in \u001b[0;36mgetaddrinfo\u001b[0;34m(host, port, family, type, proto, flags)\u001b[0m\n\u001b[1;32m    954\u001b[0m addrlist \u001b[38;5;241m=\u001b[39m []\n\u001b[0;32m--> 955\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m res \u001b[38;5;129;01min\u001b[39;00m \u001b[43m_socket\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mgetaddrinfo\u001b[49m\u001b[43m(\u001b[49m\u001b[43mhost\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mport\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mfamily\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mtype\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mproto\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mflags\u001b[49m\u001b[43m)\u001b[49m:\n\u001b[1;32m    956\u001b[0m     af, socktype, proto, canonname, sa \u001b[38;5;241m=\u001b[39m res\n","\u001b[0;31mgaierror\u001b[0m: [Errno -3] Temporary failure in name resolution","\nDuring handling of the above exception, another exception occurred:\n","\u001b[0;31mKeyboardInterrupt\u001b[0m                         Traceback (most recent call last)","Cell \u001b[0;32mIn[309], line 5\u001b[0m\n\u001b[1;32m      3\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mtransformers\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m AutoTokenizer\n\u001b[1;32m      4\u001b[0m \u001b[38;5;66;03m# 这里引号内的模型名要和config.model的值一模一样\u001b[39;00m\n\u001b[0;32m----> 5\u001b[0m tokenizer \u001b[38;5;241m=\u001b[39m \u001b[43mAutoTokenizer\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mfrom_pretrained\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mnvidia/esm2_t33_650M_UR50D\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m\n","File \u001b[0;32m/opt/conda/lib/python3.10/site-packages/transformers/models/auto/tokenization_auto.py:643\u001b[0m, in \u001b[0;36mAutoTokenizer.from_pretrained\u001b[0;34m(cls, pretrained_model_name_or_path, *inputs, **kwargs)\u001b[0m\n\u001b[1;32m    640\u001b[0m     \u001b[38;5;28;01mreturn\u001b[39;00m tokenizer_class\u001b[38;5;241m.\u001b[39mfrom_pretrained(pretrained_model_name_or_path, \u001b[38;5;241m*\u001b[39minputs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs)\n\u001b[1;32m    642\u001b[0m \u001b[38;5;66;03m# Next, let's try to use the tokenizer_config file to get the tokenizer class.\u001b[39;00m\n\u001b[0;32m--> 643\u001b[0m tokenizer_config \u001b[38;5;241m=\u001b[39m \u001b[43mget_tokenizer_config\u001b[49m\u001b[43m(\u001b[49m\u001b[43mpretrained_model_name_or_path\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m    644\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m_commit_hash\u001b[39m\u001b[38;5;124m\"\u001b[39m \u001b[38;5;129;01min\u001b[39;00m tokenizer_config:\n\u001b[1;32m    645\u001b[0m     kwargs[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m_commit_hash\u001b[39m\u001b[38;5;124m\"\u001b[39m] \u001b[38;5;241m=\u001b[39m tokenizer_config[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m_commit_hash\u001b[39m\u001b[38;5;124m\"\u001b[39m]\n","File \u001b[0;32m/opt/conda/lib/python3.10/site-packages/transformers/models/auto/tokenization_auto.py:487\u001b[0m, in \u001b[0;36mget_tokenizer_config\u001b[0;34m(pretrained_model_name_or_path, cache_dir, force_download, resume_download, proxies, use_auth_token, revision, local_files_only, subfolder, **kwargs)\u001b[0m\n\u001b[1;32m    425\u001b[0m \u001b[38;5;250m\u001b[39m\u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m    426\u001b[0m \u001b[38;5;124;03mLoads the tokenizer configuration from a pretrained model tokenizer configuration.\u001b[39;00m\n\u001b[1;32m    427\u001b[0m \n\u001b[0;32m   (...)\u001b[0m\n\u001b[1;32m    484\u001b[0m \u001b[38;5;124;03mtokenizer_config = get_tokenizer_config(\"tokenizer-test\")\u001b[39;00m\n\u001b[1;32m    485\u001b[0m \u001b[38;5;124;03m```\"\"\"\u001b[39;00m\n\u001b[1;32m    486\u001b[0m commit_hash \u001b[38;5;241m=\u001b[39m kwargs\u001b[38;5;241m.\u001b[39mget(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m_commit_hash\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;28;01mNone\u001b[39;00m)\n\u001b[0;32m--> 487\u001b[0m resolved_config_file \u001b[38;5;241m=\u001b[39m \u001b[43mcached_file\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m    488\u001b[0m \u001b[43m    \u001b[49m\u001b[43mpretrained_model_name_or_path\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m    489\u001b[0m \u001b[43m    \u001b[49m\u001b[43mTOKENIZER_CONFIG_FILE\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m    490\u001b[0m \u001b[43m    \u001b[49m\u001b[43mcache_dir\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcache_dir\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m    491\u001b[0m \u001b[43m    \u001b[49m\u001b[43mforce_download\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mforce_download\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m    492\u001b[0m \u001b[43m    \u001b[49m\u001b[43mresume_download\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mresume_download\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m    493\u001b[0m \u001b[43m    \u001b[49m\u001b[43mproxies\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mproxies\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m    494\u001b[0m \u001b[43m    \u001b[49m\u001b[43muse_auth_token\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43muse_auth_token\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m    495\u001b[0m \u001b[43m    \u001b[49m\u001b[43mrevision\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrevision\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m    496\u001b[0m \u001b[43m    \u001b[49m\u001b[43mlocal_files_only\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mlocal_files_only\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m    497\u001b[0m \u001b[43m    \u001b[49m\u001b[43msubfolder\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43msubfolder\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m    498\u001b[0m \u001b[43m    \u001b[49m\u001b[43m_raise_exceptions_for_missing_entries\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[1;32m    499\u001b[0m \u001b[43m    \u001b[49m\u001b[43m_raise_exceptions_for_connection_errors\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[1;32m    500\u001b[0m \u001b[43m    \u001b[49m\u001b[43m_commit_hash\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcommit_hash\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m    501\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m    502\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m resolved_config_file \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m    503\u001b[0m     logger\u001b[38;5;241m.\u001b[39minfo(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mCould not locate the tokenizer configuration file, will try to use the model config instead.\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n","File \u001b[0;32m/opt/conda/lib/python3.10/site-packages/transformers/utils/hub.py:417\u001b[0m, in \u001b[0;36mcached_file\u001b[0;34m(path_or_repo_id, filename, cache_dir, force_download, resume_download, proxies, use_auth_token, revision, local_files_only, subfolder, repo_type, user_agent, _raise_exceptions_for_missing_entries, _raise_exceptions_for_connection_errors, _commit_hash)\u001b[0m\n\u001b[1;32m    414\u001b[0m user_agent \u001b[38;5;241m=\u001b[39m http_user_agent(user_agent)\n\u001b[1;32m    415\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m    416\u001b[0m     \u001b[38;5;66;03m# Load from URL or cache if already cached\u001b[39;00m\n\u001b[0;32m--> 417\u001b[0m     resolved_file \u001b[38;5;241m=\u001b[39m \u001b[43mhf_hub_download\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m    418\u001b[0m \u001b[43m        \u001b[49m\u001b[43mpath_or_repo_id\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m    419\u001b[0m \u001b[43m        \u001b[49m\u001b[43mfilename\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m    420\u001b[0m \u001b[43m        \u001b[49m\u001b[43msubfolder\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mNone\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[38;5;28;43;01mif\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[38;5;28;43mlen\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43msubfolder\u001b[49m\u001b[43m)\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m==\u001b[39;49m\u001b[43m \u001b[49m\u001b[38;5;241;43m0\u001b[39;49m\u001b[43m \u001b[49m\u001b[38;5;28;43;01melse\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43msubfolder\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m    421\u001b[0m \u001b[43m        \u001b[49m\u001b[43mrepo_type\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrepo_type\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m    422\u001b[0m \u001b[43m        \u001b[49m\u001b[43mrevision\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrevision\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m    423\u001b[0m \u001b[43m        \u001b[49m\u001b[43mcache_dir\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcache_dir\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m    424\u001b[0m \u001b[43m        \u001b[49m\u001b[43muser_agent\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43muser_agent\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m    425\u001b[0m \u001b[43m        \u001b[49m\u001b[43mforce_download\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mforce_download\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m    426\u001b[0m \u001b[43m        \u001b[49m\u001b[43mproxies\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mproxies\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m    427\u001b[0m \u001b[43m        \u001b[49m\u001b[43mresume_download\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mresume_download\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m    428\u001b[0m \u001b[43m        \u001b[49m\u001b[43muse_auth_token\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43muse_auth_token\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m    429\u001b[0m \u001b[43m        \u001b[49m\u001b[43mlocal_files_only\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mlocal_files_only\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m    430\u001b[0m \u001b[43m    \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m    432\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m RepositoryNotFoundError:\n\u001b[1;32m    433\u001b[0m     \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mEnvironmentError\u001b[39;00m(\n\u001b[1;32m    434\u001b[0m         \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mpath_or_repo_id\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m is not a local folder and is not a valid model identifier \u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m    435\u001b[0m         \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mlisted on \u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mhttps://huggingface.co/models\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[38;5;124mIf this is a private repository, make sure to \u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m    436\u001b[0m         \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mpass a token having permission to this repo with `use_auth_token` or log in with \u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m    437\u001b[0m         \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m`huggingface-cli login` and pass `use_auth_token=True`.\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m    438\u001b[0m     )\n","File \u001b[0;32m/opt/conda/lib/python3.10/site-packages/huggingface_hub/utils/_validators.py:120\u001b[0m, in \u001b[0;36mvalidate_hf_hub_args.<locals>._inner_fn\u001b[0;34m(*args, **kwargs)\u001b[0m\n\u001b[1;32m    117\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m check_use_auth_token:\n\u001b[1;32m    118\u001b[0m     kwargs \u001b[38;5;241m=\u001b[39m smoothly_deprecate_use_auth_token(fn_name\u001b[38;5;241m=\u001b[39mfn\u001b[38;5;241m.\u001b[39m\u001b[38;5;18m__name__\u001b[39m, has_token\u001b[38;5;241m=\u001b[39mhas_token, kwargs\u001b[38;5;241m=\u001b[39mkwargs)\n\u001b[0;32m--> 120\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mfn\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n","File \u001b[0;32m/opt/conda/lib/python3.10/site-packages/huggingface_hub/file_download.py:1195\u001b[0m, in \u001b[0;36mhf_hub_download\u001b[0;34m(repo_id, filename, subfolder, repo_type, revision, library_name, library_version, cache_dir, local_dir, local_dir_use_symlinks, user_agent, force_download, force_filename, proxies, etag_timeout, resume_download, token, local_files_only, legacy_cache_layout)\u001b[0m\n\u001b[1;32m   1193\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m   1194\u001b[0m     \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m-> 1195\u001b[0m         metadata \u001b[38;5;241m=\u001b[39m \u001b[43mget_hf_file_metadata\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m   1196\u001b[0m \u001b[43m            \u001b[49m\u001b[43murl\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m   1197\u001b[0m \u001b[43m            \u001b[49m\u001b[43mtoken\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtoken\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m   1198\u001b[0m \u001b[43m            \u001b[49m\u001b[43mproxies\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mproxies\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m   1199\u001b[0m \u001b[43m            \u001b[49m\u001b[43mtimeout\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43metag_timeout\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m   1200\u001b[0m \u001b[43m        \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m   1201\u001b[0m     \u001b[38;5;28;01mexcept\u001b[39;00m EntryNotFoundError \u001b[38;5;28;01mas\u001b[39;00m http_error:\n\u001b[1;32m   1202\u001b[0m         \u001b[38;5;66;03m# Cache the non-existence of the file and raise\u001b[39;00m\n\u001b[1;32m   1203\u001b[0m         commit_hash \u001b[38;5;241m=\u001b[39m http_error\u001b[38;5;241m.\u001b[39mresponse\u001b[38;5;241m.\u001b[39mheaders\u001b[38;5;241m.\u001b[39mget(HUGGINGFACE_HEADER_X_REPO_COMMIT)\n","File \u001b[0;32m/opt/conda/lib/python3.10/site-packages/huggingface_hub/utils/_validators.py:120\u001b[0m, in \u001b[0;36mvalidate_hf_hub_args.<locals>._inner_fn\u001b[0;34m(*args, **kwargs)\u001b[0m\n\u001b[1;32m    117\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m check_use_auth_token:\n\u001b[1;32m    118\u001b[0m     kwargs \u001b[38;5;241m=\u001b[39m smoothly_deprecate_use_auth_token(fn_name\u001b[38;5;241m=\u001b[39mfn\u001b[38;5;241m.\u001b[39m\u001b[38;5;18m__name__\u001b[39m, has_token\u001b[38;5;241m=\u001b[39mhas_token, kwargs\u001b[38;5;241m=\u001b[39mkwargs)\n\u001b[0;32m--> 120\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mfn\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n","File \u001b[0;32m/opt/conda/lib/python3.10/site-packages/huggingface_hub/file_download.py:1532\u001b[0m, in \u001b[0;36mget_hf_file_metadata\u001b[0;34m(url, token, proxies, timeout)\u001b[0m\n\u001b[1;32m   1529\u001b[0m headers[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mAccept-Encoding\u001b[39m\u001b[38;5;124m\"\u001b[39m] \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124midentity\u001b[39m\u001b[38;5;124m\"\u001b[39m  \u001b[38;5;66;03m# prevent any compression => we want to know the real size of the file\u001b[39;00m\n\u001b[1;32m   1531\u001b[0m \u001b[38;5;66;03m# Retrieve metadata\u001b[39;00m\n\u001b[0;32m-> 1532\u001b[0m r \u001b[38;5;241m=\u001b[39m \u001b[43m_request_wrapper\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m   1533\u001b[0m \u001b[43m    \u001b[49m\u001b[43mmethod\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mHEAD\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\n\u001b[1;32m   1534\u001b[0m \u001b[43m    \u001b[49m\u001b[43murl\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m   1535\u001b[0m \u001b[43m    \u001b[49m\u001b[43mheaders\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mheaders\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m   1536\u001b[0m \u001b[43m    \u001b[49m\u001b[43mallow_redirects\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[1;32m   1537\u001b[0m \u001b[43m    \u001b[49m\u001b[43mfollow_relative_redirects\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mTrue\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[1;32m   1538\u001b[0m \u001b[43m    \u001b[49m\u001b[43mproxies\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mproxies\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m   1539\u001b[0m \u001b[43m    \u001b[49m\u001b[43mtimeout\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtimeout\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m   1540\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m   1541\u001b[0m hf_raise_for_status(r)\n\u001b[1;32m   1543\u001b[0m \u001b[38;5;66;03m# Return\u001b[39;00m\n","File \u001b[0;32m/opt/conda/lib/python3.10/site-packages/huggingface_hub/file_download.py:407\u001b[0m, in \u001b[0;36m_request_wrapper\u001b[0;34m(method, url, max_retries, base_wait_time, max_wait_time, timeout, follow_relative_redirects, **params)\u001b[0m\n\u001b[1;32m    405\u001b[0m \u001b[38;5;66;03m# 2. Force relative redirection\u001b[39;00m\n\u001b[1;32m    406\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m follow_relative_redirects:\n\u001b[0;32m--> 407\u001b[0m     response \u001b[38;5;241m=\u001b[39m \u001b[43m_request_wrapper\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m    408\u001b[0m \u001b[43m        \u001b[49m\u001b[43mmethod\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mmethod\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m    409\u001b[0m \u001b[43m        \u001b[49m\u001b[43murl\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m    410\u001b[0m \u001b[43m        \u001b[49m\u001b[43mmax_retries\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mmax_retries\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m    411\u001b[0m \u001b[43m        \u001b[49m\u001b[43mbase_wait_time\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mbase_wait_time\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m    412\u001b[0m \u001b[43m        \u001b[49m\u001b[43mmax_wait_time\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mmax_wait_time\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m    413\u001b[0m \u001b[43m        \u001b[49m\u001b[43mtimeout\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtimeout\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m    414\u001b[0m \u001b[43m        \u001b[49m\u001b[43mfollow_relative_redirects\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[1;32m    415\u001b[0m \u001b[43m        \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mparams\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m    416\u001b[0m \u001b[43m    \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m    418\u001b[0m     \u001b[38;5;66;03m# If redirection, we redirect only relative paths.\u001b[39;00m\n\u001b[1;32m    419\u001b[0m     \u001b[38;5;66;03m# This is useful in case of a renamed repository.\u001b[39;00m\n\u001b[1;32m    420\u001b[0m     \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;241m300\u001b[39m \u001b[38;5;241m<\u001b[39m\u001b[38;5;241m=\u001b[39m response\u001b[38;5;241m.\u001b[39mstatus_code \u001b[38;5;241m<\u001b[39m\u001b[38;5;241m=\u001b[39m \u001b[38;5;241m399\u001b[39m:\n","File \u001b[0;32m/opt/conda/lib/python3.10/site-packages/huggingface_hub/file_download.py:442\u001b[0m, in \u001b[0;36m_request_wrapper\u001b[0;34m(method, url, max_retries, base_wait_time, max_wait_time, timeout, follow_relative_redirects, **params)\u001b[0m\n\u001b[1;32m    439\u001b[0m     \u001b[38;5;28;01mreturn\u001b[39;00m response\n\u001b[1;32m    441\u001b[0m \u001b[38;5;66;03m# 3. Exponential backoff\u001b[39;00m\n\u001b[0;32m--> 442\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mhttp_backoff\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m    443\u001b[0m \u001b[43m    \u001b[49m\u001b[43mmethod\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mmethod\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m    444\u001b[0m \u001b[43m    \u001b[49m\u001b[43murl\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m    445\u001b[0m \u001b[43m    \u001b[49m\u001b[43mmax_retries\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mmax_retries\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m    446\u001b[0m \u001b[43m    \u001b[49m\u001b[43mbase_wait_time\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mbase_wait_time\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m    447\u001b[0m \u001b[43m    \u001b[49m\u001b[43mmax_wait_time\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mmax_wait_time\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m    448\u001b[0m \u001b[43m    \u001b[49m\u001b[43mretry_on_exceptions\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mConnectTimeout\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mProxyError\u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m    449\u001b[0m \u001b[43m    \u001b[49m\u001b[43mretry_on_status_codes\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m    450\u001b[0m \u001b[43m    \u001b[49m\u001b[43mtimeout\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtimeout\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m    451\u001b[0m \u001b[43m    \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mparams\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m    452\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n","File \u001b[0;32m/opt/conda/lib/python3.10/site-packages/huggingface_hub/utils/_http.py:212\u001b[0m, in \u001b[0;36mhttp_backoff\u001b[0;34m(method, url, max_retries, base_wait_time, max_wait_time, retry_on_exceptions, retry_on_status_codes, **kwargs)\u001b[0m\n\u001b[1;32m    209\u001b[0m     kwargs[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mdata\u001b[39m\u001b[38;5;124m\"\u001b[39m]\u001b[38;5;241m.\u001b[39mseek(io_obj_initial_pos)\n\u001b[1;32m    211\u001b[0m \u001b[38;5;66;03m# Perform request and return if status_code is not in the retry list.\u001b[39;00m\n\u001b[0;32m--> 212\u001b[0m response \u001b[38;5;241m=\u001b[39m \u001b[43msession\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrequest\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmethod\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mmethod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43murl\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m    213\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m response\u001b[38;5;241m.\u001b[39mstatus_code \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;129;01min\u001b[39;00m retry_on_status_codes:\n\u001b[1;32m    214\u001b[0m     \u001b[38;5;28;01mreturn\u001b[39;00m response\n","File \u001b[0;32m/opt/conda/lib/python3.10/site-packages/requests/sessions.py:587\u001b[0m, in \u001b[0;36mSession.request\u001b[0;34m(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json)\u001b[0m\n\u001b[1;32m    582\u001b[0m send_kwargs \u001b[38;5;241m=\u001b[39m {\n\u001b[1;32m    583\u001b[0m     \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtimeout\u001b[39m\u001b[38;5;124m\"\u001b[39m: timeout,\n\u001b[1;32m    584\u001b[0m     \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mallow_redirects\u001b[39m\u001b[38;5;124m\"\u001b[39m: allow_redirects,\n\u001b[1;32m    585\u001b[0m }\n\u001b[1;32m    586\u001b[0m send_kwargs\u001b[38;5;241m.\u001b[39mupdate(settings)\n\u001b[0;32m--> 587\u001b[0m resp \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msend\u001b[49m\u001b[43m(\u001b[49m\u001b[43mprep\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43msend_kwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m    589\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m resp\n","File \u001b[0;32m/opt/conda/lib/python3.10/site-packages/requests/sessions.py:701\u001b[0m, in \u001b[0;36mSession.send\u001b[0;34m(self, request, **kwargs)\u001b[0m\n\u001b[1;32m    698\u001b[0m start \u001b[38;5;241m=\u001b[39m preferred_clock()\n\u001b[1;32m    700\u001b[0m \u001b[38;5;66;03m# Send the request\u001b[39;00m\n\u001b[0;32m--> 701\u001b[0m r \u001b[38;5;241m=\u001b[39m \u001b[43madapter\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msend\u001b[49m\u001b[43m(\u001b[49m\u001b[43mrequest\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m    703\u001b[0m \u001b[38;5;66;03m# Total elapsed time of the request (approximately)\u001b[39;00m\n\u001b[1;32m    704\u001b[0m elapsed \u001b[38;5;241m=\u001b[39m preferred_clock() \u001b[38;5;241m-\u001b[39m start\n","File \u001b[0;32m/opt/conda/lib/python3.10/site-packages/requests/adapters.py:487\u001b[0m, in \u001b[0;36mHTTPAdapter.send\u001b[0;34m(self, request, stream, timeout, verify, cert, proxies)\u001b[0m\n\u001b[1;32m    484\u001b[0m     timeout \u001b[38;5;241m=\u001b[39m TimeoutSauce(connect\u001b[38;5;241m=\u001b[39mtimeout, read\u001b[38;5;241m=\u001b[39mtimeout)\n\u001b[1;32m    486\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 487\u001b[0m     resp \u001b[38;5;241m=\u001b[39m \u001b[43mconn\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43murlopen\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m    488\u001b[0m \u001b[43m        \u001b[49m\u001b[43mmethod\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrequest\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmethod\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m    489\u001b[0m \u001b[43m        \u001b[49m\u001b[43murl\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m    490\u001b[0m \u001b[43m        \u001b[49m\u001b[43mbody\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrequest\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mbody\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m    491\u001b[0m \u001b[43m        \u001b[49m\u001b[43mheaders\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrequest\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mheaders\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m    492\u001b[0m \u001b[43m        \u001b[49m\u001b[43mredirect\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[1;32m    493\u001b[0m \u001b[43m        \u001b[49m\u001b[43massert_same_host\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[1;32m    494\u001b[0m \u001b[43m        \u001b[49m\u001b[43mpreload_content\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[1;32m    495\u001b[0m \u001b[43m        \u001b[49m\u001b[43mdecode_content\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[1;32m    496\u001b[0m \u001b[43m        \u001b[49m\u001b[43mretries\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmax_retries\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m    497\u001b[0m \u001b[43m        \u001b[49m\u001b[43mtimeout\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtimeout\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m    498\u001b[0m \u001b[43m        \u001b[49m\u001b[43mchunked\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mchunked\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m    499\u001b[0m \u001b[43m    \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m    501\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m (ProtocolError, \u001b[38;5;167;01mOSError\u001b[39;00m) \u001b[38;5;28;01mas\u001b[39;00m err:\n\u001b[1;32m    502\u001b[0m     \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mConnectionError\u001b[39;00m(err, request\u001b[38;5;241m=\u001b[39mrequest)\n","File \u001b[0;32m/opt/conda/lib/python3.10/site-packages/urllib3/connectionpool.py:703\u001b[0m, in \u001b[0;36mHTTPConnectionPool.urlopen\u001b[0;34m(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)\u001b[0m\n\u001b[1;32m    700\u001b[0m     \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_prepare_proxy(conn)\n\u001b[1;32m    702\u001b[0m \u001b[38;5;66;03m# Make the request on the httplib connection object.\u001b[39;00m\n\u001b[0;32m--> 703\u001b[0m httplib_response \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_make_request\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m    704\u001b[0m \u001b[43m    \u001b[49m\u001b[43mconn\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m    705\u001b[0m \u001b[43m    \u001b[49m\u001b[43mmethod\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m    706\u001b[0m \u001b[43m    \u001b[49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m    707\u001b[0m \u001b[43m    \u001b[49m\u001b[43mtimeout\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtimeout_obj\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m    708\u001b[0m \u001b[43m    \u001b[49m\u001b[43mbody\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mbody\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m    709\u001b[0m \u001b[43m    \u001b[49m\u001b[43mheaders\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mheaders\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m    710\u001b[0m \u001b[43m    \u001b[49m\u001b[43mchunked\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mchunked\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m    711\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m    713\u001b[0m \u001b[38;5;66;03m# If we're going to release the connection in ``finally:``, then\u001b[39;00m\n\u001b[1;32m    714\u001b[0m \u001b[38;5;66;03m# the response doesn't need to know about the connection. Otherwise\u001b[39;00m\n\u001b[1;32m    715\u001b[0m \u001b[38;5;66;03m# it will also try to release it and we'll have a double-release\u001b[39;00m\n\u001b[1;32m    716\u001b[0m \u001b[38;5;66;03m# mess.\u001b[39;00m\n\u001b[1;32m    717\u001b[0m response_conn \u001b[38;5;241m=\u001b[39m conn \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m release_conn \u001b[38;5;28;01melse\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m\n","File \u001b[0;32m/opt/conda/lib/python3.10/site-packages/urllib3/connectionpool.py:386\u001b[0m, in \u001b[0;36mHTTPConnectionPool._make_request\u001b[0;34m(self, conn, method, url, timeout, chunked, **httplib_request_kw)\u001b[0m\n\u001b[1;32m    384\u001b[0m \u001b[38;5;66;03m# Trigger any extra validation we need to do.\u001b[39;00m\n\u001b[1;32m    385\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 386\u001b[0m     \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_validate_conn\u001b[49m\u001b[43m(\u001b[49m\u001b[43mconn\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m    387\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m (SocketTimeout, BaseSSLError) \u001b[38;5;28;01mas\u001b[39;00m e:\n\u001b[1;32m    388\u001b[0m     \u001b[38;5;66;03m# Py2 raises this as a BaseSSLError, Py3 raises it as socket timeout.\u001b[39;00m\n\u001b[1;32m    389\u001b[0m     \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_raise_timeout(err\u001b[38;5;241m=\u001b[39me, url\u001b[38;5;241m=\u001b[39murl, timeout_value\u001b[38;5;241m=\u001b[39mconn\u001b[38;5;241m.\u001b[39mtimeout)\n","File \u001b[0;32m/opt/conda/lib/python3.10/site-packages/urllib3/connectionpool.py:1042\u001b[0m, in \u001b[0;36mHTTPSConnectionPool._validate_conn\u001b[0;34m(self, conn)\u001b[0m\n\u001b[1;32m   1040\u001b[0m \u001b[38;5;66;03m# Force connect early to allow us to validate the connection.\u001b[39;00m\n\u001b[1;32m   1041\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28mgetattr\u001b[39m(conn, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124msock\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;28;01mNone\u001b[39;00m):  \u001b[38;5;66;03m# AppEngine might not have  `.sock`\u001b[39;00m\n\u001b[0;32m-> 1042\u001b[0m     \u001b[43mconn\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mconnect\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m   1044\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m conn\u001b[38;5;241m.\u001b[39mis_verified:\n\u001b[1;32m   1045\u001b[0m     warnings\u001b[38;5;241m.\u001b[39mwarn(\n\u001b[1;32m   1046\u001b[0m         (\n\u001b[1;32m   1047\u001b[0m             \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mUnverified HTTPS request is being made to host \u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;132;01m%s\u001b[39;00m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m. \u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m   (...)\u001b[0m\n\u001b[1;32m   1052\u001b[0m         InsecureRequestWarning,\n\u001b[1;32m   1053\u001b[0m     )\n","File \u001b[0;32m/opt/conda/lib/python3.10/site-packages/urllib3/connection.py:363\u001b[0m, in \u001b[0;36mHTTPSConnection.connect\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m    361\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mconnect\u001b[39m(\u001b[38;5;28mself\u001b[39m):\n\u001b[1;32m    362\u001b[0m     \u001b[38;5;66;03m# Add certificate verification\u001b[39;00m\n\u001b[0;32m--> 363\u001b[0m     \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msock \u001b[38;5;241m=\u001b[39m conn \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_new_conn\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m    364\u001b[0m     hostname \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mhost\n\u001b[1;32m    365\u001b[0m     tls_in_tls \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mFalse\u001b[39;00m\n","File \u001b[0;32m/opt/conda/lib/python3.10/site-packages/urllib3/connection.py:174\u001b[0m, in \u001b[0;36mHTTPConnection._new_conn\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m    171\u001b[0m     extra_kw[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124msocket_options\u001b[39m\u001b[38;5;124m\"\u001b[39m] \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msocket_options\n\u001b[1;32m    173\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 174\u001b[0m     conn \u001b[38;5;241m=\u001b[39m \u001b[43mconnection\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcreate_connection\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m    175\u001b[0m \u001b[43m        \u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_dns_host\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mport\u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mtimeout\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mextra_kw\u001b[49m\n\u001b[1;32m    176\u001b[0m \u001b[43m    \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m    178\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m SocketTimeout:\n\u001b[1;32m    179\u001b[0m     \u001b[38;5;28;01mraise\u001b[39;00m ConnectTimeoutError(\n\u001b[1;32m    180\u001b[0m         \u001b[38;5;28mself\u001b[39m,\n\u001b[1;32m    181\u001b[0m         \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mConnection to \u001b[39m\u001b[38;5;132;01m%s\u001b[39;00m\u001b[38;5;124m timed out. (connect timeout=\u001b[39m\u001b[38;5;132;01m%s\u001b[39;00m\u001b[38;5;124m)\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m    182\u001b[0m         \u001b[38;5;241m%\u001b[39m (\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mhost, \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mtimeout),\n\u001b[1;32m    183\u001b[0m     )\n","\u001b[0;31mKeyboardInterrupt\u001b[0m: "],"ename":"KeyboardInterrupt","evalue":"","output_type":"error"}],"execution_count":309},{"cell_type":"code","source":"train_df, target_columns = make_train_dataset(train_seq_df, train_label_df, max_label=Config.max_label)\ntrain_df = add_fold_idx(config=config, train_df=train_df, target_columns=target_columns)\n\nif config.train:\n    for i_fold in range(config.n_fold):\n        if i_fold not in config.trn_fold:\n            continue\n\n        train_df_fold = train_df[train_df[\"fold\"] != i_fold]\n        valid_df_fold = train_df[train_df[\"fold\"] == i_fold]\n\n        train_loop(\n            config=config,\n            name=f\"fold_{i_fold}\",\n            train_df=train_df_fold,\n            valid_df=valid_df_fold,\n            target_columns=target_columns,\n            device=DEVICE,\n        )\n        ","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-14T13:27:31.760536Z","iopub.execute_input":"2026-08-14T13:27:31.760962Z","iopub.status.idle":"2026-08-14T13:27:31.890003Z","shell.execute_reply.started":"2026-08-14T13:27:31.760937Z","shell.execute_reply":"2026-08-14T13:27:31.888584Z"}},"outputs":[{"traceback":["\u001b[0;31m---------------------------------------------------------------------------\u001b[0m","\u001b[0;31mTypeError\u001b[0m                                 Traceback (most recent call last)","Cell \u001b[0;32mIn[308], line 12\u001b[0m\n\u001b[1;32m      9\u001b[0m train_df_fold \u001b[38;5;241m=\u001b[39m train_df[train_df[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mfold\u001b[39m\u001b[38;5;124m\"\u001b[39m] \u001b[38;5;241m!=\u001b[39m i_fold]\n\u001b[1;32m     10\u001b[0m valid_df_fold \u001b[38;5;241m=\u001b[39m train_df[train_df[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mfold\u001b[39m\u001b[38;5;124m\"\u001b[39m] \u001b[38;5;241m==\u001b[39m i_fold]\n\u001b[0;32m---> 12\u001b[0m \u001b[43mtrain_loop\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m     13\u001b[0m \u001b[43m    \u001b[49m\u001b[43mconfig\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mconfig\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m     14\u001b[0m \u001b[43m    \u001b[49m\u001b[43mname\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43mf\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mfold_\u001b[39;49m\u001b[38;5;132;43;01m{\u001b[39;49;00m\u001b[43mi_fold\u001b[49m\u001b[38;5;132;43;01m}\u001b[39;49;00m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\n\u001b[1;32m     15\u001b[0m \u001b[43m    \u001b[49m\u001b[43mtrain_df\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtrain_df_fold\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m     16\u001b[0m \u001b[43m    \u001b[49m\u001b[43mvalid_df\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mvalid_df_fold\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m     17\u001b[0m \u001b[43m    \u001b[49m\u001b[43mtarget_columns\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtarget_columns\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m     18\u001b[0m \u001b[43m    \u001b[49m\u001b[43mdevice\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mDEVICE\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m     19\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n","\u001b[0;31mTypeError\u001b[0m: train_loop() missing 1 required positional argument: 'tokenizer'"],"ename":"TypeError","evalue":"train_loop() missing 1 required positional argument: 'tokenizer'","output_type":"error"}],"execution_count":308},{"cell_type":"markdown","source":"## Evaluation","metadata":{}},{"cell_type":"code","source":"def make_submission_formatted_outputs_df(outputs: dict) -> pd.DataFrame:\n    data = {\n        \"id\": np.repeat(outputs[\"id\"], len(outputs[\"target_names\"])),\n        \"terms\": np.tile(outputs[\"target_names\"], len(outputs[\"id\"])),\n        \"preds\": outputs[\"predictions\"].ravel(),\n    }\n    submission_df = pd.DataFrame(data)\n    return submission_df\n\n\ndef make_crosstab_formatted_outputs_df(outputs: dict) -> pd.DataFrame:\n    output_df = pd.DataFrame(\n        outputs[\"predictions\"],\n        columns=outputs[\"target_names\"],\n        index=pd.Index(outputs[\"id\"], name=\"id\"),\n    )\n    return output_df\n\nif config.evaluation:\n    pred_dfs, gt_dfs = [], []\n    for i_fold in range(config.n_fold):\n        if i_fold not in Config.trn_fold:\n            continue\n\n        # get data\n        outputs = joblib.load(EXP_PREDS / f\"fold_{i_fold}_best.pkl\")\n        pred_df = make_submission_formatted_outputs_df(outputs)\n        gt_df = train_terms_df[train_terms_df[\"EntryID\"].isin(pred_df[\"id\"])].reset_index(drop=True)\n\n        # calc score\n        score, score_df = get_score(gt_df=gt_df, pred_df=pred_df, th_step=0.1)\n\n        # save result\n        LOGGER.info(f\"fold {i_fold} : score = {score:.4f}\")\n        score_df.to_csv(EXP_REPORTS / f\"score_df_fold_{i_fold}.csv\", index=False)\n\n        # stack\n        pred_dfs.append(pred_df)\n        gt_dfs.append(gt_df)\n\n    all_pred_df = pd.concat(pred_dfs, axis=0).reset_index(drop=True)\n    all_gt_df = pd.concat(gt_dfs, axis=0).reset_index(drop=True)\n    all_score, all_score_df = get_score(gt_df=all_gt_df, pred_df=all_pred_df, th_step=0.1)\n    LOGGER.info(f\"all : score = {all_score:.4f}\")\n\n    joblib.dump(all_pred_df, EXP_PREDS / \"all_pred_df.pkl\")\n    joblib.dump(all_gt_df, EXP_PREDS / \"all_gt_df.pkl\")\n    joblib.dump(all_score_df, EXP_PREDS / \"all_score_df.pkl\")","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-14T13:13:28.087971Z","iopub.execute_input":"2026-08-14T13:13:28.088342Z","iopub.status.idle":"2026-08-14T13:13:28.14886Z","shell.execute_reply.started":"2026-08-14T13:13:28.088317Z","shell.execute_reply":"2026-08-14T13:13:28.147415Z"}},"outputs":[{"traceback":["\u001b[0;31m---------------------------------------------------------------------------\u001b[0m","\u001b[0;31mFileNotFoundError\u001b[0m                         Traceback (most recent call last)","Cell \u001b[0;32mIn[299], line 26\u001b[0m\n\u001b[1;32m     23\u001b[0m     \u001b[38;5;28;01mcontinue\u001b[39;00m\n\u001b[1;32m     25\u001b[0m \u001b[38;5;66;03m# get data\u001b[39;00m\n\u001b[0;32m---> 26\u001b[0m outputs \u001b[38;5;241m=\u001b[39m \u001b[43mjoblib\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mload\u001b[49m\u001b[43m(\u001b[49m\u001b[43mEXP_PREDS\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m/\u001b[39;49m\u001b[43m \u001b[49m\u001b[38;5;124;43mf\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mfold_\u001b[39;49m\u001b[38;5;132;43;01m{\u001b[39;49;00m\u001b[43mi_fold\u001b[49m\u001b[38;5;132;43;01m}\u001b[39;49;00m\u001b[38;5;124;43m_best.pkl\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m\n\u001b[1;32m     27\u001b[0m pred_df \u001b[38;5;241m=\u001b[39m make_submission_formatted_outputs_df(outputs)\n\u001b[1;32m     28\u001b[0m gt_df \u001b[38;5;241m=\u001b[39m train_terms_df[train_terms_df[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mEntryID\u001b[39m\u001b[38;5;124m\"\u001b[39m]\u001b[38;5;241m.\u001b[39misin(pred_df[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mid\u001b[39m\u001b[38;5;124m\"\u001b[39m])]\u001b[38;5;241m.\u001b[39mreset_index(drop\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mTrue\u001b[39;00m)\n","File \u001b[0;32m/opt/conda/lib/python3.10/site-packages/joblib/numpy_pickle.py:650\u001b[0m, in \u001b[0;36mload\u001b[0;34m(filename, mmap_mode)\u001b[0m\n\u001b[1;32m    648\u001b[0m         obj \u001b[38;5;241m=\u001b[39m _unpickle(fobj)\n\u001b[1;32m    649\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m--> 650\u001b[0m     \u001b[38;5;28;01mwith\u001b[39;00m \u001b[38;5;28;43mopen\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mfilename\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mrb\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m)\u001b[49m \u001b[38;5;28;01mas\u001b[39;00m f:\n\u001b[1;32m    651\u001b[0m         \u001b[38;5;28;01mwith\u001b[39;00m _read_fileobject(f, filename, mmap_mode) \u001b[38;5;28;01mas\u001b[39;00m fobj:\n\u001b[1;32m    652\u001b[0m             \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(fobj, \u001b[38;5;28mstr\u001b[39m):\n\u001b[1;32m    653\u001b[0m                 \u001b[38;5;66;03m# if the returned file object is a string, this means we\u001b[39;00m\n\u001b[1;32m    654\u001b[0m                 \u001b[38;5;66;03m# try to load a pickle file generated with an version of\u001b[39;00m\n\u001b[1;32m    655\u001b[0m                 \u001b[38;5;66;03m# Joblib so we load it with joblib compatibility function.\u001b[39;00m\n","\u001b[0;31mFileNotFoundError\u001b[0m: [Errno 2] No such file or directory: '/kaggle/working/exp_preds/fold_0_best.pkl'"],"ename":"FileNotFoundError","evalue":"[Errno 2] No such file or directory: '/kaggle/working/exp_preds/fold_0_best.pkl'","output_type":"error"}],"execution_count":299},{"cell_type":"markdown","source":"## Inference","metadata":{}},{"cell_type":"code","source":"if Config.inference:\n    test_pred_df = pd.DataFrame()\n    predictions = 0\n    n_model = 0\n    for i_fold in range(Config.n_fold):\n        if i_fold not in Config.trn_fold:\n            continue\n\n        outputs = get_predictions(\n            config=Config, \n            test_df=test_df, \n            tokenizer=tokenizer, \n            model_path=EXP_MODELS / f\"fold_{i_fold}.pth\", \n            target_columns=target_columns, \n            device=DEVICE)\n        predictions += outputs[\"predictions\"]\n        n_model += 1\n\n    outputs[\"predictions\"] = predictions / n_model  # fold ave, same id & targets\n    test_pred_df = make_submission_formatted_outputs_df(outputs)\n    test_pred_df.reset_index(drop=True, inplace=True)\n    joblib.dump(test_pred_df, EXP_PREDS / \"test_pred_df.pkl\")\n    test_pred_df.to_csv(SUBMISSIONS / f\"{Config.name}.tsv\", header=False, index=False, sep=\"\\t\")\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-14T13:06:38.820525Z","iopub.execute_input":"2026-08-14T13:06:38.821289Z","iopub.status.idle":"2026-08-14T13:06:38.858672Z","shell.execute_reply.started":"2026-08-14T13:06:38.82126Z","shell.execute_reply":"2026-08-14T13:06:38.856921Z"}},"outputs":[{"traceback":["\u001b[0;31m---------------------------------------------------------------------------\u001b[0m","\u001b[0;31mAttributeError\u001b[0m                            Traceback (most recent call last)","Cell \u001b[0;32mIn[294], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[43mConfig\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43minference\u001b[49m:\n\u001b[1;32m      2\u001b[0m     test_pred_df \u001b[38;5;241m=\u001b[39m pd\u001b[38;5;241m.\u001b[39mDataFrame()\n\u001b[1;32m      3\u001b[0m     predictions \u001b[38;5;241m=\u001b[39m \u001b[38;5;241m0\u001b[39m\n","\u001b[0;31mAttributeError\u001b[0m: type object 'Config' has no attribute 'inference'"],"ename":"AttributeError","evalue":"type object 'Config' has no attribute 'inference'","output_type":"error"}],"execution_count":294},{"cell_type":"markdown","source":"## Submission","metadata":{}},{"cell_type":"code","source":"if Config.submission:\n    submission_df = joblib.load(EXP_PREDS / \"test_pred_df.pkl\")\n    upload_submission_file_to_kaggle(dataset_name=f\"CAFA5-{Config.name}\", submission_df=submission_df)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-08-14T13:06:43.479651Z","iopub.execute_input":"2026-08-14T13:06:43.479996Z","iopub.status.idle":"2026-08-14T13:06:43.51961Z","shell.execute_reply.started":"2026-08-14T13:06:43.479975Z","shell.execute_reply":"2026-08-14T13:06:43.518642Z"}},"outputs":[{"traceback":["\u001b[0;31m---------------------------------------------------------------------------\u001b[0m","\u001b[0;31mAttributeError\u001b[0m                            Traceback (most recent call last)","Cell \u001b[0;32mIn[295], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[43mConfig\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msubmission\u001b[49m:\n\u001b[1;32m      2\u001b[0m     submission_df \u001b[38;5;241m=\u001b[39m joblib\u001b[38;5;241m.\u001b[39mload(EXP_PREDS \u001b[38;5;241m/\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtest_pred_df.pkl\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m      3\u001b[0m     upload_submission_file_to_kaggle(dataset_name\u001b[38;5;241m=\u001b[39m\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mCAFA5-\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mConfig\u001b[38;5;241m.\u001b[39mname\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m, submission_df\u001b[38;5;241m=\u001b[39msubmission_df)\n","\u001b[0;31mAttributeError\u001b[0m: type object 'Config' has no attribute 'submission'"],"ename":"AttributeError","evalue":"type object 'Config' has no attribute 'submission'","output_type":"error"}],"execution_count":295}]}