diff --git a/day1/day1_practice.ipynb b/day1/day1_practice.ipynb index a1dec3a9e..8fdbdee30 100644 --- a/day1/day1_practice.ipynb +++ b/day1/day1_practice.ipynb @@ -59,13 +59,31 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 17, "metadata": { - "id": "AIXMavdDEP8U" + "id": "AIXMavdDEP8U", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "ba662f2d-79b4-4cfb-bbad-d1a0f51536da" }, - "outputs": [], + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Cloning into 'lecture-ai-engineering'...\n", + "remote: Enumerating objects: 68, done.\u001b[K\n", + "remote: Counting objects: 100% (10/10), done.\u001b[K\n", + "remote: Compressing objects: 100% (7/7), done.\u001b[K\n", + "remote: Total 68 (delta 6), reused 3 (delta 3), pack-reused 58 (from 2)\u001b[K\n", + "Receiving objects: 100% (68/68), 97.84 KiB | 538.00 KiB/s, done.\n", + "Resolving deltas: 100% (15/15), done.\n" + ] + } + ], "source": [ - "!git clone https://github.com/matsuolab/lecture-ai-engineering.git" + "!git clone https://github.com/Dalby1379/lecture-ai-engineering.git" ] }, { @@ -115,11 +133,34 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 18, "metadata": { - "id": "bvEowFfg5lrq" + "id": "bvEowFfg5lrq", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "38d7bead-d1fe-424d-bf9f-ad11999d5488" }, - "outputs": [], + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Requirement already satisfied: python-dotenv in /usr/local/lib/python3.11/dist-packages (1.1.0)\n", + "/content/lecture-ai-engineering/day1\n" + ] + }, + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "True" + ] + }, + "metadata": {}, + "execution_count": 18 + } + ], "source": [ "!pip install python-dotenv\n", "from dotenv import load_dotenv, find_dotenv\n", @@ -141,11 +182,23 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 19, "metadata": { - "id": "S28XgOm0ELSM" + "id": "S28XgOm0ELSM", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "3f8a9397-3692-4020-b790-3b5acc9c8cfa" }, - "outputs": [], + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "/content/lecture-ai-engineering/day1/01_streamlit_UI\n" + ] + } + ], "source": [ "%cd /content/lecture-ai-engineering/day1/01_streamlit_UI" ] @@ -161,7 +214,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 20, "metadata": { "id": "nBe41LFiELSN" }, @@ -182,11 +235,23 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 21, "metadata": { - "id": "aYw1q0iXELSN" + "id": "aYw1q0iXELSN", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "b837750c-4a88-4321-bdcc-43dddf5c276f" }, - "outputs": [], + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Authtoken saved to configuration file: /root/.config/ngrok/ngrok.yml\n" + ] + } + ], "source": [ "!ngrok authtoken $$NGROK_TOKEN" ] @@ -202,11 +267,121 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 22, "metadata": { - "id": "f-E7ucR6ELSN" + "id": "f-E7ucR6ELSN", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "59d91208-e425-4895-8817-5c6c11951a45" }, - "outputs": [], + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "公開URL: https://b894-34-16-191-174.ngrok-free.app\n", + "\n", + "Collecting usage statistics. To deactivate, set browser.gatherUsageStats to false.\n", + "\u001b[0m\n", + "\u001b[0m\n", + "\u001b[34m\u001b[1m You can now view your Streamlit app in your browser.\u001b[0m\n", + "\u001b[0m\n", + "\u001b[34m Local URL: \u001b[0m\u001b[1mhttp://localhost:8501\u001b[0m\n", + "\u001b[34m Network URL: \u001b[0m\u001b[1mhttp://172.28.0.12:8501\u001b[0m\n", + "\u001b[34m External URL: \u001b[0m\u001b[1mhttp://34.16.191.174:8501\u001b[0m\n", + "\u001b[0m\n" + ] + }, + { + "output_type": "stream", + "name": "stderr", + "text": [ + "WARNING:pyngrok.process.ngrok:t=2025-05-07T07:32:47+0000 lvl=warn msg=\"Stopping forwarder\" name=http-8501-83370f39-aea1-4253-9094-67ca4b921f38 acceptErr=\"failed to accept connection: Listener closed\"\n" + ] + }, + { + "output_type": "stream", + "name": "stdout", + "text": [ + "\u001b[34m Stopping...\u001b[0m\n", + "Traceback (most recent call last):\n", + " File \"/usr/local/lib/python3.11/dist-packages/streamlit/web/bootstrap.py\", line 347, in run\n", + " if asyncio.get_running_loop().is_running():\n", + " ^^^^^^^^^^^^^^^^^^^^^^^^^^\n", + "RuntimeError: no running event loop\n", + "\n", + "During handling of the above exception, another exception occurred:\n", + "\n", + "Traceback (most recent call last):\n", + " File \"/usr/local/bin/streamlit\", line 8, in \n", + " sys.exit(main())\n", + " ^^^^^^\n", + " File \"/usr/local/lib/python3.11/dist-packages/click/core.py\", line 1161, in __call__\n", + " return self.main(*args, **kwargs)\n", + " ^^^^^^^^^^^^^^^^^^^^^^^^^^\n", + " File \"/usr/local/lib/python3.11/dist-packages/click/core.py\", line 1082, in main\n", + " rv = self.invoke(ctx)\n", + " ^^^^^^^^^^^^^^^^\n", + " File \"/usr/local/lib/python3.11/dist-packages/click/core.py\", line 1697, in invoke\n", + " return _process_result(sub_ctx.command.invoke(sub_ctx))\n", + " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n", + " File \"/usr/local/lib/python3.11/dist-packages/click/core.py\", line 1443, in invoke\n", + " return ctx.invoke(self.callback, **ctx.params)\n", + " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n", + " File \"/usr/local/lib/python3.11/dist-packages/click/core.py\", line 788, in invoke\n", + " return __callback(*args, **kwargs)\n", + " ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n", + " File \"/usr/local/lib/python3.11/dist-packages/streamlit/web/cli.py\", line 240, in main_run\n", + " _main_run(target, args, flag_options=kwargs)\n", + " File \"/usr/local/lib/python3.11/dist-packages/streamlit/web/cli.py\", line 276, in _main_run\n", + " bootstrap.run(file, is_hello, args, flag_options)\n", + " File \"/usr/local/lib/python3.11/dist-packages/streamlit/web/bootstrap.py\", line 355, in run\n", + " asyncio.run(main())\n", + " File \"/usr/lib/python3.11/asyncio/runners.py\", line 190, in run\n", + " return runner.run(main)\n", + " ^^^^^^^^^^^^^^^^\n", + " File \"/usr/lib/python3.11/asyncio/runners.py\", line 118, in run\n", + " return self._loop.run_until_complete(task)\n", + " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n", + " File \"/usr/lib/python3.11/asyncio/base_events.py\", line 641, in run_until_complete\n", + " self.run_forever()\n", + " File \"/usr/lib/python3.11/asyncio/base_events.py\", line 608, in run_forever\n", + " self._run_once()\n", + " File \"/usr/lib/python3.11/asyncio/base_events.py\", line 1898, in _run_once\n", + " event_list = self._selector.select(timeout)\n", + " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n", + " File \"/usr/lib/python3.11/selectors.py\", line 468, in select\n", + " fd_event_list = self._selector.poll(timeout, max_ev)\n", + " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n", + " File \"/usr/local/lib/python3.11/dist-packages/streamlit/web/bootstrap.py\", line 44, in signal_handler\n", + " server.stop()\n", + " File \"/usr/local/lib/python3.11/dist-packages/streamlit/web/server/server.py\", line 468, in stop\n", + " cli_util.print_to_cli(\" Stopping...\", fg=\"blue\")\n", + " File \"/usr/local/lib/python3.11/dist-packages/streamlit/cli_util.py\", line 34, in print_to_cli\n", + " click.secho(message, **kwargs)\n", + " File \"/usr/local/lib/python3.11/dist-packages/click/termui.py\", line 634, in secho\n", + " return echo(message, file=file, nl=nl, err=err, color=color)\n", + " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n", + " File \"/usr/local/lib/python3.11/dist-packages/click/utils.py\", line 318, in echo\n", + " file.write(out) # type: ignore\n", + " ^^^^^^^^^^^^^^^\n", + " File \"/usr/local/lib/python3.11/dist-packages/streamlit/web/bootstrap.py\", line 44, in signal_handler\n", + " server.stop()\n", + " File \"/usr/local/lib/python3.11/dist-packages/streamlit/web/server/server.py\", line 468, in stop\n", + " cli_util.print_to_cli(\" Stopping...\", fg=\"blue\")\n", + " File \"/usr/local/lib/python3.11/dist-packages/streamlit/cli_util.py\", line 34, in print_to_cli\n", + " click.secho(message, **kwargs)\n", + " File \"/usr/local/lib/python3.11/dist-packages/click/termui.py\", line 634, in secho\n", + " return echo(message, file=file, nl=nl, err=err, color=color)\n", + " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n", + " File \"/usr/local/lib/python3.11/dist-packages/click/utils.py\", line 318, in echo\n", + " file.write(out) # type: ignore\n", + " ^^^^^^^^^^^^^^^\n", + "RuntimeError: reentrant call inside <_io.BufferedWriter name=''>\n" + ] + } + ], "source": [ "from pyngrok import ngrok\n", "\n", @@ -294,7 +469,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 25, "metadata": { "id": "mDqvI4V3ELSO" }, @@ -315,11 +490,29 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 26, "metadata": { - "id": "jPxTiEWQELSO" + "id": "jPxTiEWQELSO", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "74607ae1-fb2c-436f-8af1-34f48986d563" }, - "outputs": [], + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Authtoken saved to configuration file: /root/.config/ngrok/ngrok.yml\n", + "The token has not been saved to the git credentials helper. Pass `add_to_git_credential=True` in this function directly or `--add-to-git-credential` if using via `huggingface-cli` if you want to set the git credential as well.\n", + "Token is valid (permission: write).\n", + "The token `AI engineering` has been saved to /root/.cache/huggingface/stored_tokens\n", + "Your token has been saved to /root/.cache/huggingface/token\n", + "Login successful.\n", + "The current active token is: `AI engineering`\n" + ] + } + ], "source": [ "!ngrok authtoken $$NGROK_TOKEN\n", "!huggingface-cli login --token $$HUGGINGFACE_TOKEN" @@ -378,9 +571,319 @@ "cell_type": "code", "execution_count": null, "metadata": { - "id": "TBQyTTWTELSP" + "id": "TBQyTTWTELSP", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "e25147b6-63bf-4e27-f26d-10c561012857" }, - "outputs": [], + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "公開URL: https://c2de-34-16-191-174.ngrok-free.app\n", + "\n", + "Collecting usage statistics. To deactivate, set browser.gatherUsageStats to false.\n", + "\u001b[0m\n", + "\u001b[0m\n", + "\u001b[34m\u001b[1m You can now view your Streamlit app in your browser.\u001b[0m\n", + "\u001b[0m\n", + "\u001b[34m Local URL: \u001b[0m\u001b[1mhttp://localhost:8501\u001b[0m\n", + "\u001b[34m Network URL: \u001b[0m\u001b[1mhttp://172.28.0.12:8501\u001b[0m\n", + "\u001b[34m External URL: \u001b[0m\u001b[1mhttp://34.16.191.174:8501\u001b[0m\n", + "\u001b[0m\n", + "NLTK loaded successfully.\n", + "2025-05-07 07:33:25.042233: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:477] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered\n", + "WARNING: All log messages before absl::InitializeLog() is called are written to STDERR\n", + "E0000 00:00:1746603205.380803 18892 cuda_dnn.cc:8310] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered\n", + "E0000 00:00:1746603205.476568 18892 cuda_blas.cc:1418] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered\n", + "2025-05-07 07:33:26.208483: I tensorflow/core/platform/cpu_feature_guard.cc:210] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.\n", + "To enable the following instructions: AVX2 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.\n", + "NLTK Punkt data checked/downloaded.\n", + "Database 'chat_feedback.db' initialized successfully.\n", + "Data saved to DB successfully.\n", + "Data saved to DB successfully.\n", + "Data saved to DB successfully.\n", + "Data saved to DB successfully.\n", + "Data saved to DB successfully.\n", + "Data saved to DB successfully.\n", + "Data saved to DB successfully.\n", + "Data saved to DB successfully.\n", + "Data saved to DB successfully.\n", + "Data saved to DB successfully.\n", + "config.json: 100% 805/805 [00:00<00:00, 5.21MB/s]\n", + "model.safetensors.index.json: 100% 24.2k/24.2k [00:00<00:00, 70.1MB/s]\n", + "Fetching 2 files: 0% 0/2 [00:00\n", + " lambda m: list(m.__path__._path),\n", + " ^^^^^^^^^^^^^^^^\n", + " File \"/usr/local/lib/python3.11/dist-packages/torch/_classes.py\", line 13, in __getattr__\n", + " proxy = torch._C._get_custom_class_python_wrapper(self.name, attr)\n", + " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n", + "RuntimeError: Tried to instantiate class '__path__._path', but it does not exist! Ensure that it is registered via torch::class_\n" + ] + } + ], "source": [ "from pyngrok import ngrok\n", "\n", @@ -391,7 +894,9 @@ }, { "cell_type": "markdown", - "metadata": {}, + "metadata": { + "id": "Tpz7qAmOqcAD" + }, "source": [ "アプリケーションの機能としては、チャット機能や履歴閲覧があります。\n", "\n", @@ -567,4 +1072,4 @@ }, "nbformat": 4, "nbformat_minor": 0 -} +} \ No newline at end of file