Upload inference_script.ipynb
Browse files1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 220, "referenced_widgets": [ "d6d7368c1c7b4a549d9a706ee1a62785", "0e22f97db509402a9b4d4a2fa8c80fe0", "475728820f8e4b6fa0c33a1e9989179a", "cf5e926c8c004525b5aad36d821ef928", "9275c5cf7b314dc69419611128cb0c09", "926c9a0562f3455b958c71bd0a138558", "ef276c365d604dcc83b4a0133c6b7652", "3dc315e087f44330badbb6749b0611a9", "bc6c346b95424eb881b793bf6fd2f53e", "c26db3dd5a86405b81f510fd759c3af7", "dae2b5afeee243e682322c1ecb8238e6", "f66e121a24e441c2a4cb32fb87d22632", "1776c0895e7f400f85d3a2123cb573f1", "e7fd82b589eb49aaba73aeafcc340421", "210ec65a874a4f51ab9f059d3de804a9", "c91d89b903ce4f02b635454d3bd87877", "9cba2384346645499516a7923ad6fcef", "491f71a8889c4c7aa0042e99f374be79", "9f60072613d84754a0efe7813d853565", "bf48a3e692ae4e6da5379152f51baa09", "25529d785e9047e1b9bd197a7ec56773", "9dda1a77133c4247bac106a9c4699153" ] }, "id": "Sm-TvQo5chAc", "outputId": "031ba45c-fc02-4ee6-ddd4-eeca67c6f92e" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Initialising HRCS Classifier Pipeline...\n", "Loading model and tokenizer from: NIHRDataInsights/HRCSHealthCategories...\n" ] }, { "ename": "SSLError", "evalue": "(MaxRetryError(\"HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /NIHRDataInsights/HRCSHealthCategories/resolve/main/tokenizer_config.json (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)')))\"), '(Request ID: c39f4927-7e74-4ee1-b0ff-59c87354a7cb)')", "output_type": "error", "traceback": [ "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[1;31mSSLCertVerificationError\u001b[0m Traceback (most recent call last)", "File \u001b[1;32mc:\\Users\\Ashley.Banks\\AppData\\Local\\anaconda3\\Lib\\site-packages\\urllib3\\connectionpool.py:466\u001b[0m, in \u001b[0;36mHTTPConnectionPool._make_request\u001b[1;34m(self, conn, method, url, body, headers, retries, timeout, chunked, response_conn, preload_content, decode_content, enforce_content_length)\u001b[0m\n\u001b[0;32m 465\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m--> 466\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_validate_conn(conn)\n\u001b[0;32m 467\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m (SocketTimeout, BaseSSLError) \u001b[38;5;28;01mas\u001b[39;00m e:\n", "File \u001b[1;32mc:\\Users\\Ashley.Banks\\AppData\\Local\\anaconda3\\Lib\\site-packages\\urllib3\\connectionpool.py:1095\u001b[0m, in \u001b[0;36mHTTPSConnectionPool._validate_conn\u001b[1;34m(self, conn)\u001b[0m\n\u001b[0;32m 1094\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m conn\u001b[38;5;241m.\u001b[39mis_closed:\n\u001b[1;32m-> 1095\u001b[0m conn\u001b[38;5;241m.\u001b[39mconnect()\n\u001b[0;32m 1097\u001b[0m \u001b[38;5;66;03m# TODO revise this, see https://github.com/urllib3/urllib3/issues/2791\u001b[39;00m\n", "File \u001b[1;32mc:\\Users\\Ashley.Banks\\AppData\\Local\\anaconda3\\Lib\\site-packages\\urllib3\\connection.py:730\u001b[0m, in \u001b[0;36mHTTPSConnection.connect\u001b[1;34m(self)\u001b[0m\n\u001b[0;32m 728\u001b[0m server_hostname_rm_dot \u001b[38;5;241m=\u001b[39m server_hostname\u001b[38;5;241m.\u001b[39mrstrip(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m.\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m--> 730\u001b[0m sock_and_verified \u001b[38;5;241m=\u001b[39m _ssl_wrap_socket_and_match_hostname(\n\u001b[0;32m 731\u001b[0m sock\u001b[38;5;241m=\u001b[39msock,\n\u001b[0;32m 732\u001b[0m cert_reqs\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mcert_reqs,\n\u001b[0;32m 733\u001b[0m ssl_version\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mssl_version,\n\u001b[0;32m 734\u001b[0m ssl_minimum_version\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mssl_minimum_version,\n\u001b[0;32m 735\u001b[0m ssl_maximum_version\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mssl_maximum_version,\n\u001b[0;32m 736\u001b[0m ca_certs\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mca_certs,\n\u001b[0;32m 737\u001b[0m ca_cert_dir\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mca_cert_dir,\n\u001b[0;32m 738\u001b[0m ca_cert_data\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mca_cert_data,\n\u001b[0;32m 739\u001b[0m cert_file\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mcert_file,\n\u001b[0;32m 740\u001b[0m key_file\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mkey_file,\n\u001b[0;32m 741\u001b[0m key_password\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mkey_password,\n\u001b[0;32m 742\u001b[0m server_hostname\u001b[38;5;241m=\u001b[39mserver_hostname_rm_dot,\n\u001b[0;32m 743\u001b[0m ssl_context\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mssl_context,\n\u001b[0;32m 744\u001b[0m tls_in_tls\u001b[38;5;241m=\u001b[39mtls_in_tls,\n\u001b[0;32m 745\u001b[0m assert_hostname\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39massert_hostname,\n\u001b[0;32m 746\u001b[0m assert_fingerprint\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39massert_fingerprint,\n\u001b[0;32m 747\u001b[0m )\n\u001b[0;32m 748\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msock \u001b[38;5;241m=\u001b[39m sock_and_verified\u001b[38;5;241m.\u001b[39msocket\n", "File \u001b[1;32mc:\\Users\\Ashley.Banks\\AppData\\Local\\anaconda3\\Lib\\site-packages\\urllib3\\connection.py:909\u001b[0m, in \u001b[0;36m_ssl_wrap_socket_and_match_hostname\u001b[1;34m(sock, cert_reqs, ssl_version, ssl_minimum_version, ssl_maximum_version, cert_file, key_file, key_password, ca_certs, ca_cert_dir, ca_cert_data, assert_hostname, assert_fingerprint, server_hostname, ssl_context, tls_in_tls)\u001b[0m\n\u001b[0;32m 907\u001b[0m server_hostname \u001b[38;5;241m=\u001b[39m normalized\n\u001b[1;32m--> 909\u001b[0m ssl_sock \u001b[38;5;241m=\u001b[39m ssl_wrap_socket(\n\u001b[0;32m 910\u001b[0m sock\u001b[38;5;241m=\u001b[39msock,\n\u001b[0;32m 911\u001b[0m keyfile\u001b[38;5;241m=\u001b[39mkey_file,\n\u001b[0;32m 912\u001b[0m certfile\u001b[38;5;241m=\u001b[39mcert_file,\n\u001b[0;32m 913\u001b[0m key_password\u001b[38;5;241m=\u001b[39mkey_password,\n\u001b[0;32m 914\u001b[0m ca_certs\u001b[38;5;241m=\u001b[39mca_certs,\n\u001b[0;32m 915\u001b[0m ca_cert_dir\u001b[38;5;241m=\u001b[39mca_cert_dir,\n\u001b[0;32m 916\u001b[0m ca_cert_data\u001b[38;5;241m=\u001b[39mca_cert_data,\n\u001b[0;32m 917\u001b[0m server_hostname\u001b[38;5;241m=\u001b[39mserver_hostname,\n\u001b[0;32m 918\u001b[0m ssl_context\u001b[38;5;241m=\u001b[39mcontext,\n\u001b[0;32m 919\u001b[0m tls_in_tls\u001b[38;5;241m=\u001b[39mtls_in_tls,\n\u001b[0;32m 920\u001b[0m )\n\u001b[0;32m 922\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n", "File \u001b[1;32mc:\\Users\\Ashley.Banks\\AppData\\Local\\anaconda3\\Lib\\site-packages\\urllib3\\util\\ssl_.py:469\u001b[0m, in \u001b[0;36mssl_wrap_socket\u001b[1;34m(sock, keyfile, certfile, cert_reqs, ca_certs, server_hostname, ssl_version, ciphers, ssl_context, ca_cert_dir, key_password, ca_cert_data, tls_in_tls)\u001b[0m\n\u001b[0;32m 467\u001b[0m context\u001b[38;5;241m.\u001b[39mset_alpn_protocols(ALPN_PROTOCOLS)\n\u001b[1;32m--> 469\u001b[0m ssl_sock \u001b[38;5;241m=\u001b[39m _ssl_wrap_socket_impl(sock, context, tls_in_tls, server_hostname)\n\u001b[0;32m 470\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m ssl_sock\n", "File \u001b[1;32mc:\\Users\\Ashley.Banks\\AppData\\Local\\anaconda3\\Lib\\site-packages\\urllib3\\util\\ssl_.py:513\u001b[0m, in \u001b[0;36m_ssl_wrap_socket_impl\u001b[1;34m(sock, ssl_context, tls_in_tls, server_hostname)\u001b[0m\n\u001b[0;32m 511\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m SSLTransport(sock, ssl_context, server_hostname)\n\u001b[1;32m--> 513\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m ssl_context\u001b[38;5;241m.\u001b[39mwrap_socket(sock, server_hostname\u001b[38;5;241m=\u001b[39mserver_hostname)\n", "File \u001b[1;32mc:\\Users\\Ashley.Banks\\AppData\\Local\\anaconda3\\Lib\\ssl.py:455\u001b[0m, in \u001b[0;36mSSLContext.wrap_socket\u001b[1;34m(self, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname, session)\u001b[0m\n\u001b[0;32m 449\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mwrap_socket\u001b[39m(\u001b[38;5;28mself\u001b[39m, sock, server_side\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mFalse\u001b[39;00m,\n\u001b[0;32m 450\u001b[0m do_handshake_on_connect\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mTrue\u001b[39;00m,\n\u001b[0;32m 451\u001b[0m suppress_ragged_eofs\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mTrue\u001b[39;00m,\n\u001b[0;32m 452\u001b[0m server_hostname\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mNone\u001b[39;00m, session\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mNone\u001b[39;00m):\n\u001b[0;32m 453\u001b[0m \u001b[38;5;66;03m# SSLSocket class handles server_hostname encoding before it calls\u001b[39;00m\n\u001b[0;32m 454\u001b[0m \u001b[38;5;66;03m# ctx._wrap_socket()\u001b[39;00m\n\u001b[1;32m--> 455\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msslsocket_class\u001b[38;5;241m.\u001b[39m_create(\n\u001b[0;32m 456\u001b[0m sock\u001b[38;5;241m=\u001b[39msock,\n\u001b[0;32m 457\u001b[0m server_side\u001b[38;5;241m=\u001b[39mserver_side,\n\u001b[0;32m 458\u001b[0m do_handshake_on_connect\u001b[38;5;241m=\u001b[39mdo_handshake_on_connect,\n\u001b[0;32m 459\u001b[0m suppress_ragged_eofs\u001b[38;5;241m=\u001b[39msuppress_ragged_eofs,\n\u001b[0;32m 460\u001b[0m server_hostname\u001b[38;5;241m=\u001b[39mserver_hostname,\n\u001b[0;32m 461\u001b[0m context\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m,\n\u001b[0;32m 462\u001b[0m session\u001b[38;5;241m=\u001b[39msession\n\u001b[0;32m 463\u001b[0m )\n", "File \u001b[1;32mc:\\Users\\Ashley.Banks\\AppData\\Local\\anaconda3\\Lib\\ssl.py:1041\u001b[0m, in \u001b[0;36mSSLSocket._create\u001b[1;34m(cls, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname, context, session)\u001b[0m\n\u001b[0;32m 1040\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mValueError\u001b[39;00m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mdo_handshake_on_connect should not be specified for non-blocking sockets\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m-> 1041\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdo_handshake()\n\u001b[0;32m 1042\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m:\n", "File \u001b[1;32mc:\\Users\\Ashley.Banks\\AppData\\Local\\anaconda3\\Lib\\ssl.py:1319\u001b[0m, in \u001b[0;36mSSLSocket.do_handshake\u001b[1;34m(self, block)\u001b[0m\n\u001b[0;32m 1318\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msettimeout(\u001b[38;5;28;01mNone\u001b[39;00m)\n\u001b[1;32m-> 1319\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_sslobj\u001b[38;5;241m.\u001b[39mdo_handshake()\n\u001b[0;32m 1320\u001b[0m \u001b[38;5;28;01mfinally\u001b[39;00m:\n", "\u001b[1;31mSSLCertVerificationError\u001b[0m: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)", "\nDuring handling of the above exception, another exception occurred:\n", "\u001b[1;31mSSLError\u001b[0m Traceback (most recent call last)", "File \u001b[1;32mc:\\Users\\Ashley.Banks\\AppData\\Local\\anaconda3\\Lib\\site-packages\\urllib3\\connectionpool.py:789\u001b[0m, in \u001b[0;36mHTTPConnectionPool.urlopen\u001b[1;34m(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, preload_content, decode_content, **response_kw)\u001b[0m\n\u001b[0;32m 788\u001b[0m \u001b[38;5;66;03m# Make the request on the HTTPConnection object\u001b[39;00m\n\u001b[1;32m--> 789\u001b[0m response \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_make_request(\n\u001b[0;32m 790\u001b[0m conn,\n\u001b[0;32m 791\u001b[0m method,\n\u001b[0;32m 792\u001b[0m url,\n\u001b[0;32m 793\u001b[0m timeout\u001b[38;5;241m=\u001b[39mtimeout_obj,\n\u001b[0;32m 794\u001b[0m body\u001b[38;5;241m=\u001b[39mbody,\n\u001b[0;32m 795\u001b[0m headers\u001b[38;5;241m=\u001b[39mheaders,\n\u001b[0;32m 796\u001b[0m chunked\u001b[38;5;241m=\u001b[39mchunked,\n\u001b[0;32m 797\u001b[0m retries\u001b[38;5;241m=\u001b[39mretries,\n\u001b[0;32m 798\u001b[0m response_conn\u001b[38;5;241m=\u001b[39mresponse_conn,\n\u001b[0;32m 799\u001b[0m preload_content\u001b[38;5;241m=\u001b[39mpreload_content,\n\u001b[0;32m 800\u001b[0m decode_content\u001b[38;5;241m=\u001b[39mdecode_content,\n\u001b[0;32m 801\u001b[0m \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mresponse_kw,\n\u001b[0;32m 802\u001b[0m )\n\u001b[0;32m 804\u001b[0m \u001b[38;5;66;03m# Everything went great!\u001b[39;00m\n", "File \u001b[1;32mc:\\Users\\Ashley.Banks\\AppData\\Local\\anaconda3\\Lib\\site-packages\\urllib3\\connectionpool.py:490\u001b[0m, in \u001b[0;36mHTTPConnectionPool._make_request\u001b[1;34m(self, conn, method, url, body, headers, retries, timeout, chunked, response_conn, preload_content, decode_content, enforce_content_length)\u001b[0m\n\u001b[0;32m 489\u001b[0m new_e \u001b[38;5;241m=\u001b[39m _wrap_proxy_error(new_e, conn\u001b[38;5;241m.\u001b[39mproxy\u001b[38;5;241m.\u001b[39mscheme)\n\u001b[1;32m--> 490\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m new_e\n\u001b[0;32m 492\u001b[0m \u001b[38;5;66;03m# conn.request() calls http.client.*.request, not the method in\u001b[39;00m\n\u001b[0;32m 493\u001b[0m \u001b[38;5;66;03m# urllib3.request. It also calls makefile (recv) on the socket.\u001b[39;00m\n", "\u001b[1;31mSSLError\u001b[0m: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)", "\nThe above exception was the direct cause of the following exception:\n", "\u001b[1;31mMaxRetryError\u001b[0m Traceback (most recent call last)", "File \u001b[1;32mc:\\Users\\Ashley.Banks\\AppData\\Local\\anaconda3\\Lib\\site-packages\\requests\\adapters.py:667\u001b[0m, in \u001b[0;36mHTTPAdapter.send\u001b[1;34m(self, request, stream, timeout, verify, cert, proxies)\u001b[0m\n\u001b[0;32m 666\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m--> 667\u001b[0m resp \u001b[38;5;241m=\u001b[39m conn\u001b[38;5;241m.\u001b[39murlopen(\n\u001b[0;32m 668\u001b[0m method\u001b[38;5;241m=\u001b[39mrequest\u001b[38;5;241m.\u001b[39mmethod,\n\u001b[0;32m 669\u001b[0m url\u001b[38;5;241m=\u001b[39murl,\n\u001b[0;32m 670\u001b[0m body\u001b[38;5;241m=\u001b[39mrequest\u001b[38;5;241m.\u001b[39mbody,\n\u001b[0;32m 671\u001b[0m headers\u001b[38;5;241m=\u001b[39mrequest\u001b[38;5;241m.\u001b[39mheaders,\n\u001b[0;32m 672\u001b[0m redirect\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mFalse\u001b[39;00m,\n\u001b[0;32m 673\u001b[0m assert_same_host\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mFalse\u001b[39;00m,\n\u001b[0;32m 674\u001b[0m preload_content\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mFalse\u001b[39;00m,\n\u001b[0;32m 675\u001b[0m decode_content\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mFalse\u001b[39;00m,\n\u001b[0;32m 676\u001b[0m retries\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmax_retries,\n\u001b[0;32m 677\u001b[0m timeout\u001b[38;5;241m=\u001b[39mtimeout,\n\u001b[0;32m 678\u001b[0m chunked\u001b[38;5;241m=\u001b[39mchunked,\n\u001b[0;32m 679\u001b[0m )\n\u001b[0;32m 681\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", "File \u001b[1;32mc:\\Users\\Ashley.Banks\\AppData\\Local\\anaconda3\\Lib\\site-packages\\urllib3\\connectionpool.py:843\u001b[0m, in \u001b[0;36mHTTPConnectionPool.urlopen\u001b[1;34m(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, preload_content, decode_content, **response_kw)\u001b[0m\n\u001b[0;32m 841\u001b[0m new_e \u001b[38;5;241m=\u001b[39m ProtocolError(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mConnection aborted.\u001b[39m\u001b[38;5;124m\"\u001b[39m, new_e)\n\u001b[1;32m--> 843\u001b[0m retries \u001b[38;5;241m=\u001b[39m retries\u001b[38;5;241m.\u001b[39mincrement(\n\u001b[0;32m 844\u001b[0m method, url, error\u001b[38;5;241m=\u001b[39mnew_e, _pool\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m, _stacktrace\u001b[38;5;241m=\u001b[39msys\u001b[38;5;241m.\u001b[39mexc_info()[\u001b[38;5;241m2\u001b[39m]\n\u001b[0;32m 845\u001b[0m )\n\u001b[0;32m 846\u001b[0m retries\u001b[38;5;241m.\u001b[39msleep()\n", "File \u001b[1;32mc:\\Users\\Ashley.Banks\\AppData\\Local\\anaconda3\\Lib\\site-packages\\urllib3\\util\\retry.py:519\u001b[0m, in \u001b[0;36mRetry.increment\u001b[1;34m(self, method, url, response, error, _pool, _stacktrace)\u001b[0m\n\u001b[0;32m 518\u001b[0m reason \u001b[38;5;241m=\u001b[39m error \u001b[38;5;129;01mor\u001b[39;00m ResponseError(cause)\n\u001b[1;32m--> 519\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m MaxRetryError(_pool, url, reason) \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mreason\u001b[39;00m \u001b[38;5;66;03m# type: ignore[arg-type]\u001b[39;00m\n\u001b[0;32m 521\u001b[0m log\u001b[38;5;241m.\u001b[39mdebug(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mIncremented Retry for (url=\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;132;01m%r\u001b[39;00m\u001b[38;5;124m\"\u001b[39m, url, new_retry)\n", "\u001b[1;31mMaxRetryError\u001b[0m: HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /NIHRDataInsights/HRCSHealthCategories/resolve/main/tokenizer_config.json (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)')))", "\nDuring handling of the above exception, another exception occurred:\n", "\u001b[1;31mSSLError\u001b[0m Traceback (most recent call last)", "Cell \u001b[1;32mIn[1], line 200\u001b[0m\n\u001b[0;32m 197\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mInitialising HRCS Classifier Pipeline...\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m 199\u001b[0m \u001b[38;5;66;03m# Load models once outside the loop to save memory/time\u001b[39;00m\n\u001b[1;32m--> 200\u001b[0m hc_assets \u001b[38;5;241m=\u001b[39m load_hf_model(HC_REPO_ID)\n\u001b[0;32m 201\u001b[0m rac_assets \u001b[38;5;241m=\u001b[39m load_hf_model(RAC_REPO_ID)\n\u001b[0;32m 203\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m folder \u001b[38;5;129;01min\u001b[39;00m DATA_FOLDERS:\n", "Cell \u001b[1;32mIn[1], line 75\u001b[0m, in \u001b[0;36mload_hf_model\u001b[1;34m(repo_id)\u001b[0m\n\u001b[0;32m 70\u001b[0m \u001b[38;5;250m\u001b[39m\u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[0;32m 71\u001b[0m \u001b[38;5;124;03mThis section downloads the models from hugging face and the optimal thresholds.\u001b[39;00m\n\u001b[0;32m 72\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[0;32m 73\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mLoading model and tokenizer from: \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mrepo_id\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m...\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m---> 75\u001b[0m tok \u001b[38;5;241m=\u001b[39m AutoTokenizer\u001b[38;5;241m.\u001b[39mfrom_pretrained(repo_id, use_fast\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mTrue\u001b[39;00m)\n\u001b[0;32m 76\u001b[0m model \u001b[38;5;241m=\u001b[39m AutoModelForSequenceClassification\u001b[38;5;241m.\u001b[39mfrom_pretrained(repo_id)\n\u001b[0;32m 78\u001b[0m model\u001b[38;5;241m.\u001b[39meval()\n", "File \u001b[1;32mc:\\Users\\Ashley.Banks\\AppData\\Local\\anaconda3\\Lib\\site-packages\\transformers\\models\\auto\\tokenization_auto.py:983\u001b[0m, in \u001b[0;36mAutoTokenizer.from_pretrained\u001b[1;34m(cls, pretrained_model_name_or_path, *inputs, **kwargs)\u001b[0m\n\u001b[0;32m 980\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[0;32m 982\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[1;32m--> 983\u001b[0m tokenizer_config \u001b[38;5;241m=\u001b[39m get_tokenizer_config(pretrained_model_name_or_path, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs)\n\u001b[0;32m 984\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[0;32m 985\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[1;32mc:\\Users\\Ashley.Banks\\AppData\\Local\\anaconda3\\Lib\\site-packages\\transformers\\models\\auto\\tokenization_auto.py:815\u001b[0m, in \u001b[0;36mget_tokenizer_config\u001b[1;34m(pretrained_model_name_or_path, cache_dir, force_download, resume_download, proxies, token, revision, local_files_only, subfolder, **kwargs)\u001b[0m\n\u001b[0;32m 812\u001b[0m token \u001b[38;5;241m=\u001b[39m use_auth_token\n\u001b[0;32m 814\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[1;32m--> 815\u001b[0m resolved_config_file \u001b[38;5;241m=\u001b[39m cached_file(\n\u001b[0;32m 816\u001b[0m pretrained_model_name_or_path,\n\u001b[0;32m 817\u001b[0m TOKENIZER_CONFIG_FILE,\n\u001b[0;32m 818\u001b[0m cache_dir\u001b[38;5;241m=\u001b[39mcache_dir,\n\u001b[0;32m 819\u001b[0m force_download\u001b[38;5;241m=\u001b[39mforce_download,\n\u001b[0;32m 820\u001b[0m resume_download\u001b[38;5;241m=\u001b[39mresume_download,\n\u001b[0;32m 821\u001b[0m proxies\u001b[38;5;241m=\u001b[39mproxies,\n\u001b[0;32m 822\u001b[0m token\u001b[38;5;241m=\u001b[39mtoken,\n\u001b[0;32m 823\u001b[0m revision\u001b[38;5;241m=\u001b[39mrevision,\n\u001b[0;32m 824\u001b[0m local_files_only\u001b[38;5;241m=\u001b[39mlocal_files_only,\n\u001b[0;32m 825\u001b[0m subfolder\u001b[38;5;241m=\u001b[39msubfolder,\n\u001b[0;32m 826\u001b[0m _raise_exceptions_for_gated_repo\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mFalse\u001b[39;00m,\n\u001b[0;32m 827\u001b[0m _raise_exceptions_for_missing_entries\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mFalse\u001b[39;00m,\n\u001b[0;32m 828\u001b[0m _raise_exceptions_for_connection_errors\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mFalse\u001b[39;00m,\n\u001b[0;32m 829\u001b[0m _commit_hash\u001b[38;5;241m=\u001b[39mcommit_hash,\n\u001b[0;32m 830\u001b[0m )\n\u001b[0;32m 831\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[0;32m 832\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[1;32mc:\\Users\\Ashley.Banks\\AppData\\Local\\anaconda3\\Lib\\site-packages\\transformers\\utils\\hub.py:312\u001b[0m, in \u001b[0;36mcached_file\u001b[1;34m(path_or_repo_id, filename, **kwargs)\u001b[0m\n\u001b[0;32m 254\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mcached_file\u001b[39m(\n\u001b[0;32m 255\u001b[0m path_or_repo_id: Union[\u001b[38;5;28mstr\u001b[39m, os\u001b[38;5;241m.\u001b[39mPathLike],\n\u001b[0;32m 256\u001b[0m filename: \u001b[38;5;28mstr\u001b[39m,\n\u001b[0;32m 257\u001b[0m \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs,\n\u001b[0;32m 258\u001b[0m ) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m Optional[\u001b[38;5;28mstr\u001b[39m]:\n\u001b[0;32m 259\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[0;32m 260\u001b[0m \u001b[38;5;124;03m Tries to locate a file in a local folder and repo, downloads and cache it if necessary.\u001b[39;00m\n\u001b[0;32m 261\u001b[0m \n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 310\u001b[0m \u001b[38;5;124;03m ```\u001b[39;00m\n\u001b[0;32m 311\u001b[0m \u001b[38;5;124;03m \"\"\"\u001b[39;00m\n\u001b[1;32m--> 312\u001b[0m file \u001b[38;5;241m=\u001b[39m cached_files(path_or_repo_id\u001b[38;5;241m=\u001b[39mpath_or_repo_id, filenames\u001b[38;5;241m=\u001b[39m[filename], \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs)\n\u001b[0;32m 313\u001b[0m file \u001b[38;5;241m=\u001b[39m file[\u001b[38;5;241m0\u001b[39m] \u001b[38;5;28;01mif\u001b[39;00m file \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;28;01melse\u001b[39;00m file\n\u001b[0;32m 314\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m file\n", "File \u001b[1;32mc:\\Users\\Ashley.Banks\\AppData\\Local\\anaconda3\\Lib\\site-packages\\transformers\\utils\\hub.py:557\u001b[0m, in \u001b[0;36mcached_files\u001b[1;34m(path_or_repo_id, filenames, cache_dir, force_download, resume_download, proxies, token, revision, local_files_only, subfolder, repo_type, user_agent, _raise_exceptions_for_gated_repo, _raise_exceptions_for_missing_entries, _raise_exceptions_for_connection_errors, _commit_hash, **deprecated_kwargs)\u001b[0m\n\u001b[0;32m 554\u001b[0m \u001b[38;5;66;03m# Any other Exception type should now be re-raised, in order to provide helpful error messages and break the execution flow\u001b[39;00m\n\u001b[0;32m 555\u001b[0m \u001b[38;5;66;03m# (EntryNotFoundError will be treated outside this block and correctly re-raised if needed)\u001b[39;00m\n\u001b[0;32m 556\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(e, EntryNotFoundError):\n\u001b[1;32m--> 557\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m e\n\u001b[0;32m 559\u001b[0m resolved_files \u001b[38;5;241m=\u001b[39m [\n\u001b[0;32m 560\u001b[0m _get_cache_file_to_return(path_or_repo_id, filename, cache_dir, revision) \u001b[38;5;28;01mfor\u001b[39;00m filename \u001b[38;5;129;01min\u001b[39;00m full_filenames\n\u001b[0;32m 561\u001b[0m ]\n\u001b[0;32m 562\u001b[0m \u001b[38;5;66;03m# If there are any missing file and the flag is active, raise\u001b[39;00m\n", "File \u001b[1;32mc:\\Users\\Ashley.Banks\\AppData\\Local\\anaconda3\\Lib\\site-packages\\transformers\\utils\\hub.py:470\u001b[0m, in \u001b[0;36mcached_files\u001b[1;34m(path_or_repo_id, filenames, cache_dir, force_download, resume_download, proxies, token, revision, local_files_only, subfolder, repo_type, user_agent, _raise_exceptions_for_gated_repo, _raise_exceptions_for_missing_entries, _raise_exceptions_for_connection_errors, _commit_hash, **deprecated_kwargs)\u001b[0m\n\u001b[0;32m 467\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m 468\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mlen\u001b[39m(full_filenames) \u001b[38;5;241m==\u001b[39m \u001b[38;5;241m1\u001b[39m:\n\u001b[0;32m 469\u001b[0m \u001b[38;5;66;03m# This is slightly better for only 1 file\u001b[39;00m\n\u001b[1;32m--> 470\u001b[0m hf_hub_download(\n\u001b[0;32m 471\u001b[0m path_or_repo_id,\n\u001b[0;32m 472\u001b[0m filenames[\u001b[38;5;241m0\u001b[39m],\n\u001b[0;32m 473\u001b[0m subfolder\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mlen\u001b[39m(subfolder) \u001b[38;5;241m==\u001b[39m \u001b[38;5;241m0\u001b[39m \u001b[38;5;28;01melse\u001b[39;00m subfolder,\n\u001b[0;32m 474\u001b[0m repo_type\u001b[38;5;241m=\u001b[39mrepo_type,\n\u001b[0;32m 475\u001b[0m revision\u001b[38;5;241m=\u001b[39mrevision,\n\u001b[0;32m 476\u001b[0m cache_dir\u001b[38;5;241m=\u001b[39mcache_dir,\n\u001b[0;32m 477\u001b[0m user_agent\u001b[38;5;241m=\u001b[39muser_agent,\n\u001b[0;32m 478\u001b[0m force_download\u001b[38;5;241m=\u001b[39mforce_download,\n\u001b[0;32m 479\u001b[0m proxies\u001b[38;5;241m=\u001b[39mproxies,\n\u001b[0;32m 480\u001b[0m resume_download\u001b[38;5;241m=\u001b[39mresume_download,\n\u001b[0;32m 481\u001b[0m token\u001b[38;5;241m=\u001b[39mtoken,\n\u001b[0;32m 482\u001b[0m local_files_only\u001b[38;5;241m=\u001b[39mlocal_files_only,\n\u001b[0;32m 483\u001b[0m )\n\u001b[0;32m 484\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m 485\u001b[0m snapshot_download(\n\u001b[0;32m 486\u001b[0m path_or_repo_id,\n\u001b[0;32m 487\u001b[0m allow_patterns\u001b[38;5;241m=\u001b[39mfull_filenames,\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 496\u001b[0m local_files_only\u001b[38;5;241m=\u001b[39mlocal_files_only,\n\u001b[0;32m 497\u001b[0m )\n", "File \u001b[1;32mc:\\Users\\Ashley.Banks\\AppData\\Local\\anaconda3\\Lib\\site-packages\\huggingface_hub\\utils\\_validators.py:114\u001b[0m, in \u001b[0;36mvalidate_hf_hub_args.<locals>._inner_fn\u001b[1;34m(*args, **kwargs)\u001b[0m\n\u001b[0;32m 111\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m check_use_auth_token:\n\u001b[0;32m 112\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[1;32m--> 114\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m fn(\u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs)\n", "File \u001b[1;32mc:\\Users\\Ashley.Banks\\AppData\\Local\\anaconda3\\Lib\\site-packages\\huggingface_hub\\file_download.py:1008\u001b[0m, in \u001b[0;36mhf_hub_download\u001b[1;34m(repo_id, filename, subfolder, repo_type, revision, library_name, library_version, cache_dir, local_dir, user_agent, force_download, proxies, etag_timeout, token, local_files_only, headers, endpoint, resume_download, force_filename, local_dir_use_symlinks)\u001b[0m\n\u001b[0;32m 988\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m _hf_hub_download_to_local_dir(\n\u001b[0;32m 989\u001b[0m \u001b[38;5;66;03m# Destination\u001b[39;00m\n\u001b[0;32m 990\u001b[0m local_dir\u001b[38;5;241m=\u001b[39mlocal_dir,\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 1005\u001b[0m local_files_only\u001b[38;5;241m=\u001b[39mlocal_files_only,\n\u001b[0;32m 1006\u001b[0m )\n\u001b[0;32m 1007\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m-> 1008\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m _hf_hub_download_to_cache_dir(\n\u001b[0;32m 1009\u001b[0m \u001b[38;5;66;03m# Destination\u001b[39;00m\n\u001b[0;32m 1010\u001b[0m cache_dir\u001b[38;5;241m=\u001b[39mcache_dir,\n\u001b[0;32m 1011\u001b[0m \u001b[38;5;66;03m# File info\u001b[39;00m\n\u001b[0;32m 1012\u001b[0m repo_id\u001b[38;5;241m=\u001b[39mrepo_id,\n\u001b[0;32m 1013\u001b[0m filename\u001b[38;5;241m=\u001b[39mfilename,\n\u001b[0;32m 1014\u001b[0m repo_type\u001b[38;5;241m=\u001b[39mrepo_type,\n\u001b[0;32m 1015\u001b[0m revision\u001b[38;5;241m=\u001b[39mrevision,\n\u001b[0;32m 1016\u001b[0m \u001b[38;5;66;03m# HTTP info\u001b[39;00m\n\u001b[0;32m 1017\u001b[0m endpoint\u001b[38;5;241m=\u001b[39mendpoint,\n\u001b[0;32m 1018\u001b[0m etag_timeout\u001b[38;5;241m=\u001b[39metag_timeout,\n\u001b[0;32m 1019\u001b[0m headers\u001b[38;5;241m=\u001b[39mhf_headers,\n\u001b[0;32m 1020\u001b[0m proxies\u001b[38;5;241m=\u001b[39mproxies,\n\u001b[0;32m 1021\u001b[0m token\u001b[38;5;241m=\u001b[39mtoken,\n\u001b[0;32m 1022\u001b[0m \u001b[38;5;66;03m# Additional options\u001b[39;00m\n\u001b[0;32m 1023\u001b[0m local_files_only\u001b[38;5;241m=\u001b[39mlocal_files_only,\n\u001b[0;32m 1024\u001b[0m force_download\u001b[38;5;241m=\u001b[39mforce_download,\n\u001b[0;32m 1025\u001b[0m )\n", "File \u001b[1;32mc:\\Users\\Ashley.Banks\\AppData\\Local\\anaconda3\\Lib\\site-packages\\huggingface_hub\\file_download.py:1071\u001b[0m, in \u001b[0;36m_hf_hub_download_to_cache_dir\u001b[1;34m(cache_dir, repo_id, filename, repo_type, revision, endpoint, etag_timeout, headers, proxies, token, local_files_only, force_download)\u001b[0m\n\u001b[0;32m 1067\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m pointer_path\n\u001b[0;32m 1069\u001b[0m \u001b[38;5;66;03m# Try to get metadata (etag, commit_hash, url, size) from the server.\u001b[39;00m\n\u001b[0;32m 1070\u001b[0m \u001b[38;5;66;03m# If we can't, a HEAD request error is returned.\u001b[39;00m\n\u001b[1;32m-> 1071\u001b[0m (url_to_download, etag, commit_hash, expected_size, xet_file_data, head_call_error) \u001b[38;5;241m=\u001b[39m _get_metadata_or_catch_error(\n\u001b[0;32m 1072\u001b[0m repo_id\u001b[38;5;241m=\u001b[39mrepo_id,\n\u001b[0;32m 1073\u001b[0m filename\u001b[38;5;241m=\u001b[39mfilename,\n\u001b[0;32m 1074\u001b[0m repo_type\u001b[38;5;241m=\u001b[39mrepo_type,\n\u001b[0;32m 1075\u001b[0m revision\u001b[38;5;241m=\u001b[39mrevision,\n\u001b[0;32m 1076\u001b[0m endpoint\u001b[38;5;241m=\u001b[39mendpoint,\n\u001b[0;32m 1077\u001b[0m proxies\u001b[38;5;241m=\u001b[39mproxies,\n\u001b[0;32m 1078\u001b[0m etag_timeout\u001b[38;5;241m=\u001b[39metag_timeout,\n\u001b[0;32m 1079\u001b[0m headers\u001b[38;5;241m=\u001b[39mheaders,\n\u001b[0;32m 1080\u001b[0m token\u001b[38;5;241m=\u001b[39mtoken,\n\u001b[0;32m 1081\u001b[0m local_files_only\u001b[38;5;241m=\u001b[39mlocal_files_only,\n\u001b[0;32m 1082\u001b[0m storage_folder\u001b[38;5;241m=\u001b[39mstorage_folder,\n\u001b[0;32m 1083\u001b[0m relative_filename\u001b[38;5;241m=\u001b[39mrelative_filename,\n\u001b[0;32m 1084\u001b[0m )\n\u001b[0;32m 1086\u001b[0m \u001b[38;5;66;03m# etag can be None for several reasons:\u001b[39;00m\n\u001b[0;32m 1087\u001b[0m \u001b[38;5;66;03m# 1. we passed local_files_only.\u001b[39;00m\n\u001b[0;32m 1088\u001b[0m \u001b[38;5;66;03m# 2. we don't have a connection\u001b[39;00m\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 1094\u001b[0m \u001b[38;5;66;03m# If the specified revision is a commit hash, look inside \"snapshots\".\u001b[39;00m\n\u001b[0;32m 1095\u001b[0m \u001b[38;5;66;03m# If the specified revision is a branch or tag, look inside \"refs\".\u001b[39;00m\n\u001b[0;32m 1096\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m head_call_error \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[0;32m 1097\u001b[0m \u001b[38;5;66;03m# Couldn't make a HEAD call => let's try to find a local file\u001b[39;00m\n", "File \u001b[1;32mc:\\Users\\Ashley.Banks\\AppData\\Local\\anaconda3\\Lib\\site-packages\\huggingface_hub\\file_download.py:1533\u001b[0m, in \u001b[0;36m_get_metadata_or_catch_error\u001b[1;34m(repo_id, filename, repo_type, revision, endpoint, proxies, etag_timeout, headers, token, local_files_only, relative_filename, storage_folder)\u001b[0m\n\u001b[0;32m 1531\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m 1532\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m-> 1533\u001b[0m metadata \u001b[38;5;241m=\u001b[39m get_hf_file_metadata(\n\u001b[0;32m 1534\u001b[0m url\u001b[38;5;241m=\u001b[39murl, proxies\u001b[38;5;241m=\u001b[39mproxies, timeout\u001b[38;5;241m=\u001b[39metag_timeout, headers\u001b[38;5;241m=\u001b[39mheaders, token\u001b[38;5;241m=\u001b[39mtoken\n\u001b[0;32m 1535\u001b[0m )\n\u001b[0;32m 1536\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m EntryNotFoundError \u001b[38;5;28;01mas\u001b[39;00m http_error:\n\u001b[0;32m 1537\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m storage_folder \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m relative_filename \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[0;32m 1538\u001b[0m \u001b[38;5;66;03m# Cache the non-existence of the file\u001b[39;00m\n", "File \u001b[1;32mc:\\Users\\Ashley.Banks\\AppData\\Local\\anaconda3\\Lib\\site-packages\\huggingface_hub\\utils\\_validators.py:114\u001b[0m, in \u001b[0;36mvalidate_hf_hub_args.<locals>._inner_fn\u001b[1;34m(*args, **kwargs)\u001b[0m\n\u001b[0;32m 111\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m check_use_auth_token:\n\u001b[0;32m 112\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[1;32m--> 114\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m fn(\u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs)\n", "File \u001b[1;32mc:\\Users\\Ashley.Banks\\AppData\\Local\\anaconda3\\Lib\\site-packages\\huggingface_hub\\file_download.py:1450\u001b[0m, in \u001b[0;36mget_hf_file_metadata\u001b[1;34m(url, token, proxies, timeout, library_name, library_version, user_agent, headers)\u001b[0m\n\u001b[0;32m 1447\u001b[0m hf_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[0;32m 1449\u001b[0m \u001b[38;5;66;03m# Retrieve metadata\u001b[39;00m\n\u001b[1;32m-> 1450\u001b[0m r \u001b[38;5;241m=\u001b[39m _request_wrapper(\n\u001b[0;32m 1451\u001b[0m method\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mHEAD\u001b[39m\u001b[38;5;124m\"\u001b[39m,\n\u001b[0;32m 1452\u001b[0m url\u001b[38;5;241m=\u001b[39murl,\n\u001b[0;32m 1453\u001b[0m headers\u001b[38;5;241m=\u001b[39mhf_headers,\n\u001b[0;32m 1454\u001b[0m allow_redirects\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mFalse\u001b[39;00m,\n\u001b[0;32m 1455\u001b[0m follow_relative_redirects\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mTrue\u001b[39;00m,\n\u001b[0;32m 1456\u001b[0m proxies\u001b[38;5;241m=\u001b[39mproxies,\n\u001b[0;32m 1457\u001b[0m timeout\u001b[38;5;241m=\u001b[39mtimeout,\n\u001b[0;32m 1458\u001b[0m )\n\u001b[0;32m 1459\u001b[0m hf_raise_for_status(r)\n\u001b[0;32m 1461\u001b[0m \u001b[38;5;66;03m# Return\u001b[39;00m\n", "File \u001b[1;32mc:\\Users\\Ashley.Banks\\AppData\\Local\\anaconda3\\Lib\\site-packages\\huggingface_hub\\file_download.py:286\u001b[0m, in \u001b[0;36m_request_wrapper\u001b[1;34m(method, url, follow_relative_redirects, **params)\u001b[0m\n\u001b[0;32m 284\u001b[0m \u001b[38;5;66;03m# Recursively follow relative redirects\u001b[39;00m\n\u001b[0;32m 285\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m follow_relative_redirects:\n\u001b[1;32m--> 286\u001b[0m response \u001b[38;5;241m=\u001b[39m _request_wrapper(\n\u001b[0;32m 287\u001b[0m method\u001b[38;5;241m=\u001b[39mmethod,\n\u001b[0;32m 288\u001b[0m url\u001b[38;5;241m=\u001b[39murl,\n\u001b[0;32m 289\u001b[0m follow_relative_redirects\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mFalse\u001b[39;00m,\n\u001b[0;32m 290\u001b[0m \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mparams,\n\u001b[0;32m 291\u001b[0m )\n\u001b[0;32m 293\u001b[0m \u001b[38;5;66;03m# If redirection, we redirect only relative paths.\u001b[39;00m\n\u001b[0;32m 294\u001b[0m \u001b[38;5;66;03m# This is useful in case of a renamed repository.\u001b[39;00m\n\u001b[0;32m 295\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[1;32mc:\\Users\\Ashley.Banks\\AppData\\Local\\anaconda3\\Lib\\site-packages\\huggingface_hub\\file_download.py:309\u001b[0m, in \u001b[0;36m_request_wrapper\u001b[1;34m(method, url, follow_relative_redirects, **params)\u001b[0m\n\u001b[0;32m 306\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m response\n\u001b[0;32m 308\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[1;32m--> 309\u001b[0m response \u001b[38;5;241m=\u001b[39m http_backoff(method\u001b[38;5;241m=\u001b[39mmethod, url\u001b[38;5;241m=\u001b[39murl, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mparams, retry_on_exceptions\u001b[38;5;241m=\u001b[39m(), retry_on_status_codes\u001b[38;5;241m=\u001b[39m(\u001b[38;5;241m429\u001b[39m,))\n\u001b[0;32m 310\u001b[0m hf_raise_for_status(response)\n\u001b[0;32m 311\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m response\n", "File \u001b[1;32mc:\\Users\\Ashley.Banks\\AppData\\Local\\anaconda3\\Lib\\site-packages\\huggingface_hub\\utils\\_http.py:310\u001b[0m, in \u001b[0;36mhttp_backoff\u001b[1;34m(method, url, max_retries, base_wait_time, max_wait_time, retry_on_exceptions, retry_on_status_codes, **kwargs)\u001b[0m\n\u001b[0;32m 307\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[0;32m 309\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[1;32m--> 310\u001b[0m response \u001b[38;5;241m=\u001b[39m session\u001b[38;5;241m.\u001b[39mrequest(method\u001b[38;5;241m=\u001b[39mmethod, url\u001b[38;5;241m=\u001b[39murl, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs)\n\u001b[0;32m 311\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[0;32m 312\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m response\n", "File \u001b[1;32mc:\\Users\\Ashley.Banks\\AppData\\Local\\anaconda3\\Lib\\site-packages\\requests\\sessions.py:589\u001b[0m, in \u001b[0;36mSession.request\u001b[1;34m(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json)\u001b[0m\n\u001b[0;32m 584\u001b[0m send_kwargs \u001b[38;5;241m=\u001b[39m {\n\u001b[0;32m 585\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtimeout\u001b[39m\u001b[38;5;124m\"\u001b[39m: timeout,\n\u001b[0;32m 586\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[0;32m 587\u001b[0m }\n\u001b[0;32m 588\u001b[0m send_kwargs\u001b[38;5;241m.\u001b[39mupdate(settings)\n\u001b[1;32m--> 589\u001b[0m resp \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msend(prep, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39msend_kwargs)\n\u001b[0;32m 591\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m resp\n", "File \u001b[1;32mc:\\Users\\Ashley.Banks\\AppData\\Local\\anaconda3\\Lib\\site-packages\\requests\\sessions.py:703\u001b[0m, in \u001b[0;36mSession.send\u001b[1;34m(self, request, **kwargs)\u001b[0m\n\u001b[0;32m 700\u001b[0m start \u001b[38;5;241m=\u001b[39m preferred_clock()\n\u001b[0;32m 702\u001b[0m \u001b[38;5;66;03m# Send the request\u001b[39;00m\n\u001b[1;32m--> 703\u001b[0m r \u001b[38;5;241m=\u001b[39m adapter\u001b[38;5;241m.\u001b[39msend(request, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs)\n\u001b[0;32m 705\u001b[0m \u001b[38;5;66;03m# Total elapsed time of the request (approximately)\u001b[39;00m\n\u001b[0;32m 706\u001b[0m elapsed \u001b[38;5;241m=\u001b[39m preferred_clock() \u001b[38;5;241m-\u001b[39m start\n", "File \u001b[1;32mc:\\Users\\Ashley.Banks\\AppData\\Local\\anaconda3\\Lib\\site-packages\\huggingface_hub\\utils\\_http.py:96\u001b[0m, in \u001b[0;36mUniqueRequestIdAdapter.send\u001b[1;34m(self, request, *args, **kwargs)\u001b[0m\n\u001b[0;32m 94\u001b[0m logger\u001b[38;5;241m.\u001b[39mdebug(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mSend: \u001b[39m\u001b[38;5;132;01m{\u001b[39;00m_curlify(request)\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m 95\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m---> 96\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28msuper\u001b[39m()\u001b[38;5;241m.\u001b[39msend(request, \u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs)\n\u001b[0;32m 97\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m requests\u001b[38;5;241m.\u001b[39mRequestException \u001b[38;5;28;01mas\u001b[39;00m e:\n\u001b[0;32m 98\u001b[0m request_id \u001b[38;5;241m=\u001b[39m request\u001b[38;5;241m.\u001b[39mheaders\u001b[38;5;241m.\u001b[39mget(X_AMZN_TRACE_ID)\n", "File \u001b[1;32mc:\\Users\\Ashley.Banks\\AppData\\Local\\anaconda3\\Lib\\site-packages\\requests\\adapters.py:698\u001b[0m, in \u001b[0;36mHTTPAdapter.send\u001b[1;34m(self, request, stream, timeout, verify, cert, proxies)\u001b[0m\n\u001b[0;32m 694\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m ProxyError(e, request\u001b[38;5;241m=\u001b[39mrequest)\n\u001b[0;32m 696\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(e\u001b[38;5;241m.\u001b[39mreason, _SSLError):\n\u001b[0;32m 697\u001b[0m \u001b[38;5;66;03m# This branch is for urllib3 v1.22 and later.\u001b[39;00m\n\u001b[1;32m--> 698\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m SSLError(e, request\u001b[38;5;241m=\u001b[39mrequest)\n\u001b[0;32m 700\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mConnectionError\u001b[39;00m(e, request\u001b[38;5;241m=\u001b[39mrequest)\n\u001b[0;32m 702\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m ClosedPoolError \u001b[38;5;28;01mas\u001b[39;00m e:\n", "\u001b[1;31mSSLError\u001b[0m: (MaxRetryError(\"HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /NIHRDataInsights/HRCSHealthCategories/resolve/main/tokenizer_config.json (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)')))\"), '(Request ID: c39f4927-7e74-4ee1-b0ff-59c87354a7cb)')" ] } ], "source": [ "\"\"\"\n", "HRCS Health Category & Research Activity Code - Inference Script\n", "Developed by National Institute for Health and Care Research (NIHR)\n", "\n", "This script downloads the trained models from Hugging Face and runs\n", "predictions locally on a provided CSV of research awards.\n", "\n", "Dependencies required:\n", "pip install torch pandas numpy tqdm transformers huggingface_hub\n", "\"\"\"\n", "\n", "import os, json\n", "from typing import List\n", "import numpy as np\n", "import pandas as pd\n", "from tqdm import tqdm\n", "\n", "import torch\n", "from torch.utils.data import Dataset as TorchDataset, DataLoader\n", "from torch.nn.functional import sigmoid\n", "\n", "from transformers import AutoTokenizer, AutoModelForSequenceClassification\n", "from huggingface_hub import hf_hub_download\n", "\n", "# --- USER SETTINGS ---\n", "# Set the path to the folder containing your CSV and the desired filenames\n", "DATA_FOLDERS = [\"./\"] # can input more than one folder if needed\n", "TEST_FILENAME = r\"test_data.csv\"\n", "OUTPUT_FILENAME = \"hc_rac_predictions.csv\"\n", "\n", "# --- HUGGING FACE REPO SETTINGS ---\n", "HC_REPO_ID = \"NIHRDataInsights/HRCSHealthCategories\"\n", "RAC_REPO_ID = \"NIHRDataInsights/HRCSResearchActivityCodes\"\n", "\n", "BATCH_SIZE = 16 # Adjust based on your hardware (use 64+ for GPUs, 2-16 for CPUs)\n", "MAX_LEN = 512\n", "USE_GPU = torch.cuda.is_available()\n", "\n", "# -------------------- DATASET --------------------\n", "class TextDataset(TorchDataset):\n", " \"\"\"\n", " This section takes your spreadsheet and packages it so the AI can read it.\n", " It combines the 'AwardTitle' and 'AwardAbstract' together into 'text' (to be categorised).\n", " \"\"\"\n", " def __init__(self, df: pd.DataFrame, tokenizer, max_len: int = 512):\n", " df = df.copy()\n", " df[\"text\"] = (\n", " df[\"AwardTitle\"].fillna(\"\").astype(str) + \"\\n\" +\n", " df[\"AwardAbstract\"].fillna(\"\").astype(str)\n", " )\n", " self.texts = df[\"text\"].tolist()\n", " self.tokenizer = tokenizer\n", " self.max_len = max_len\n", "\n", " def __len__(self):\n", " return len(self.texts)\n", "\n", " def __getitem__(self, idx):\n", " enc = self.tokenizer(\n", " self.texts[idx],\n", " truncation=True, # cuts if too long\n", " padding=\"max_length\", # adds spaces if under limit\n", " max_length=self.max_len,\n", " return_tensors=\"pt\"\n", " )\n", " return {k: v.squeeze(0) for k, v in enc.items()}\n", "\n", "# -------------------- MODEL LOADING --------------------\n", "def load_hf_model(repo_id: str):\n", " \"\"\"\n", " This section downloads the models from hugging face and the optimal thresholds.\n", " \"\"\"\n", " print(f\"Loading model and tokenizer from: {repo_id}...\")\n", "\n", " tok = AutoTokenizer.from_pretrained(repo_id, use_fast=True)\n", " model = AutoModelForSequenceClassification.from_pretrained(repo_id)\n", "\n", " model.eval()\n", " device = torch.device(\"cuda\" if USE_GPU else \"cpu\")\n", " model.to(device)\n", "\n", " # Download custom metadata.json from the repo for specific threshold values\n", " try:\n", " meta_path = hf_hub_download(repo_id=repo_id, filename=\"metadata.json\")\n", " with open(meta_path, \"r\") as f:\n", " meta = json.load(f)\n", " labels = meta.get(\"labels\")\n", " thresholds = np.array(meta.get(\"optimal_thresholds\", []), dtype=float)\n", " except Exception as e:\n", " print(f\"Warning: Could not load metadata.json from {repo_id}. {e}\")\n", " labels, thresholds = None, None\n", "\n", " if labels is None:\n", " num_labels = int(model.config.num_labels)\n", " labels = [model.config.id2label.get(i, f\"L{i}\") for i in range(num_labels)]\n", "\n", " if thresholds is None or len(thresholds) != len(labels):\n", " print(f\"Using default 0.5 threshold for {repo_id}\")\n", " thresholds = np.full(len(labels), 0.5, dtype=float)\n", "\n", " return tok, model, labels, thresholds\n", "\n", "# -------------------- INFERENCE & BUILD --------------------\n", "def predict(model, dataloader: DataLoader, thresholds: np.ndarray):\n", " device = next(model.parameters()).device\n", " all_logits = []\n", "\n", " with torch.no_grad():\n", " for batch in tqdm(dataloader, desc=\"Inferencing\"):\n", " inputs = {k: v.to(device) for k, v in batch.items()}\n", " logits = model(**inputs).logits\n", " all_logits.append(logits.cpu())\n", "\n", " logits = torch.cat(all_logits, dim=0).numpy()\n", " probs = sigmoid(torch.tensor(logits)).numpy()\n", " preds = (probs > thresholds.reshape(1, -1)).astype(int)\n", " return logits, probs, preds\n", "\n", "def build_outputs(df, logits, probs, preds, label_list, thresholds, prefix: str):\n", " \"\"\"\n", " This section builds the final columns for your spreadsheet.\n", " Crucially, it calculates the 'Smallest Logit Diff'.\n", " This can be considered an 'AI Certainty Score'. The closer this number is to 0,\n", " the more confused the AI was. Please see the Hugging Face READMEs for each model which contains details on the impact on performance.\n", " \"\"\"\n", " # Clip thresholds to avoid log(0) warnings\n", " safe_thresholds = np.clip(thresholds, 1e-7, 1 - 1e-7)\n", " thr_logits = np.log(safe_thresholds / (1 - safe_thresholds))\n", "\n", " rows = {}\n", " for i in range(len(df)):\n", " logit_row = logits[i]\n", " pred_row = preds[i]\n", "\n", " # gather categories labelled as 'yes'\n", " chosen = [label_list[j] for j, val in enumerate(pred_row) if val == 1]\n", "\n", " # Calculate the uncertainty score\n", " smallest_diff = float(np.min(np.abs(logit_row - thr_logits)))\n", " rows[i] = {\n", " f\"{prefix}_PredictedLabels\": \";\".join(chosen),\n", " f\"{prefix}_SmallestLogitDiff\": smallest_diff\n", " }\n", " return rows\n", "\n", "# -------------------- PROCESS FOLDER --------------------\n", "def run_folder(data_folder: str, hc_assets, rac_assets):\n", " \"\"\"\n", " This function opens your specific folder (selected in the first section), reads your CSV, passes it through\n", " both AI models (Health Categories and Research Activity Codes), and saves the result.\n", " \"\"\"\n", " test_file = os.path.join(data_folder, TEST_FILENAME)\n", " output_file = os.path.join(data_folder, OUTPUT_FILENAME)\n", "\n", " if not os.path.exists(test_file):\n", " print(f\"Skipping: {test_file} not found in {data_folder}.\")\n", " return\n", "\n", " print(f\"\\n=== Processing folder: {data_folder} ===\")\n", " df = pd.read_csv(test_file).reset_index(drop=True)\n", "\n", " # Validate Input Data contains title and abstract\n", " if \"AwardTitle\" not in df.columns or \"AwardAbstract\" not in df.columns:\n", " print(f\"ERROR: '{TEST_FILENAME}' must contain 'AwardTitle' and 'AwardAbstract' columns. Skipping.\")\n", " return\n", "\n", " # HC Inference\n", " hc_tok, hc_model, hc_labels, hc_thr = hc_assets\n", " hc_loader = DataLoader(TextDataset(df, hc_tok), batch_size=BATCH_SIZE)\n", " hc_logits, _, hc_preds = predict(hc_model, hc_loader, hc_thr)\n", " hc_rows = build_outputs(df, hc_logits, None, hc_preds, hc_labels, hc_thr, \"HC\")\n", "\n", " # RAC Inference\n", " rac_tok, rac_model, rac_labels, rac_thr = rac_assets\n", " rac_loader = DataLoader(TextDataset(df, rac_tok), batch_size=BATCH_SIZE)\n", " rac_logits, _, rac_preds = predict(rac_model, rac_loader, rac_thr)\n", " rac_rows = build_outputs(df, rac_logits, None, rac_preds, rac_labels, rac_thr, \"RAC\")\n", "\n", " # Construct final dataframe\n", " output_data = []\n", " for i in range(len(df)):\n", " row = {\n", " \"ID\": df.loc[i, \"ID\"] if \"ID\" in df.columns else i,\n", " \"FunderAcronym\": df.loc[i, \"FunderAcronym\"] if \"FunderAcronym\" in df.columns else \"\",\n", " \"AwardTitle\": df.loc[i, \"AwardTitle\"],\n", " \"AwardAbstract\": df.loc[i, \"AwardAbstract\"],\n", " **hc_rows[i],\n", " **rac_rows[i]\n", " }\n", " output_data.append(row)\n", "\n", " pd.DataFrame(output_data).to_csv(OUTPUT_FILENAME, index=False)\n", " print(f\"Success! Predictions saved to: {output_file}\")\n", "\n", "# -------------------- MAIN --------------------\n", "if __name__ == \"__main__\":\n", " print(\"Initialising HRCS Classifier Pipeline...\")\n", "\n", " # Load models once outside the loop to save memory/time\n", " hc_assets = load_hf_model(HC_REPO_ID)\n", " rac_assets = load_hf_model(RAC_REPO_ID)\n", "\n", " for folder in DATA_FOLDERS:\n", " run_folder(folder, hc_assets, rac_assets)" ] } ], "metadata": { "colab": { "provenance": [] }, "kernelspec": { "display_name": "base", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.12.7" }, "widgets": { "application/vnd.jupyter.widget-state+json": { "0e22f97db509402a9b4d4a2fa8c80fe0": { "model_module": "@jupyter-widgets/controls", "model_module_version": "1.5.0", "model_name": "HTMLModel", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HTMLView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_926c9a0562f3455b958c71bd0a138558", "placeholder": "", "style": "IPY_MODEL_ef276c365d604dcc83b4a0133c6b7652", "value": "Loading weights: 100%" } }, "1776c0895e7f400f85d3a2123cb573f1": { "model_module": "@jupyter-widgets/controls", "model_module_version": "1.5.0", "model_name": "HTMLModel", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HTMLView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_9cba2384346645499516a7923ad6fcef", "placeholder": "", "style": "IPY_MODEL_491f71a8889c4c7aa0042e99f374be79", "value": "Loading weights: 100%" } }, "210ec65a874a4f51ab9f059d3de804a9": { "model_module": "@jupyter-widgets/controls", "model_module_version": "1.5.0", "model_name": "HTMLModel", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HTMLView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_25529d785e9047e1b9bd197a7ec56773", "placeholder": "", "style": "IPY_MODEL_9dda1a77133c4247bac106a9c4699153", "value": " 393/393 [00:00<00:00, 581.79it/s, Materializing param=classifier.weight]" } }, "25529d785e9047e1b9bd197a7ec56773": { "model_module": "@jupyter-widgets/base", "model_module_version": "1.2.0", "model_name": "LayoutModel", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "3dc315e087f44330badbb6749b0611a9": { "model_module": "@jupyter-widgets/base", "model_module_version": "1.2.0", "model_name": "LayoutModel", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "475728820f8e4b6fa0c33a1e9989179a": { "model_module": "@jupyter-widgets/controls", "model_module_version": "1.5.0", "model_name": "FloatProgressModel", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "FloatProgressModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "ProgressView", "bar_style": "success", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_3dc315e087f44330badbb6749b0611a9", "max": 393, "min": 0, "orientation": "horizontal", "style": "IPY_MODEL_bc6c346b95424eb881b793bf6fd2f53e", "value": 393 } }, "491f71a8889c4c7aa0042e99f374be79": { "model_module": "@jupyter-widgets/controls", "model_module_version": "1.5.0", "model_name": "DescriptionStyleModel", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "926c9a0562f3455b958c71bd0a138558": { "model_module": "@jupyter-widgets/base", "model_module_version": "1.2.0", "model_name": "LayoutModel", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "9275c5cf7b314dc69419611128cb0c09": { "model_module": "@jupyter-widgets/base", "model_module_version": "1.2.0", "model_name": "LayoutModel", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "9cba2384346645499516a7923ad6fcef": { "model_module": "@jupyter-widgets/base", "model_module_version": "1.2.0", "model_name": "LayoutModel", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "9dda1a77133c4247bac106a9c4699153": { "model_module": "@jupyter-widgets/controls", "model_module_version": "1.5.0", "model_name": "DescriptionStyleModel", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "9f60072613d84754a0efe7813d853565": { "model_module": "@jupyter-widgets/base", "model_module_version": "1.2.0", "model_name": "LayoutModel", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "bc6c346b95424eb881b793bf6fd2f53e": { "model_module": "@jupyter-widgets/controls", "model_module_version": "1.5.0", "model_name": "ProgressStyleModel", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "ProgressStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "bar_color": null, "description_width": "" } }, "bf48a3e692ae4e6da5379152f51baa09": { "model_module": "@jupyter-widgets/controls", "model_module_version": "1.5.0", "model_name": "ProgressStyleModel", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "ProgressStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "bar_color": null, "description_width": "" } }, "c26db3dd5a86405b81f510fd759c3af7": { "model_module": "@jupyter-widgets/base", "model_module_version": "1.2.0", "model_name": "LayoutModel", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "c91d89b903ce4f02b635454d3bd87877": { "model_module": "@jupyter-widgets/base", "model_module_version": "1.2.0", "model_name": "LayoutModel", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "cf5e926c8c004525b5aad36d821ef928": { "model_module": "@jupyter-widgets/controls", "model_module_version": "1.5.0", "model_name": "HTMLModel", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HTMLView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_c26db3dd5a86405b81f510fd759c3af7", "placeholder": "", "style": "IPY_MODEL_dae2b5afeee243e682322c1ecb8238e6", "value": " 393/393 [00:01<00:00, 353.83it/s, Materializing param=classifier.weight]" } }, "d6d7368c1c7b4a549d9a706ee1a62785": { "model_module": "@jupyter-widgets/controls", "model_module_version": "1.5.0", "model_name": "HBoxModel", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HBoxModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HBoxView", "box_style": "", "children": [ "IPY_MODEL_0e22f97db509402a9b4d4a2fa8c80fe0", "IPY_MODEL_475728820f8e4b6fa0c33a1e9989179a", "IPY_MODEL_cf5e926c8c004525b5aad36d821ef928" ], "layout": "IPY_MODEL_9275c5cf7b314dc69419611128cb0c09" } }, "dae2b5afeee243e682322c1ecb8238e6": { "model_module": "@jupyter-widgets/controls", "model_module_version": "1.5.0", "model_name": "DescriptionStyleModel", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "e7fd82b589eb49aaba73aeafcc340421": { "model_module": "@jupyter-widgets/controls", "model_module_version": "1.5.0", "model_name": "FloatProgressModel", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "FloatProgressModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "ProgressView", "bar_style": "success", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_9f60072613d84754a0efe7813d853565", "max": 393, "min": 0, "orientation": "horizontal", "style": "IPY_MODEL_bf48a3e692ae4e6da5379152f51baa09", "value": 393 } }, "ef276c365d604dcc83b4a0133c6b7652": { "model_module": "@jupyter-widgets/controls", "model_module_version": "1.5.0", "model_name": "DescriptionStyleModel", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "f66e121a24e441c2a4cb32fb87d22632": { "model_module": "@jupyter-widgets/controls", "model_module_version": "1.5.0", "model_name": "HBoxModel", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HBoxModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HBoxView", "box_style": "", "children": [ "IPY_MODEL_1776c0895e7f400f85d3a2123cb573f1", "IPY_MODEL_e7fd82b589eb49aaba73aeafcc340421", "IPY_MODEL_210ec65a874a4f51ab9f059d3de804a9" ], "layout": "IPY_MODEL_c91d89b903ce4f02b635454d3bd87877" } } } } }, "nbformat": 4, "nbformat_minor": 0}inference/inference_script.ipynbAdded+1021