seonglae

Resolve Colab Nodebook Issue

......@@ -77,6 +77,8 @@
"DIFF_MODEL='1--gcVVix92_Fp75A-mWH0pJS0ahlni5m'\n",
"\n",
"!pip install gdown \\\n",
" && mkdir -p weight/added \\\n",
" && mkdir -p weight/diff \\\n",
" && gdown \"https://drive.google.com/uc?id=$ADD_MODEL\" -O weight/added/pytorch_model.bin \\\n",
" && gdown \"https://drive.google.com/uc?id=$DIFF_MODEL\" -O weight/diff/pytorch_model.bin"
],
......@@ -185,8 +187,60 @@
"with open('ngrok.conf', 'w') as f:\n",
" f.write(config)"
],
"execution_count": 1,
"outputs": [
{
"output_type": "error",
"ename": "NameError",
"evalue": "name 'authtoken' is not defined",
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)",
"\u001b[1;32m<ipython-input-1-7305b3f78ded>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[0mconfig\u001b[0m \u001b[1;33m=\u001b[0m\u001b[0;31m\\\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 2\u001b[0m f\"\"\"\n\u001b[1;32m----> 3\u001b[1;33m \u001b[0mauthtoken\u001b[0m\u001b[1;33m:\u001b[0m \u001b[1;33m{\u001b[0m\u001b[0mauthtoken\u001b[0m\u001b[1;33m}\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 4\u001b[0m \u001b[0mregion\u001b[0m\u001b[1;33m:\u001b[0m \u001b[1;33m{\u001b[0m\u001b[0mregion\u001b[0m\u001b[1;33m}\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 5\u001b[0m \u001b[0mconsole_ui\u001b[0m\u001b[1;33m:\u001b[0m \u001b[1;32mFalse\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
"\u001b[1;31mNameError\u001b[0m: name 'authtoken' is not defined"
]
}
]
},
{
"cell_type": "code",
"execution_count": null,
"outputs": []
"metadata": {},
"outputs": [],
"source": [
"from subprocess import Popen, PIPE\n",
"import shlex\n",
"import json\n",
"import time\n",
"\n",
"\n",
"def run_with_pipe(command):\n",
" commands = list(map(shlex.split,command.split(\"|\")))\n",
" ps = Popen(commands[0], stdout=PIPE, stderr=PIPE)\n",
" for command in commands[1:]:\n",
" ps = Popen(command, stdin=ps.stdout, stdout=PIPE, stderr=PIPE)\n",
" return ps.stdout.readlines()\n",
"\n",
"\n",
"def get_tunnel_adresses():\n",
" info = run_with_pipe(\"curl http://localhost:4040/api/tunnels\")\n",
" assert info\n",
"\n",
" info = json.loads(info[0])\n",
" for tunnel in info['tunnels']:\n",
" url = tunnel['public_url']\n",
" port = url.split(':')[-1]\n",
" local_port = tunnel['config']['addr'].split(':')[-1]\n",
" print(f'{url} -> {local_port} [{tunnel[\"name\"]}]')\n",
" if tunnel['name'] == 'input':\n",
" in_addr = url\n",
" elif tunnel['name'] == 'output':\n",
" out_addr = url\n",
" else:\n",
" print(f'unknown tunnel: {tunnel[\"name\"]}')\n",
"\n",
" return in_addr, out_addr"
]
},
{
"cell_type": "code",
......