From 96b295e36f79be6049065aa871a8dbf163516504 Mon Sep 17 00:00:00 2001 From: QIN2DIM <62018067+QIN2DIM@users.noreply.github.com> Date: Tue, 31 Oct 2023 06:20:21 +0800 Subject: [PATCH] Update roboflow_resnet.ipynb --- automation/roboflow_resnet.ipynb | 63 +++++++++++++++++--------------- 1 file changed, 33 insertions(+), 30 deletions(-) diff --git a/automation/roboflow_resnet.ipynb b/automation/roboflow_resnet.ipynb index cc7119b8..a89c96fa 100644 --- a/automation/roboflow_resnet.ipynb +++ b/automation/roboflow_resnet.ipynb @@ -29,8 +29,6 @@ "execution_count": null, "outputs": [], "source": [ - "from __future__ import annotations\n", - "\n", "!nvidia-smi" ], "metadata": { @@ -39,27 +37,44 @@ } }, { - "cell_type": "code", + "cell_type": "markdown", "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", - "!rm -rf hcaptcha-model-factory/" + "Set `task_name` and `onnx_archive_name`" ], "metadata": { - "id": "1pTzykxKeaKk" - }, + "collapsed": false + } + }, + { + "cell_type": "code", "execution_count": null, - "outputs": [] + "outputs": [], + "source": [ + "GITHUB_TOKEN = \"\"\n", + "task_name = \"robot\"\n", + "onnx_archive_name = \"robot2312\"\n", + "\n", + "# If you are training a nested model,\n", + "# you need to specify the `solver.handle(prompt)` it is bound to.\n", + "# Otherwise, please set it to empty\n", + "NESTED_PROMPT = \"\"" + ], + "metadata": { + "collapsed": false + } }, { - "cell_type": "markdown", + "cell_type": "code", + "execution_count": null, + "outputs": [], "source": [ - "Set `task_name` and `onnx_archive_name`" + "!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", + "!rm -rf hcaptcha-model-factory/" ], "metadata": { - "collapsed": false, - "id": "4_GBcuSeEMEY" + "collapsed": false } }, { @@ -71,24 +86,12 @@ "\n", "import hcaptcha_challenger as solver\n", "\n", - "os.environ[\"GITHUB_TOKEN\"] = \"\"\n", - "task_name = \"robot\"\n", - "onnx_archive_name = \"robot2312\"\n", - "\n", - "# If you are training a nested model,\n", - "# you need to specify the `handle(prompt)` it is bound to.\n", - "# Otherwise, please set it to empty\n", - "NESTED_PROMPT = \"\"\n", + "os.environ[\"GITHUB_TOKEN\"] = GITHUB_TOKEN\n", "\n", "solver.diagnose_task(task_name)" ], "metadata": { - "colab": { - "base_uri": "https://localhost:8080/", - "height": 35 - }, - "id": "NLfyF05xEMEZ", - "outputId": "161cf11e-a722-4ca4-9ceb-7efdd35b0216" + "collapsed": false } }, { @@ -279,7 +282,7 @@ " }\n", " )\n", "\n", - " def to_yaml(self, path: Path | None = None):\n", + " def to_yaml(self, path: Path = None):\n", " path = path or Path(\"objects-tmp.yaml\")\n", " with open(path, \"w\", encoding=\"utf8\") as file:\n", " yaml.safe_dump(self.__dict__, file, sort_keys=False, allow_unicode=True)\n", @@ -320,7 +323,7 @@ " return self._asset\n", "\n", " @staticmethod\n", - " def parse_resnet_label(asset_name: str) -> str | None:\n", + " def parse_resnet_label(asset_name: str) -> str:\n", " \"\"\"\n", " asset_name: dog2312.onnx chess_piece2309.onnx\n", " \"\"\"\n",