Skip to content

Commit

Permalink
Update roboflow_resnet.ipynb
Browse files Browse the repository at this point in the history
  • Loading branch information
QIN2DIM committed Nov 1, 2023
1 parent 9e0b003 commit 915f048
Showing 1 changed file with 63 additions and 6 deletions.
69 changes: 63 additions & 6 deletions automation/roboflow_resnet.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
{
"cell_type": "markdown",
"source": [
"[ResNet of roboflow](https://colab.research.google.com/github/captcha-challenger/hcaptcha-model-factory/blob/main/automation/roboflow_resnet.ipynb)"
"## ResNet of roboflow\n",
"\n",
"[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/captcha-challenger/hcaptcha-model-factory/blob/main/automation/roboflow_resnet.ipynb)"
],
"metadata": {
"collapsed": false,
Expand All @@ -39,7 +41,7 @@
{
"cell_type": "markdown",
"source": [
"Set `task_name` and `onnx_archive_name`"
"## Exporting the configuration from [`zip_dataset.py`](https://github.com/CaptchaAgent/hcaptcha-model-factory/blob/main/automation/zip_dataset.py)"
],
"metadata": {
"collapsed": false
Expand All @@ -63,14 +65,54 @@
"collapsed": false
}
},
{
"cell_type": "markdown",
"source": [
"## No need to change the code below"
],
"metadata": {
"collapsed": false
}
},
{
"cell_type": "code",
"execution_count": null,
"outputs": [],
"source": [
"\"\"\"\n",
"Injecting Mystical Power into AutoDL\n",
"\"\"\"\n",
"from pathlib import Path\n",
"import os\n",
"import subprocess\n",
"\n",
"IS_AUTODL_PLATFORM = None\n",
"if Path(\"/root/autodl-pub\").exists() and Path(\"/root/autodl-tmp\").exists():\n",
" IS_AUTODL_PLATFORM = True\n",
" result = subprocess.run(\n",
" 'bash -c \"source /etc/network_turbo && env | grep proxy\"',\n",
" shell=True,\n",
" capture_output=True,\n",
" text=True,\n",
" )\n",
" output = result.stdout\n",
" for line in output.splitlines():\n",
" if \"=\" in line:\n",
" var, value = line.split(\"=\", 1)\n",
" os.environ[var] = value"
],
"metadata": {
"collapsed": false
}
},
{
"cell_type": "code",
"execution_count": null,
"outputs": [],
"source": [
"!pip install loguru onnx fire hcaptcha-challenger\n",
"!git clone https://github.com/captcha-challenger/hcaptcha-model-factory.git\n",
"!mv -f hcaptcha-model-factory/src .\n",
"!git clone https: // github.com/captcha-challenger/hcaptcha-model-factory.git\n",
"!mv -f hcaptcha-model-factory/src.\n",
"!rm -rf hcaptcha-model-factory/"
],
"metadata": {
Expand Down Expand Up @@ -150,7 +192,6 @@
"\n",
"from factories.resnet import ResNet\n",
"\n",
"\n",
"# - INPUT: `[PROJECT]/data/<task_name>`\n",
"# - OUTPUT: `[PROJECT]/model/<task_name>/<task_name.onnx>`\n",
"\n",
Expand All @@ -171,7 +212,7 @@
{
"cell_type": "markdown",
"source": [
"Deployment model to GitHub"
"Deploy model to GitHub"
],
"metadata": {
"collapsed": false,
Expand Down Expand Up @@ -443,6 +484,22 @@
"metadata": {
"collapsed": false
}
},
{
"cell_type": "code",
"execution_count": null,
"outputs": [],
"source": [
"\"\"\"\n",
"energy conservation\n",
"\"\"\"\n",
"if IS_AUTODL_PLATFORM:\n",
" os.system(\"unset http_proxy && unset https_proxy\")\n",
" os.system(\"/usr/bin/shutdown\")"
],
"metadata": {
"collapsed": false
}
}
]
}

0 comments on commit 915f048

Please sign in to comment.