diff --git a/week1/Guide to Jupyter.ipynb b/week1/Guide to Jupyter.ipynb index 6b377db..fa9285b 100644 --- a/week1/Guide to Jupyter.ipynb +++ b/week1/Guide to Jupyter.ipynb @@ -245,10 +245,21 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, "id": "82042fc5-a907-4381-a4b8-eb9386df19cd", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Guide to Jupyter.ipynb day2 EXERCISE.ipynb \u001b[1m\u001b[36msolutions\u001b[m\u001b[m\n", + "Intermediate Python.ipynb day5.ipynb troubleshooting.ipynb\n", + "\u001b[1m\u001b[36mcommunity-contributions\u001b[m\u001b[m diagnostics.py week1 EXERCISE.ipynb\n", + "day1.ipynb notes.mdx\n" + ] + } + ], "source": [ "# list the current directory\n", "\n", @@ -257,10 +268,45 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 5, "id": "4fc3e3da-8a55-40cc-9706-48bf12a0e20e", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "PING cnn.com (151.101.195.5): 56 data bytes\n", + "64 bytes from 151.101.195.5: icmp_seq=0 ttl=56 time=15.914 ms\n", + "64 bytes from 151.101.195.5: icmp_seq=1 ttl=56 time=41.762 ms\n", + "64 bytes from 151.101.195.5: icmp_seq=2 ttl=56 time=82.651 ms\n", + "64 bytes from 151.101.195.5: icmp_seq=3 ttl=56 time=13.553 ms\n", + "64 bytes from 151.101.195.5: icmp_seq=4 ttl=56 time=14.054 ms\n", + "64 bytes from 151.101.195.5: icmp_seq=5 ttl=56 time=13.804 ms\n", + "64 bytes from 151.101.195.5: icmp_seq=6 ttl=56 time=12.579 ms\n", + "64 bytes from 151.101.195.5: icmp_seq=7 ttl=56 time=14.237 ms\n", + "64 bytes from 151.101.195.5: icmp_seq=8 ttl=56 time=11.441 ms\n", + "64 bytes from 151.101.195.5: icmp_seq=9 ttl=56 time=12.085 ms\n", + "64 bytes from 151.101.195.5: icmp_seq=10 ttl=56 time=16.030 ms\n", + "64 bytes from 151.101.195.5: icmp_seq=11 ttl=56 time=16.310 ms\n", + "64 bytes from 151.101.195.5: icmp_seq=12 ttl=56 time=12.209 ms\n", + "64 bytes from 151.101.195.5: icmp_seq=13 ttl=56 time=48.311 ms\n", + "64 bytes from 151.101.195.5: icmp_seq=14 ttl=56 time=95.381 ms\n", + "64 bytes from 151.101.195.5: icmp_seq=15 ttl=56 time=18.853 ms\n", + "64 bytes from 151.101.195.5: icmp_seq=16 ttl=56 time=16.615 ms\n", + "64 bytes from 151.101.195.5: icmp_seq=17 ttl=56 time=13.696 ms\n", + "64 bytes from 151.101.195.5: icmp_seq=18 ttl=56 time=15.165 ms\n", + "64 bytes from 151.101.195.5: icmp_seq=19 ttl=56 time=19.311 ms\n", + "64 bytes from 151.101.195.5: icmp_seq=20 ttl=56 time=15.867 ms\n", + "64 bytes from 151.101.195.5: icmp_seq=21 ttl=56 time=14.687 ms\n", + "^C\n", + "\n", + "--- cnn.com ping statistics ---\n", + "22 packets transmitted, 22 packets received, 0.0% packet loss\n", + "round-trip min/avg/max/stddev = 11.441/24.296/95.381/22.406 ms\n" + ] + } + ], "source": [ "# ping cnn.com - press the stop button in the toolbar when you're bored\n", "\n", @@ -269,10 +315,176 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, "id": "a58e9462-89a2-4b4f-b4aa-51c4bd9f796b", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Retrieving notices: done\n", + "Channels:\n", + " - conda-forge\n", + " - defaults\n", + "Platform: osx-arm64\n", + "Collecting package metadata (repodata.json): done\n", + "Solving environment: done\n", + "\n", + "Downloading and Extracting Packages:\n", + "\n", + "Preparing transaction: done\n", + "Verifying transaction: done\n", + "Executing transaction: done\n", + "Installing pip dependencies: \\ Ran pip subprocess with arguments:\n", + "['/opt/anaconda3/envs/llms/bin/python', '-m', 'pip', 'install', '-U', '-r', '/Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt', '--exists-action=b']\n", + "Pip subprocess output:\n", + "Requirement already satisfied: transformers in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from -r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 1)) (4.46.3)\n", + "Requirement already satisfied: sentence-transformers in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from -r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 2)) (3.3.1)\n", + "Requirement already satisfied: datasets in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from -r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 3)) (3.1.0)\n", + "Requirement already satisfied: accelerate in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from -r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 4)) (1.1.1)\n", + "Requirement already satisfied: sentencepiece in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from -r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 5)) (0.2.0)\n", + "Requirement already satisfied: bitsandbytes in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from -r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 6)) (0.42.0)\n", + "Requirement already satisfied: openai in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from -r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 7)) (1.55.1)\n", + "Collecting openai (from -r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 7))\n", + " Downloading openai-1.55.2-py3-none-any.whl.metadata (24 kB)\n", + "Requirement already satisfied: gradio in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from -r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 8)) (5.6.0)\n", + "Collecting gradio (from -r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 8))\n", + " Downloading gradio-5.7.0-py3-none-any.whl.metadata (16 kB)\n", + "Requirement already satisfied: gensim in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from -r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 9)) (4.3.3)\n", + "Requirement already satisfied: modal in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from -r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 10)) (0.66.44)\n", + "Collecting modal (from -r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 10))\n", + " Downloading modal-0.67.0-py3-none-any.whl.metadata (2.3 kB)\n", + "Requirement already satisfied: ollama in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from -r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 11)) (0.4.1)\n", + "Requirement already satisfied: psutil in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from -r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 12)) (6.1.0)\n", + "Requirement already satisfied: setuptools in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from -r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 13)) (75.6.0)\n", + "Requirement already satisfied: speedtest-cli in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from -r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 14)) (2.1.3)\n", + "Requirement already satisfied: filelock in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from transformers->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 1)) (3.16.1)\n", + "Requirement already satisfied: huggingface-hub<1.0,>=0.23.2 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from transformers->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 1)) (0.26.2)\n", + "Requirement already satisfied: numpy>=1.17 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from transformers->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 1)) (1.26.4)\n", + "Requirement already satisfied: packaging>=20.0 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from transformers->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 1)) (24.2)\n", + "Requirement already satisfied: pyyaml>=5.1 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from transformers->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 1)) (6.0.2)\n", + "Requirement already satisfied: regex!=2019.12.17 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from transformers->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 1)) (2024.11.6)\n", + "Requirement already satisfied: requests in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from transformers->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 1)) (2.32.3)\n", + "Requirement already satisfied: tokenizers<0.21,>=0.20 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from transformers->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 1)) (0.20.3)\n", + "Requirement already satisfied: safetensors>=0.4.1 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from transformers->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 1)) (0.4.5)\n", + "Requirement already satisfied: tqdm>=4.27 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from transformers->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 1)) (4.67.1)\n", + "Requirement already satisfied: torch>=1.11.0 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from sentence-transformers->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 2)) (2.4.1)\n", + "Requirement already satisfied: scikit-learn in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from sentence-transformers->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 2)) (1.5.2)\n", + "Requirement already satisfied: scipy in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from sentence-transformers->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 2)) (1.13.1)\n", + "Requirement already satisfied: Pillow in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from sentence-transformers->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 2)) (11.0.0)\n", + "Requirement already satisfied: pyarrow>=15.0.0 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from datasets->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 3)) (17.0.0)\n", + "Requirement already satisfied: dill<0.3.9,>=0.3.0 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from datasets->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 3)) (0.3.8)\n", + "Requirement already satisfied: pandas in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from datasets->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 3)) (2.2.3)\n", + "Requirement already satisfied: xxhash in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from datasets->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 3)) (3.5.0)\n", + "Requirement already satisfied: multiprocess<0.70.17 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from datasets->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 3)) (0.70.16)\n", + "Requirement already satisfied: fsspec<=2024.9.0,>=2023.1.0 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from fsspec[http]<=2024.9.0,>=2023.1.0->datasets->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 3)) (2024.9.0)\n", + "Requirement already satisfied: aiohttp in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from datasets->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 3)) (3.11.7)\n", + "Requirement already satisfied: anyio<5,>=3.5.0 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from openai->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 7)) (4.6.2.post1)\n", + "Requirement already satisfied: distro<2,>=1.7.0 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from openai->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 7)) (1.9.0)\n", + "Requirement already satisfied: httpx<1,>=0.23.0 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from openai->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 7)) (0.27.2)\n", + "Requirement already satisfied: jiter<1,>=0.4.0 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from openai->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 7)) (0.7.1)\n", + "Requirement already satisfied: pydantic<3,>=1.9.0 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from openai->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 7)) (2.10.1)\n", + "Requirement already satisfied: sniffio in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from openai->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 7)) (1.3.1)\n", + "Requirement already satisfied: typing-extensions<5,>=4.11 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from openai->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 7)) (4.12.2)\n", + "Requirement already satisfied: aiofiles<24.0,>=22.0 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from gradio->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 8)) (23.2.1)\n", + "Requirement already satisfied: fastapi<1.0,>=0.115.2 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from gradio->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 8)) (0.115.5)\n", + "Requirement already satisfied: ffmpy in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from gradio->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 8)) (0.4.0)\n", + "Collecting gradio-client==1.5.0 (from gradio->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 8))\n", + " Downloading gradio_client-1.5.0-py3-none-any.whl.metadata (7.1 kB)\n", + "Requirement already satisfied: jinja2<4.0 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from gradio->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 8)) (3.1.4)\n", + "Requirement already satisfied: markupsafe~=2.0 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from gradio->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 8)) (2.1.5)\n", + "Requirement already satisfied: orjson~=3.0 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from gradio->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 8)) (3.10.12)\n", + "Requirement already satisfied: pydub in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from gradio->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 8)) (0.25.1)\n", + "Requirement already satisfied: python-multipart==0.0.12 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from gradio->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 8)) (0.0.12)\n", + "Requirement already satisfied: ruff>=0.2.2 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from gradio->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 8)) (0.8.0)\n", + "Requirement already satisfied: safehttpx<1.0,>=0.1.1 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from gradio->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 8)) (0.1.1)\n", + "Requirement already satisfied: semantic-version~=2.0 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from gradio->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 8)) (2.10.0)\n", + "Requirement already satisfied: starlette<1.0,>=0.40.0 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from gradio->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 8)) (0.41.3)\n", + "Requirement already satisfied: tomlkit==0.12.0 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from gradio->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 8)) (0.12.0)\n", + "Requirement already satisfied: typer<1.0,>=0.12 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from gradio->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 8)) (0.13.1)\n", + "Requirement already satisfied: uvicorn>=0.14.0 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from gradio->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 8)) (0.32.1)\n", + "Requirement already satisfied: websockets<13.0,>=10.0 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from gradio-client==1.5.0->gradio->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 8)) (12.0)\n", + "Requirement already satisfied: smart-open>=1.8.1 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from gensim->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 9)) (7.0.5)\n", + "Requirement already satisfied: certifi in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from modal->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 10)) (2024.8.30)\n", + "Requirement already satisfied: click>=8.1.0 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from modal->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 10)) (8.1.7)\n", + "Requirement already satisfied: grpclib==0.4.7 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from modal->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 10)) (0.4.7)\n", + "Requirement already satisfied: protobuf!=4.24.0,<6.0,>=3.19 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from modal->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 10)) (4.25.3)\n", + "Requirement already satisfied: rich>=12.0.0 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from modal->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 10)) (13.9.4)\n", + "Requirement already satisfied: synchronicity~=0.9.3 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from modal->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 10)) (0.9.3)\n", + "Requirement already satisfied: toml in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from modal->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 10)) (0.10.2)\n", + "Requirement already satisfied: types-certifi in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from modal->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 10)) (2021.10.8.3)\n", + "Requirement already satisfied: types-toml in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from modal->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 10)) (0.10.8.20240310)\n", + "Requirement already satisfied: watchfiles in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from modal->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 10)) (0.24.0)\n", + "Requirement already satisfied: h2<5,>=3.1.0 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from grpclib==0.4.7->modal->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 10)) (4.1.0)\n", + "Requirement already satisfied: multidict in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from grpclib==0.4.7->modal->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 10)) (6.1.0)\n", + "Requirement already satisfied: idna>=2.8 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from anyio<5,>=3.5.0->openai->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 7)) (3.10)\n", + "Requirement already satisfied: aiohappyeyeballs>=2.3.0 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from aiohttp->datasets->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 3)) (2.4.3)\n", + "Requirement already satisfied: aiosignal>=1.1.2 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from aiohttp->datasets->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 3)) (1.3.1)\n", + "Requirement already satisfied: attrs>=17.3.0 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from aiohttp->datasets->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 3)) (24.2.0)\n", + "Requirement already satisfied: frozenlist>=1.1.1 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from aiohttp->datasets->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 3)) (1.5.0)\n", + "Requirement already satisfied: propcache>=0.2.0 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from aiohttp->datasets->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 3)) (0.2.0)\n", + "Requirement already satisfied: yarl<2.0,>=1.17.0 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from aiohttp->datasets->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 3)) (1.18.0)\n", + "Requirement already satisfied: httpcore==1.* in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from httpx<1,>=0.23.0->openai->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 7)) (1.0.7)\n", + "Requirement already satisfied: h11<0.15,>=0.13 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from httpcore==1.*->httpx<1,>=0.23.0->openai->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 7)) (0.14.0)\n", + "Requirement already satisfied: python-dateutil>=2.8.2 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from pandas->datasets->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 3)) (2.9.0.post0)\n", + "Requirement already satisfied: pytz>=2020.1 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from pandas->datasets->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 3)) (2024.1)\n", + "Requirement already satisfied: tzdata>=2022.7 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from pandas->datasets->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 3)) (2024.2)\n", + "Requirement already satisfied: annotated-types>=0.6.0 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from pydantic<3,>=1.9.0->openai->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 7)) (0.7.0)\n", + "Requirement already satisfied: pydantic-core==2.27.1 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from pydantic<3,>=1.9.0->openai->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 7)) (2.27.1)\n", + "Requirement already satisfied: charset-normalizer<4,>=2 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from requests->transformers->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 1)) (3.4.0)\n", + "Requirement already satisfied: urllib3<3,>=1.21.1 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from requests->transformers->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 1)) (2.2.3)\n", + "Requirement already satisfied: markdown-it-py>=2.2.0 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from rich>=12.0.0->modal->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 10)) (3.0.0)\n", + "Requirement already satisfied: pygments<3.0.0,>=2.13.0 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from rich>=12.0.0->modal->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 10)) (2.18.0)\n", + "Requirement already satisfied: wrapt in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from smart-open>=1.8.1->gensim->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 9)) (1.17.0)\n", + "Requirement already satisfied: sigtools>=4.0.1 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from synchronicity~=0.9.3->modal->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 10)) (4.0.1)\n", + "Requirement already satisfied: sympy in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from torch>=1.11.0->sentence-transformers->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 2)) (1.13.3)\n", + "Requirement already satisfied: networkx in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from torch>=1.11.0->sentence-transformers->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 2)) (3.4.2)\n", + "Requirement already satisfied: shellingham>=1.3.0 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from typer<1.0,>=0.12->gradio->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 8)) (1.5.4)\n", + "Requirement already satisfied: joblib>=1.2.0 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from scikit-learn->sentence-transformers->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 2)) (1.4.2)\n", + "Requirement already satisfied: threadpoolctl>=3.1.0 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from scikit-learn->sentence-transformers->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 2)) (3.5.0)\n", + "Requirement already satisfied: hyperframe<7,>=6.0 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from h2<5,>=3.1.0->grpclib==0.4.7->modal->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 10)) (6.0.1)\n", + "Requirement already satisfied: hpack<5,>=4.0 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from h2<5,>=3.1.0->grpclib==0.4.7->modal->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 10)) (4.0.0)\n", + "Requirement already satisfied: mdurl~=0.1 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from markdown-it-py>=2.2.0->rich>=12.0.0->modal->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 10)) (0.1.2)\n", + "Requirement already satisfied: six>=1.5 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from python-dateutil>=2.8.2->pandas->datasets->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 3)) (1.16.0)\n", + "Requirement already satisfied: mpmath<1.4,>=1.1.0 in /opt/anaconda3/envs/llms/lib/python3.11/site-packages (from sympy->torch>=1.11.0->sentence-transformers->-r /Users/xiangyu/repos/llm_engineering/condaenv.u2f__0c0.requirements.txt (line 2)) (1.3.0)\n", + "Downloading openai-1.55.2-py3-none-any.whl (389 kB)\n", + "Downloading gradio-5.7.0-py3-none-any.whl (57.1 MB)\n", + "\u001b[2K \u001b[38;2;114;156;31m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m57.1/57.1 MB\u001b[0m \u001b[31m76.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m MB/s\u001b[0m eta \u001b[36m0:00:01\u001b[0m\n", + "\u001b[?25hDownloading gradio_client-1.5.0-py3-none-any.whl (320 kB)\n", + "Downloading modal-0.67.0-py3-none-any.whl (487 kB)\n", + "Installing collected packages: openai, gradio-client, modal, gradio\n", + " Attempting uninstall: openai\n", + " Found existing installation: openai 1.55.1\n", + " Uninstalling openai-1.55.1:\n", + " Successfully uninstalled openai-1.55.1\n", + " Attempting uninstall: gradio-client\n", + " Found existing installation: gradio_client 1.4.3\n", + " Uninstalling gradio_client-1.4.3:\n", + " Successfully uninstalled gradio_client-1.4.3\n", + " Attempting uninstall: modal\n", + " Found existing installation: modal 0.66.44\n", + " Uninstalling modal-0.66.44:\n", + " Successfully uninstalled modal-0.66.44\n", + " Attempting uninstall: gradio\n", + " Found existing installation: gradio 5.6.0\n", + " Uninstalling gradio-5.6.0:\n", + " Successfully uninstalled gradio-5.6.0\n", + "Successfully installed gradio-5.7.0 gradio-client-1.5.0 modal-0.67.0 openai-1.55.2\n", + "\n", + "done\n", + "#\n", + "# To activate this environment, use\n", + "#\n", + "# $ conda activate llms\n", + "#\n", + "# To deactivate an active environment, use\n", + "#\n", + "# $ conda deactivate\n", + "\n" + ] + } + ], "source": [ "# This is a useful command that ensures your Anaconda environment \n", "# is up to date with any new upgrades to packages;\n", @@ -295,7 +507,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "id": "2646a4e5-3c23-4aee-a34d-d623815187d2", "metadata": {}, "outputs": [], @@ -313,10 +525,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "id": "6e96be3d-fa82-42a3-a8aa-b81dd20563a5", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "100%|███████████████████████████████████████████████████████| 1000/1000 [00:12<00:00, 82.79it/s]\n" + ] + } + ], "source": [ "# And now, with a nice little progress bar:\n", "\n", @@ -331,10 +551,27 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "id": "63c788dd-4618-4bb4-a5ce-204411a38ade", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/markdown": [ + "# This is a big heading!\n", + "\n", + "- And this is a bullet-point\n", + "- So is this\n", + "- Me, too!" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ "# On a different topic, here's a useful way to print output in markdown\n", "\n", diff --git a/week1/day1.ipynb b/week1/day1.ipynb index 4688043..1b9fa2d 100644 --- a/week1/day1.ipynb +++ b/week1/day1.ipynb @@ -69,7 +69,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, "id": "4e2a9393-7767-488e-a8bf-27c12dca35bd", "metadata": {}, "outputs": [], @@ -89,7 +89,9 @@ { "cell_type": "markdown", "id": "6900b2a8-6384-4316-8aaa-5e519fca4254", - "metadata": {}, + "metadata": { + "jp-MarkdownHeadingCollapsed": true + }, "source": [ "# Connecting to OpenAI\n", "\n", @@ -108,10 +110,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 5, "id": "7b87cadb-d513-4303-baee-a37b6f938e4d", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "API key found and looks good so far!\n" + ] + } + ], "source": [ "# Load environment variables in a file called .env\n", "\n", @@ -132,7 +142,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, "id": "019974d9-f3ad-4a8a-b5f9-0a3719aea2d3", "metadata": {}, "outputs": [], @@ -146,7 +156,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 7, "id": "c5e793b2-6775-426a-a139-4848291d0463", "metadata": {}, "outputs": [], @@ -171,10 +181,63 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 8, "id": "2ef960cf-6dc2-4cda-afb3-b38be12f4c97", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Home - Edward Donner\n", + "Home\n", + "Outsmart\n", + "An arena that pits LLMs against each other in a battle of diplomacy and deviousness\n", + "About\n", + "Posts\n", + "Well, hi there.\n", + "I’m Ed. I like writing code and experimenting with LLMs, and hopefully you’re here because you do too. I also enjoy DJing (but I’m badly out of practice), amateur electronic music production (\n", + "very\n", + "amateur) and losing myself in\n", + "Hacker News\n", + ", nodding my head sagely to things I only half understand.\n", + "I’m the co-founder and CTO of\n", + "Nebula.io\n", + ". We’re applying AI to a field where it can make a massive, positive impact: helping people discover their potential and pursue their reason for being. Recruiters use our product today to source, understand, engage and manage talent. I’m previously the founder and CEO of AI startup untapt,\n", + "acquired in 2021\n", + ".\n", + "We work with groundbreaking, proprietary LLMs verticalized for talent, we’ve\n", + "patented\n", + "our matching model, and our award-winning platform has happy customers and tons of press coverage.\n", + "Connect\n", + "with me for more!\n", + "November 13, 2024\n", + "Mastering AI and LLM Engineering – Resources\n", + "October 16, 2024\n", + "From Software Engineer to AI Data Scientist – resources\n", + "August 6, 2024\n", + "Outsmart LLM Arena – a battle of diplomacy and deviousness\n", + "June 26, 2024\n", + "Choosing the Right LLM: Toolkit and Resources\n", + "Navigation\n", + "Home\n", + "Outsmart\n", + "An arena that pits LLMs against each other in a battle of diplomacy and deviousness\n", + "About\n", + "Posts\n", + "Get in touch\n", + "ed [at] edwarddonner [dot] com\n", + "www.edwarddonner.com\n", + "Follow me\n", + "LinkedIn\n", + "Twitter\n", + "Facebook\n", + "Subscribe to newsletter\n", + "Type your email…\n", + "Subscribe\n" + ] + } + ], "source": [ "# Let's try one out. Change the website and add print statements to follow along.\n", "\n", @@ -203,7 +266,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 9, "id": "abdb8417-c5dc-44bc-9bee-2e059d162699", "metadata": {}, "outputs": [], @@ -217,7 +280,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 10, "id": "f0275b1b-7cfe-4f9d-abfa-7650d378da0c", "metadata": {}, "outputs": [], @@ -235,10 +298,65 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 11, "id": "26448ec4-5c00-4204-baec-7df91d11ff2e", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "You are looking at a website titled Home - Edward Donner\n", + "The contents of this website is as follows; please provide a short summary of this website in markdown. If it includes news or announcements, then summarize these too.\n", + "\n", + "Home\n", + "Outsmart\n", + "An arena that pits LLMs against each other in a battle of diplomacy and deviousness\n", + "About\n", + "Posts\n", + "Well, hi there.\n", + "I’m Ed. I like writing code and experimenting with LLMs, and hopefully you’re here because you do too. I also enjoy DJing (but I’m badly out of practice), amateur electronic music production (\n", + "very\n", + "amateur) and losing myself in\n", + "Hacker News\n", + ", nodding my head sagely to things I only half understand.\n", + "I’m the co-founder and CTO of\n", + "Nebula.io\n", + ". We’re applying AI to a field where it can make a massive, positive impact: helping people discover their potential and pursue their reason for being. Recruiters use our product today to source, understand, engage and manage talent. I’m previously the founder and CEO of AI startup untapt,\n", + "acquired in 2021\n", + ".\n", + "We work with groundbreaking, proprietary LLMs verticalized for talent, we’ve\n", + "patented\n", + "our matching model, and our award-winning platform has happy customers and tons of press coverage.\n", + "Connect\n", + "with me for more!\n", + "November 13, 2024\n", + "Mastering AI and LLM Engineering – Resources\n", + "October 16, 2024\n", + "From Software Engineer to AI Data Scientist – resources\n", + "August 6, 2024\n", + "Outsmart LLM Arena – a battle of diplomacy and deviousness\n", + "June 26, 2024\n", + "Choosing the Right LLM: Toolkit and Resources\n", + "Navigation\n", + "Home\n", + "Outsmart\n", + "An arena that pits LLMs against each other in a battle of diplomacy and deviousness\n", + "About\n", + "Posts\n", + "Get in touch\n", + "ed [at] edwarddonner [dot] com\n", + "www.edwarddonner.com\n", + "Follow me\n", + "LinkedIn\n", + "Twitter\n", + "Facebook\n", + "Subscribe to newsletter\n", + "Type your email…\n", + "Subscribe\n" + ] + } + ], "source": [ "print(user_prompt_for(ed))" ] @@ -262,7 +380,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 12, "id": "0134dfa4-8299-48b5-b444-f2a8c3403c88", "metadata": {}, "outputs": [], @@ -278,10 +396,24 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 13, "id": "36478464-39ee-485c-9f3f-6a4e458dbc9c", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "[{'role': 'system',\n", + " 'content': 'You are an assistant that analyzes the contents of a website and provides a short summary, ignoring text that might be navigation related. Respond in markdown.'},\n", + " {'role': 'user',\n", + " 'content': 'You are looking at a website titled Home - Edward Donner\\nThe contents of this website is as follows; please provide a short summary of this website in markdown. If it includes news or announcements, then summarize these too.\\n\\nHome\\nOutsmart\\nAn arena that pits LLMs against each other in a battle of diplomacy and deviousness\\nAbout\\nPosts\\nWell, hi there.\\nI’m Ed. I like writing code and experimenting with LLMs, and hopefully you’re here because you do too. I also enjoy DJing (but I’m badly out of practice), amateur electronic music production (\\nvery\\namateur) and losing myself in\\nHacker News\\n, nodding my head sagely to things I only half understand.\\nI’m the co-founder and CTO of\\nNebula.io\\n. We’re applying AI to a field where it can make a massive, positive impact: helping people discover their potential and pursue their reason for being. Recruiters use our product today to source, understand, engage and manage talent. I’m previously the founder and CEO of AI startup untapt,\\nacquired in 2021\\n.\\nWe work with groundbreaking, proprietary LLMs verticalized for talent, we’ve\\npatented\\nour matching model, and our award-winning platform has happy customers and tons of press coverage.\\nConnect\\nwith me for more!\\nNovember 13, 2024\\nMastering AI and LLM Engineering – Resources\\nOctober 16, 2024\\nFrom Software Engineer to AI Data Scientist – resources\\nAugust 6, 2024\\nOutsmart LLM Arena – a battle of diplomacy and deviousness\\nJune 26, 2024\\nChoosing the Right LLM: Toolkit and Resources\\nNavigation\\nHome\\nOutsmart\\nAn arena that pits LLMs against each other in a battle of diplomacy and deviousness\\nAbout\\nPosts\\nGet in touch\\ned [at] edwarddonner [dot] com\\nwww.edwarddonner.com\\nFollow me\\nLinkedIn\\nTwitter\\nFacebook\\nSubscribe to newsletter\\nType your email…\\nSubscribe'}]" + ] + }, + "execution_count": 13, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# Try this out, and then try for a few more websites\n", "\n", @@ -298,7 +430,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 14, "id": "905b9919-aba7-45b5-ae65-81b3d1d78e34", "metadata": {}, "outputs": [], @@ -316,17 +448,28 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 15, "id": "05e38d41-dfa4-4b20-9c96-c46ea75d9fb5", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "\"# Summary of Edward Donner's Website\\n\\nEdward Donner's website serves as a personal and professional platform where he shares his interests in programming, experimenting with large language models (LLMs), and electronic music. As the co-founder and CTO of Nebula.io, he focuses on utilizing AI to positively impact talent discovery and management. Previously, he founded the AI startup untapt, which was acquired in 2021.\\n\\n## Recent Posts\\n- **November 13, 2024**: **Mastering AI and LLM Engineering – Resources** \\n Resources aimed at improving skills in AI and LLM engineering.\\n\\n- **October 16, 2024**: **From Software Engineer to AI Data Scientist – resources** \\n Guidance and resources for transitioning careers into AI data science.\\n\\n- **August 6, 2024**: **Outsmart LLM Arena – a battle of diplomacy and deviousness** \\n Details about a platform that challenges LLMs in a competitive arena setting.\\n\\n- **June 26, 2024**: **Choosing the Right LLM: Toolkit and Resources** \\n Resources and tools for selecting the appropriate LLM for specific needs. \\n\\nThe website emphasizes educational resources and advancements in AI, along with a personal touch reflecting Donner's diverse interests.\"" + ] + }, + "execution_count": 15, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "summarize(\"https://edwarddonner.com\")" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 16, "id": "3d926d59-450e-4609-92ba-2d6f244f1342", "metadata": {}, "outputs": [], @@ -340,10 +483,33 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 17, "id": "3018853a-445f-41ff-9560-d925d1774b2f", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/markdown": [ + "# Summary of Edward Donner's Website\n", + "\n", + "Edward Donner's website showcases his interests and projects primarily focused on Large Language Models (LLMs) and AI. Ed, the site's owner, is the co-founder and CTO of Nebula.io, an AI-driven company that aids talent discovery and recruitment. His platform employs innovative LLMs and has gained recognition in the industry.\n", + "\n", + "### Notable Announcements and Posts:\n", + "- **Mastering AI and LLM Engineering – Resources** (November 13, 2024)\n", + "- **From Software Engineer to AI Data Scientist – Resources** (October 16, 2024)\n", + "- **Outsmart LLM Arena – A Battle of Diplomacy and Deviousness** (August 6, 2024)\n", + "- **Choosing the Right LLM: Toolkit and Resources** (June 26, 2024)\n", + "\n", + "Ed expresses a passion for coding, music, and engaging with the tech community. He encourages connections with like-minded individuals." + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ "display_summary(\"https://edwarddonner.com\")" ] @@ -366,20 +532,75 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 18, "id": "45d83403-a24c-44b5-84ac-961449b4008f", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/markdown": [ + "# Summary of CNN Website\n", + "\n", + "CNN's website serves as a comprehensive news platform, providing a variety of content categories including U.S. news, world news, politics, business, health, entertainment, sports, science, and more. The site emphasizes breaking news updates and features a range of videos and articles that address current events and significant topics.\n", + "\n", + "### Key Recent Headlines\n", + "- **Trump Vows Tariffs**: Trump has pledged to impose a 25% tariff on goods from Mexico and Canada from his first day in office, which could disrupt supply chains significantly.\n", + "- **Winter Storm Alerts**: A Thanksgiving weekend winter storm is forecasted to bring severe weather to the East Coast, with suggestions for travelers on dealing with flight cancellations.\n", + "- **Business Updates**: Notable changes in business leadership include Kohl’s CEO stepping down and Macy’s uncovering hidden expenses attributed to an employee.\n", + "- **Crime and Justice**: A judge has rejected a request to sideline a transgender volleyball player at San Jose State, showcasing ongoing legal challenges around transgender rights in sports.\n", + "\n", + "### Featured Topics\n", + "- **International Conflicts**: Ongoing coverage of the Ukraine-Russia and Israel-Hamas wars.\n", + "- **Health**: Articles exploring the implications of a popular financial rule for retirement, alongside lifestyle tips for healthier living during holiday travel.\n", + "- **Pop Culture**: Insights into entertainment topics including celebrity news, upcoming movies, and holiday viewing recommendations.\n", + "\n", + "Overall, CNN remains a leading source for immediate news updates and in-depth analysis across a wide array of subjects." + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ "display_summary(\"https://cnn.com\")" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 19, "id": "75e9fd40-b354-4341-991e-863ef2e59db7", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/markdown": [ + "# Summary of Anthropic Website\n", + "\n", + "Anthropic is an AI research and safety company based in San Francisco, focused on creating beneficial and reliable AI systems. The website features information about their main AI model, Claude, with the latest version being Claude 3.5 Sonnet and the introduction of Claude 3.5 Haiku.\n", + "\n", + "## Key Highlights:\n", + "- **Claude 3.5 Sonnet**: The most advanced AI model available to users.\n", + "- **API Access**: Businesses can leverage Claude to enhance operational efficiency and explore new revenue opportunities.\n", + "- **Recent Announcements**:\n", + " - **New Model Releases**: On October 22, 2024, Anthropic introduced Claude 3.5 Sonnet and Haiku.\n", + " - **Enterprise Solutions**: On September 4, 2024, they highlighted Claude's capabilities for enterprise applications.\n", + "\n", + "## Research Focus:\n", + "Anthropic emphasizes its commitment to AI safety through ongoing research and development, including topics such as Constitutional AI aimed at ensuring harmlessness through AI feedback.\n", + "\n", + "The company invites talent in various fields, reflecting a diverse and interdisciplinary team specialized in machine learning, policy, and other relevant domains." + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ "display_summary(\"https://anthropic.com\")" ] diff --git a/week1/day2 EXERCISE.ipynb b/week1/day2 EXERCISE.ipynb index 6bdbde5..fa61327 100644 --- a/week1/day2 EXERCISE.ipynb +++ b/week1/day2 EXERCISE.ipynb @@ -68,7 +68,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "id": "4e2a9393-7767-488e-a8bf-27c12dca35bd", "metadata": {}, "outputs": [], @@ -82,7 +82,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "id": "29ddd15d-a3c5-4f4e-a678-873f56162724", "metadata": {}, "outputs": [], @@ -96,7 +96,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "id": "dac0a679-599c-441f-9bf2-ddc73d35b940", "metadata": {}, "outputs": [], @@ -110,7 +110,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, "id": "7bb9c624-14f0-4945-a719-8ddb64f66f47", "metadata": {}, "outputs": [], @@ -124,10 +124,47 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 5, "id": "42b9f644-522d-4e05-a691-56e7658c0ea9", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Generative AI has numerous business applications across various industries, including:\n", + "\n", + "1. **Content Creation**: Generative AI can be used to generate high-quality content such as articles, social media posts, product descriptions, and even entire books. This can help businesses save time and resources while maintaining consistency in their content.\n", + "2. **Image and Video Generation**: Generative AI can create realistic images and videos for various purposes, such as:\n", + " * Product visualization: Generate 3D models or animations to showcase products in different scenarios.\n", + " * Advertising: Create custom graphics, billboards, or social media ads with unique visuals.\n", + " * Training simulations: Develop realistic training simulations for employees, customers, or patients.\n", + "3. **Marketing and Advertising**: Generative AI can help businesses:\n", + " * Personalize ads: Generate targeted ads based on customer preferences, behavior, and demographics.\n", + " * Improve product recommendation engines: Create personalized recommendations using generative models.\n", + " * Automate social media management: Generate social media posts, engage with customers, and monitor online conversations.\n", + "4. **Product Design**: Generative AI can aid in:\n", + " * Product design: Generate 3D models, prototypes, or design concepts for new products.\n", + " * Fashion design: Create custom clothing, accessories, or interior designs using generative algorithms.\n", + "5. **Customer Service**: Generative AI can help businesses:\n", + " * Automate customer support chatbots: Use generative models to respond to customer inquiries and resolve issues.\n", + " * Generate personalized customer experiences: Develop customized content, offers, or recommendations based on customer behavior and preferences.\n", + "6. **Audio and Music Generation**: Generative AI can be used to create:\n", + " * Original music compositions: Compose unique music tracks for ads, videos, or films.\n", + " * Podcasts and audiobooks: Generate custom audio content for businesses or clients.\n", + "7. **Data Augmentation**: Generative AI can help businesses augment their datasets by generating new data points, which can improve the accuracy of machine learning models.\n", + "8. **Supply Chain Optimization**: Generative AI can be used to:\n", + " * Predict demand: Use generative models to forecast demand and optimize inventory levels.\n", + " * Optimize logistics: Generate routes, schedules, or shipping plans using generative algorithms.\n", + "9. **Financial Modeling**: Generative AI can help businesses create more accurate financial models by generating new scenarios, forecasts, or predictions based on historical data.\n", + "10. **Innovation**: Generative AI can facilitate innovation in various industries by:\n", + " * Generating new product ideas: Use generative models to come up with novel products or services.\n", + " * Developing new business strategies: Create customized plans and proposals for clients using generative algorithms.\n", + "\n", + "These are just a few examples of the many business applications of Generative AI. As the technology continues to evolve, we can expect to see even more innovative uses in various industries.\n" + ] + } + ], "source": [ "response = requests.post(OLLAMA_API, json=payload, headers=HEADERS)\n", "print(response.json()['message']['content'])" diff --git a/week1/day5.ipynb b/week1/day5.ipynb index 037e278..db48a7e 100644 --- a/week1/day5.ipynb +++ b/week1/day5.ipynb @@ -22,7 +22,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "id": "d5b08506-dc8b-4443-9201-5f1848161363", "metadata": {}, "outputs": [], @@ -42,10 +42,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "id": "fc5d8880-f2ee-4c06-af16-ecbc0262af61", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "API key looks good so far\n" + ] + } + ], "source": [ "# Initialize and constants\n", "\n", diff --git a/week1/notes.mdx b/week1/notes.mdx new file mode 100644 index 0000000..7e4b1db --- /dev/null +++ b/week1/notes.mdx @@ -0,0 +1,2 @@ +LLM Leaderboard +https://www.vellum.ai/llm-leaderboard diff --git a/week8/day1.ipynb b/week8/day1.ipynb index 4e5f0ab..1177edc 100644 --- a/week8/day1.ipynb +++ b/week8/day1.ipynb @@ -40,7 +40,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "id": "bc0e1c1c-be6a-4395-bbbd-eeafc9330d7e", "metadata": {}, "outputs": [], @@ -69,18 +69,38 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "id": "0d240622-8422-4c99-8464-c04d063e4cb6", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\u001b[2KThe web browser should have opened for you to authenticate and get an API token.\n", + "If it didn't, please copy this URL into your web browser manually:\n", + "\n", + "\u001b[2K\u001b]8;id=988175;https://modal.com/token-flow/tf-4OQWCx9ehoVgotEYIiHbIY\u001b\\\u001b[4;94mhttps://modal.com/token-flow/tf-4OQWCx9ehoVgotEYIiHbIY\u001b[0m\u001b]8;;\u001b\\\n", + "\n", + "\u001b[2K\u001b[32m⠙\u001b[0m Waiting for authentication in the web browser\n", + "\u001b[2K\u001b[32m⠧\u001b[0m Waiting for token flow to complete...omplete...\n", + "\u001b[1A\u001b[2K\u001b[32mWeb authentication finished successfully!\u001b[0m\n", + "\u001b[32mToken is connected to the \u001b[0m\u001b[35mxykong36\u001b[0m\u001b[32m workspace.\u001b[0m\n", + "Verifying token against \u001b[4;34mhttps://api.modal.com\u001b[0m\n", + "\u001b[32mToken verified successfully!\u001b[0m\n", + "\u001b[?25l\u001b[32m⠋\u001b[0m Storing token\n", + "\u001b[1A\u001b[2K\u001b[32mToken written to \u001b[0m\u001b[35m/Users/xiangyu/\u001b[0m\u001b[35m.modal.toml\u001b[0m\u001b[32m in profile \u001b[0m\u001b[35mxykong36\u001b[0m\u001b[32m.\u001b[0m\n" + ] + } + ], "source": [ "# Remove the '# ' from the next line and run the cell\n", - "# !modal setup" + "!modal setup" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "id": "3b133701-f550-44a1-a67f-eb7ccc4769a9", "metadata": {}, "outputs": [], @@ -90,28 +110,160 @@ }, { "cell_type": "code", - "execution_count": null, - "id": "0f3f73ae-1295-49f3-9099-b8b41fc3429b", + "execution_count": 10, + "id": "7bf9cecb-f837-458d-afdf-1b925c89b4eb", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\u001b[2KThe web browser should have opened for you to authenticate and get an API token.\n", + "If it didn't, please copy this URL into your web browser manually:\n", + "\n", + "\u001b[2K\u001b]8;id=706003;https://modal.com/token-flow/tf-lfGsLFXreoimWW1H3W4E4A\u001b\\\u001b[4;94mhttps://modal.com/token-flow/tf-lfGsLFXreoimWW1H3W4E4A\u001b[0m\u001b]8;;\u001b\\\n", + "\n", + "\u001b[2K\u001b[32m⠋\u001b[0m Waiting for authentication in the web browser\n", + "\u001b[2K\u001b[32m⠙\u001b[0m Waiting for token flow to complete...omplete...\n", + "\u001b[1A\u001b[2K\u001b[32mWeb authentication finished successfully!\u001b[0m\n", + "\u001b[32mToken is connected to the \u001b[0m\u001b[35mxykong36\u001b[0m\u001b[32m workspace.\u001b[0m\n", + "Verifying token against \u001b[4;34mhttps://api.modal.com\u001b[0m\n", + "\u001b[32mToken verified successfully!\u001b[0m\n", + "\u001b[?25l\u001b[32m⠋\u001b[0m Storing token\n", + "\u001b[1A\u001b[2K\u001b[32mToken written to \u001b[0m\u001b[35m/Users/xiangyu/\u001b[0m\u001b[35m.modal.toml\u001b[0m\u001b[32m in profile \u001b[0m\u001b[35mxykong36\u001b[0m\u001b[32m.\u001b[0m\n" + ] + } + ], + "source": [ + "!modal token new" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "id": "8cff4180-24b9-4eba-8198-8c84f7359e72", "metadata": {}, "outputs": [], "source": [ - "with app.run(show_progress=False):\n", + "import os\n", + "os.environ[\"MODAL_TOKEN_ID\"] = \"ak-KaDVhGcPs78noFTPmU0Ef6\"\n", + "os.environ[\"MODAL_TOKEN_SECRET\"] = \"as-xy7sk1qvTN00oBtIJC6zto\"" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "id": "0f3f73ae-1295-49f3-9099-b8b41fc3429b", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'Hello from Charlotte, North Carolina, US!!'" + ] + }, + "execution_count": 15, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "with app.run():\n", " reply=hello.local()\n", "reply" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 20, "id": "c1d8c6f9-edc7-4e52-9b3a-c07d7cff1ac7", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/opt/anaconda3/envs/llms/lib/python3.11/contextlib.py:210: DeprecationError: 2024-11-20: `show_progress=False` is deprecated (and has no effect)\n", + " return await anext(self.gen)\n" + ] + }, + { + "ename": "ExecutionError", + "evalue": "Function has not been hydrated with the metadata it needs to run on Modal, because the App it is defined on is not running.", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mExecutionError\u001b[0m Traceback (most recent call last)", + "Cell \u001b[0;32mIn[20], line 2\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m app\u001b[38;5;241m.\u001b[39mrun(show_progress\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mFalse\u001b[39;00m):\n\u001b[0;32m----> 2\u001b[0m reply\u001b[38;5;241m=\u001b[39m\u001b[43mhello\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mremote\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 3\u001b[0m reply\n", + "File \u001b[0;32m/opt/anaconda3/envs/llms/lib/python3.11/site-packages/synchronicity/synchronizer.py:593\u001b[0m, in \u001b[0;36mSynchronizer._wrap_proxy_method..proxy_method\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 591\u001b[0m instance \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m\u001b[38;5;18m__dict__\u001b[39m[synchronizer_self\u001b[38;5;241m.\u001b[39m_original_attr]\n\u001b[1;32m 592\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 593\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mwrapped_method\u001b[49m\u001b[43m(\u001b[49m\u001b[43minstance\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 594\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m UserCodeException \u001b[38;5;28;01mas\u001b[39;00m uc_exc:\n\u001b[1;32m 595\u001b[0m uc_exc\u001b[38;5;241m.\u001b[39mexc\u001b[38;5;241m.\u001b[39m__suppress_context__ \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mTrue\u001b[39;00m\n", + "File \u001b[0;32m/opt/anaconda3/envs/llms/lib/python3.11/site-packages/synchronicity/combined_types.py:29\u001b[0m, in \u001b[0;36mFunctionWithAio.__call__\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 27\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m UserCodeException \u001b[38;5;28;01mas\u001b[39;00m uc_exc:\n\u001b[1;32m 28\u001b[0m uc_exc\u001b[38;5;241m.\u001b[39mexc\u001b[38;5;241m.\u001b[39m__suppress_context__ \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mTrue\u001b[39;00m\n\u001b[0;32m---> 29\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m uc_exc\u001b[38;5;241m.\u001b[39mexc\n", + "File \u001b[0;32m/opt/anaconda3/envs/llms/lib/python3.11/site-packages/modal/object.py:251\u001b[0m, in \u001b[0;36mlive_method..wrapped\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 249\u001b[0m \u001b[38;5;129m@wraps\u001b[39m(method)\n\u001b[1;32m 250\u001b[0m \u001b[38;5;28;01masync\u001b[39;00m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mwrapped\u001b[39m(\u001b[38;5;28mself\u001b[39m, \u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs):\n\u001b[0;32m--> 251\u001b[0m \u001b[38;5;28;01mawait\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mresolve()\n\u001b[1;32m 252\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;01mawait\u001b[39;00m method(\u001b[38;5;28mself\u001b[39m, \u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs)\n", + "File \u001b[0;32m/opt/anaconda3/envs/llms/lib/python3.11/site-packages/modal/object.py:237\u001b[0m, in \u001b[0;36m_Object.resolve\u001b[0;34m(self, client)\u001b[0m\n\u001b[1;32m 235\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m\n\u001b[1;32m 236\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_hydrate_lazily:\n\u001b[0;32m--> 237\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_validate_is_hydrated\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 238\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 239\u001b[0m \u001b[38;5;66;03m# TODO: this client and/or resolver can't be changed by a caller to X.from_name()\u001b[39;00m\n\u001b[1;32m 240\u001b[0m c \u001b[38;5;241m=\u001b[39m client \u001b[38;5;28;01mif\u001b[39;00m client \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 \u001b[38;5;28;01mawait\u001b[39;00m _Client\u001b[38;5;241m.\u001b[39mfrom_env()\n", + "File \u001b[0;32m/opt/anaconda3/envs/llms/lib/python3.11/site-packages/modal/object.py:132\u001b[0m, in \u001b[0;36m_Object._validate_is_hydrated\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 129\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 130\u001b[0m \u001b[38;5;66;03m# Technically possible, but with an ambiguous cause.\u001b[39;00m\n\u001b[1;32m 131\u001b[0m reason \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m--> 132\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m ExecutionError(\n\u001b[1;32m 133\u001b[0m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mobject_type\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m has not been hydrated with the metadata it needs to run on Modal\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mreason\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m.\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 134\u001b[0m )\n", + "\u001b[0;31mExecutionError\u001b[0m: Function has not been hydrated with the metadata it needs to run on Modal, because the App it is defined on is not running." + ] + } + ], "source": [ "with app.run(show_progress=False):\n", " reply=hello.remote()\n", "reply" ] }, + { + "cell_type": "code", + "execution_count": 17, + "id": "45e59cca-a279-437c-ad29-718d61befde1", + "metadata": {}, + "outputs": [], + "source": [ + "import sys\n", + "\n", + "import modal\n", + "\n", + "app = modal.App(\"example-hello-world\")\n" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "id": "b2089850-5eb2-4be2-8a1f-398d8cea71c9", + "metadata": {}, + "outputs": [], + "source": [ + "@app.function()\n", + "def f(i):\n", + " if i % 2 == 0:\n", + " print(\"hello\", i)\n", + " else:\n", + " print(\"world\", i, file=sys.stderr)\n", + "\n", + " return i * i" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "id": "ec242385-7c8a-4732-ba45-487aeaa1571b", + "metadata": {}, + "outputs": [], + "source": [ + "@app.local_entrypoint()\n", + "def main():\n", + " # run the function locally\n", + " print(f.local(1000))\n", + "\n", + " # run the function remotely on Modal\n", + " print(f.remote(1000))\n", + "\n", + " # run the function in parallel and remotely on Modal\n", + " total = 0\n", + " for ret in f.map(range(200)):\n", + " total += ret\n", + "\n", + " print(total)" + ] + }, { "cell_type": "markdown", "id": "22e8d804-c027-45fb-8fef-06e7bba6295a",