diff --git a/deploy_and_customize_codeLLaMa/deploypretrained-Code-LLaMa.ipynb b/deploy_and_customize_codeLLaMa/deploypretrained-Code-LLaMa.ipynb
index f64ff5e..609f3bc 100644
--- a/deploy_and_customize_codeLLaMa/deploypretrained-Code-LLaMa.ipynb
+++ b/deploy_and_customize_codeLLaMa/deploypretrained-Code-LLaMa.ipynb
@@ -18,11 +18,401 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 2,
"metadata": {
"tags": []
},
- "outputs": [],
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Collecting langchain\n",
+ " Downloading langchain-0.1.5-py3-none-any.whl.metadata (13 kB)\n",
+ "Requirement already satisfied: PyYAML>=5.3 in /opt/conda/lib/python3.10/site-packages/PyYAML-6.0-py3.10-linux-x86_64.egg (from langchain) (6.0)\n",
+ "Requirement already satisfied: SQLAlchemy<3,>=1.4 in /opt/conda/lib/python3.10/site-packages (from langchain) (1.4.39)\n",
+ "Collecting aiohttp<4.0.0,>=3.8.3 (from langchain)\n",
+ " Downloading aiohttp-3.9.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (7.4 kB)\n",
+ "Collecting async-timeout<5.0.0,>=4.0.0 (from langchain)\n",
+ " Using cached async_timeout-4.0.3-py3-none-any.whl.metadata (4.2 kB)\n",
+ "Collecting dataclasses-json<0.7,>=0.5.7 (from langchain)\n",
+ " Downloading dataclasses_json-0.6.4-py3-none-any.whl.metadata (25 kB)\n",
+ "Collecting jsonpatch<2.0,>=1.33 (from langchain)\n",
+ " Downloading jsonpatch-1.33-py2.py3-none-any.whl.metadata (3.0 kB)\n",
+ "Collecting langchain-community<0.1,>=0.0.17 (from langchain)\n",
+ " Downloading langchain_community-0.0.17-py3-none-any.whl.metadata (7.9 kB)\n",
+ "Collecting langchain-core<0.2,>=0.1.16 (from langchain)\n",
+ " Downloading langchain_core-0.1.18-py3-none-any.whl.metadata (6.0 kB)\n",
+ "Collecting langsmith<0.1,>=0.0.83 (from langchain)\n",
+ " Downloading langsmith-0.0.86-py3-none-any.whl.metadata (10 kB)\n",
+ "Requirement already satisfied: numpy<2,>=1 in /opt/conda/lib/python3.10/site-packages (from langchain) (1.26.2)\n",
+ "Requirement already satisfied: pydantic<3,>=1 in /opt/conda/lib/python3.10/site-packages (from langchain) (1.10.13)\n",
+ "Requirement already satisfied: requests<3,>=2 in /opt/conda/lib/python3.10/site-packages (from langchain) (2.31.0)\n",
+ "Collecting tenacity<9.0.0,>=8.1.0 (from langchain)\n",
+ " Downloading tenacity-8.2.3-py3-none-any.whl.metadata (1.0 kB)\n",
+ "Collecting aiosignal>=1.1.2 (from aiohttp<4.0.0,>=3.8.3->langchain)\n",
+ " Using cached aiosignal-1.3.1-py3-none-any.whl (7.6 kB)\n",
+ "Requirement already satisfied: attrs>=17.3.0 in /opt/conda/lib/python3.10/site-packages (from aiohttp<4.0.0,>=3.8.3->langchain) (23.1.0)\n",
+ "Collecting frozenlist>=1.1.1 (from aiohttp<4.0.0,>=3.8.3->langchain)\n",
+ " Using cached frozenlist-1.4.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (12 kB)\n",
+ "Collecting multidict<7.0,>=4.5 (from aiohttp<4.0.0,>=3.8.3->langchain)\n",
+ " Downloading multidict-6.0.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (4.2 kB)\n",
+ "Collecting yarl<2.0,>=1.0 (from aiohttp<4.0.0,>=3.8.3->langchain)\n",
+ " Using cached yarl-1.9.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (31 kB)\n",
+ "Collecting marshmallow<4.0.0,>=3.18.0 (from dataclasses-json<0.7,>=0.5.7->langchain)\n",
+ " Downloading marshmallow-3.20.2-py3-none-any.whl.metadata (7.5 kB)\n",
+ "Collecting typing-inspect<1,>=0.4.0 (from dataclasses-json<0.7,>=0.5.7->langchain)\n",
+ " Downloading typing_inspect-0.9.0-py3-none-any.whl.metadata (1.5 kB)\n",
+ "Requirement already satisfied: jsonpointer>=1.9 in /opt/conda/lib/python3.10/site-packages (from jsonpatch<2.0,>=1.33->langchain) (2.1)\n",
+ "Requirement already satisfied: anyio<5,>=3 in /opt/conda/lib/python3.10/site-packages (from langchain-core<0.2,>=0.1.16->langchain) (3.5.0)\n",
+ "Collecting packaging<24.0,>=23.2 (from langchain-core<0.2,>=0.1.16->langchain)\n",
+ " Downloading packaging-23.2-py3-none-any.whl.metadata (3.2 kB)\n",
+ "Requirement already satisfied: typing-extensions>=4.2.0 in /opt/conda/lib/python3.10/site-packages (from pydantic<3,>=1->langchain) (4.3.0)\n",
+ "Requirement already satisfied: charset-normalizer<4,>=2 in /opt/conda/lib/python3.10/site-packages (from requests<3,>=2->langchain) (2.0.4)\n",
+ "Requirement already satisfied: idna<4,>=2.5 in /opt/conda/lib/python3.10/site-packages (from requests<3,>=2->langchain) (3.3)\n",
+ "Requirement already satisfied: urllib3<3,>=1.21.1 in /opt/conda/lib/python3.10/site-packages (from requests<3,>=2->langchain) (2.1.0)\n",
+ "Requirement already satisfied: certifi>=2017.4.17 in /opt/conda/lib/python3.10/site-packages (from requests<3,>=2->langchain) (2023.11.17)\n",
+ "Requirement already satisfied: greenlet!=0.4.17 in /opt/conda/lib/python3.10/site-packages (from SQLAlchemy<3,>=1.4->langchain) (1.1.1)\n",
+ "Requirement already satisfied: sniffio>=1.1 in /opt/conda/lib/python3.10/site-packages (from anyio<5,>=3->langchain-core<0.2,>=0.1.16->langchain) (1.2.0)\n",
+ "Requirement already satisfied: mypy-extensions>=0.3.0 in /opt/conda/lib/python3.10/site-packages (from typing-inspect<1,>=0.4.0->dataclasses-json<0.7,>=0.5.7->langchain) (0.4.3)\n",
+ "Downloading langchain-0.1.5-py3-none-any.whl (806 kB)\n",
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m806.7/806.7 kB\u001b[0m \u001b[31m5.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m:00:01\u001b[0m\n",
+ "\u001b[?25hDownloading aiohttp-3.9.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB)\n",
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.2/1.2 MB\u001b[0m \u001b[31m9.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m0:00:01\u001b[0m\n",
+ "\u001b[?25hUsing cached async_timeout-4.0.3-py3-none-any.whl (5.7 kB)\n",
+ "Downloading dataclasses_json-0.6.4-py3-none-any.whl (28 kB)\n",
+ "Downloading jsonpatch-1.33-py2.py3-none-any.whl (12 kB)\n",
+ "Downloading langchain_community-0.0.17-py3-none-any.whl (1.6 MB)\n",
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.6/1.6 MB\u001b[0m \u001b[31m14.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m:00:01\u001b[0m\n",
+ "\u001b[?25hDownloading langchain_core-0.1.18-py3-none-any.whl (237 kB)\n",
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m237.0/237.0 kB\u001b[0m \u001b[31m3.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m:00:01\u001b[0m\n",
+ "\u001b[?25hDownloading langsmith-0.0.86-py3-none-any.whl (54 kB)\n",
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m54.4/54.4 kB\u001b[0m \u001b[31m672.5 kB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0ma \u001b[36m0:00:01\u001b[0m\n",
+ "\u001b[?25hDownloading tenacity-8.2.3-py3-none-any.whl (24 kB)\n",
+ "Using cached frozenlist-1.4.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (239 kB)\n",
+ "Downloading marshmallow-3.20.2-py3-none-any.whl (49 kB)\n",
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m49.4/49.4 kB\u001b[0m \u001b[31m596.9 kB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0ma \u001b[36m0:00:01\u001b[0m\n",
+ "\u001b[?25hDownloading multidict-6.0.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (124 kB)\n",
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m124.3/124.3 kB\u001b[0m \u001b[31m1.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m:00:01\u001b[0m\n",
+ "\u001b[?25hDownloading packaging-23.2-py3-none-any.whl (53 kB)\n",
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m53.0/53.0 kB\u001b[0m \u001b[31m730.3 kB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0ma \u001b[36m0:00:01\u001b[0m\n",
+ "\u001b[?25hDownloading typing_inspect-0.9.0-py3-none-any.whl (8.8 kB)\n",
+ "Using cached yarl-1.9.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (301 kB)\n",
+ "Installing collected packages: typing-inspect, tenacity, packaging, multidict, jsonpatch, frozenlist, async-timeout, yarl, marshmallow, langsmith, aiosignal, langchain-core, dataclasses-json, aiohttp, langchain-community, langchain\n",
+ " Attempting uninstall: tenacity\n",
+ " Found existing installation: tenacity 8.0.1\n",
+ " Uninstalling tenacity-8.0.1:\n",
+ " Successfully uninstalled tenacity-8.0.1\n",
+ " Attempting uninstall: packaging\n",
+ " Found existing installation: packaging 21.3\n",
+ " Uninstalling packaging-21.3:\n",
+ " Successfully uninstalled packaging-21.3\n",
+ " Attempting uninstall: jsonpatch\n",
+ " Found existing installation: jsonpatch 1.32\n",
+ " Uninstalling jsonpatch-1.32:\n",
+ " Successfully uninstalled jsonpatch-1.32\n",
+ "\u001b[31mERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.\n",
+ "spyder 5.3.3 requires pyqt5<5.16, which is not installed.\n",
+ "spyder 5.3.3 requires pyqtwebengine<5.16, which is not installed.\n",
+ "distributed 2022.7.0 requires tornado<6.2,>=6.0.3, but you have tornado 6.4 which is incompatible.\n",
+ "jupyterlab 3.4.4 requires jupyter-server~=1.16, but you have jupyter-server 2.12.1 which is incompatible.\n",
+ "jupyterlab-server 2.10.3 requires jupyter-server~=1.4, but you have jupyter-server 2.12.1 which is incompatible.\n",
+ "notebook 6.5.6 requires jupyter-client<8,>=5.3.4, but you have jupyter-client 8.6.0 which is incompatible.\n",
+ "notebook 6.5.6 requires pyzmq<25,>=17, but you have pyzmq 25.1.2 which is incompatible.\n",
+ "panel 0.13.1 requires bokeh<2.5.0,>=2.4.0, but you have bokeh 3.3.2 which is incompatible.\n",
+ "sagemaker 2.199.0 requires urllib3<1.27, but you have urllib3 2.1.0 which is incompatible.\n",
+ "sagemaker-datawrangler 0.4.3 requires sagemaker-data-insights==0.4.0, but you have sagemaker-data-insights 0.3.3 which is incompatible.\n",
+ "spyder 5.3.3 requires ipython<8.0.0,>=7.31.1, but you have ipython 8.18.1 which is incompatible.\n",
+ "spyder 5.3.3 requires pylint<3.0,>=2.5.0, but you have pylint 3.0.2 which is incompatible.\n",
+ "spyder-kernels 2.3.3 requires ipython<8,>=7.31.1; python_version >= \"3\", but you have ipython 8.18.1 which is incompatible.\n",
+ "spyder-kernels 2.3.3 requires jupyter-client<8,>=7.3.4; python_version >= \"3\", but you have jupyter-client 8.6.0 which is incompatible.\u001b[0m\u001b[31m\n",
+ "\u001b[0mSuccessfully installed aiohttp-3.9.3 aiosignal-1.3.1 async-timeout-4.0.3 dataclasses-json-0.6.4 frozenlist-1.4.1 jsonpatch-1.33 langchain-0.1.5 langchain-community-0.0.17 langchain-core-0.1.18 langsmith-0.0.86 marshmallow-3.20.2 multidict-6.0.5 packaging-23.2 tenacity-8.2.3 typing-inspect-0.9.0 yarl-1.9.4\n",
+ "\u001b[33mWARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv\u001b[0m\u001b[33m\n",
+ "\u001b[0m\n",
+ "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip is available: \u001b[0m\u001b[31;49m23.3.1\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m24.0\u001b[0m\n",
+ "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpip install --upgrade pip\u001b[0m\n",
+ "Collecting chromadb\n",
+ " Downloading chromadb-0.4.22-py3-none-any.whl.metadata (7.3 kB)\n",
+ "Collecting build>=1.0.3 (from chromadb)\n",
+ " Downloading build-1.0.3-py3-none-any.whl.metadata (4.2 kB)\n",
+ "Requirement already satisfied: requests>=2.28 in /opt/conda/lib/python3.10/site-packages (from chromadb) (2.31.0)\n",
+ "Requirement already satisfied: pydantic>=1.9 in /opt/conda/lib/python3.10/site-packages (from chromadb) (1.10.13)\n",
+ "Collecting chroma-hnswlib==0.7.3 (from chromadb)\n",
+ " Downloading chroma_hnswlib-0.7.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (252 bytes)\n",
+ "Requirement already satisfied: fastapi>=0.95.2 in /opt/conda/lib/python3.10/site-packages (from chromadb) (0.95.2)\n",
+ "Requirement already satisfied: uvicorn>=0.18.3 in /opt/conda/lib/python3.10/site-packages (from uvicorn[standard]>=0.18.3->chromadb) (0.22.0)\n",
+ "Requirement already satisfied: numpy>=1.22.5 in /opt/conda/lib/python3.10/site-packages (from chromadb) (1.26.2)\n",
+ "Collecting posthog>=2.4.0 (from chromadb)\n",
+ " Downloading posthog-3.4.0-py2.py3-none-any.whl.metadata (2.0 kB)\n",
+ "Collecting typing-extensions>=4.5.0 (from chromadb)\n",
+ " Downloading typing_extensions-4.9.0-py3-none-any.whl.metadata (3.0 kB)\n",
+ "Collecting pulsar-client>=3.1.0 (from chromadb)\n",
+ " Downloading pulsar_client-3.4.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.0 kB)\n",
+ "Collecting onnxruntime>=1.14.1 (from chromadb)\n",
+ " Downloading onnxruntime-1.17.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.metadata (4.2 kB)\n",
+ "Collecting opentelemetry-api>=1.2.0 (from chromadb)\n",
+ " Downloading opentelemetry_api-1.22.0-py3-none-any.whl.metadata (1.4 kB)\n",
+ "Collecting opentelemetry-exporter-otlp-proto-grpc>=1.2.0 (from chromadb)\n",
+ " Downloading opentelemetry_exporter_otlp_proto_grpc-1.22.0-py3-none-any.whl.metadata (2.4 kB)\n",
+ "Collecting opentelemetry-instrumentation-fastapi>=0.41b0 (from chromadb)\n",
+ " Downloading opentelemetry_instrumentation_fastapi-0.43b0-py3-none-any.whl.metadata (2.3 kB)\n",
+ "Collecting opentelemetry-sdk>=1.2.0 (from chromadb)\n",
+ " Downloading opentelemetry_sdk-1.22.0-py3-none-any.whl.metadata (1.5 kB)\n",
+ "Collecting tokenizers>=0.13.2 (from chromadb)\n",
+ " Using cached tokenizers-0.15.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (6.7 kB)\n",
+ "Collecting pypika>=0.48.9 (from chromadb)\n",
+ " Downloading PyPika-0.48.9.tar.gz (67 kB)\n",
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m67.3/67.3 kB\u001b[0m \u001b[31m630.2 kB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m \u001b[36m0:00:01\u001b[0m\n",
+ "\u001b[?25h Installing build dependencies ... \u001b[?25ldone\n",
+ "\u001b[?25h Getting requirements to build wheel ... \u001b[?25ldone\n",
+ "\u001b[?25h Preparing metadata (pyproject.toml) ... \u001b[?25ldone\n",
+ "\u001b[?25hCollecting tqdm>=4.65.0 (from chromadb)\n",
+ " Downloading tqdm-4.66.1-py3-none-any.whl.metadata (57 kB)\n",
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m57.6/57.6 kB\u001b[0m \u001b[31m637.6 kB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0ma \u001b[36m0:00:01\u001b[0m\n",
+ "\u001b[?25hRequirement already satisfied: overrides>=7.3.1 in /opt/conda/lib/python3.10/site-packages (from chromadb) (7.4.0)\n",
+ "Collecting importlib-resources (from chromadb)\n",
+ " Downloading importlib_resources-6.1.1-py3-none-any.whl.metadata (4.1 kB)\n",
+ "Collecting grpcio>=1.58.0 (from chromadb)\n",
+ " Downloading grpcio-1.60.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (4.0 kB)\n",
+ "Collecting bcrypt>=4.0.1 (from chromadb)\n",
+ " Downloading bcrypt-4.1.2-cp39-abi3-manylinux_2_28_x86_64.whl.metadata (9.5 kB)\n",
+ "Collecting typer>=0.9.0 (from chromadb)\n",
+ " Downloading typer-0.9.0-py3-none-any.whl (45 kB)\n",
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m45.9/45.9 kB\u001b[0m \u001b[31m648.1 kB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0ma \u001b[36m0:00:01\u001b[0m\n",
+ "\u001b[?25hCollecting kubernetes>=28.1.0 (from chromadb)\n",
+ " Downloading kubernetes-29.0.0-py2.py3-none-any.whl.metadata (1.5 kB)\n",
+ "Requirement already satisfied: tenacity>=8.2.3 in /opt/conda/lib/python3.10/site-packages (from chromadb) (8.2.3)\n",
+ "Requirement already satisfied: PyYAML>=6.0.0 in /opt/conda/lib/python3.10/site-packages/PyYAML-6.0-py3.10-linux-x86_64.egg (from chromadb) (6.0)\n",
+ "Collecting mmh3>=4.0.1 (from chromadb)\n",
+ " Downloading mmh3-4.1.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (13 kB)\n",
+ "Requirement already satisfied: packaging>=19.0 in /opt/conda/lib/python3.10/site-packages (from build>=1.0.3->chromadb) (23.2)\n",
+ "Collecting pyproject_hooks (from build>=1.0.3->chromadb)\n",
+ " Downloading pyproject_hooks-1.0.0-py3-none-any.whl (9.3 kB)\n",
+ "Requirement already satisfied: tomli>=1.1.0 in /opt/conda/lib/python3.10/site-packages (from build>=1.0.3->chromadb) (2.0.1)\n",
+ "Requirement already satisfied: starlette<0.28.0,>=0.27.0 in /opt/conda/lib/python3.10/site-packages (from fastapi>=0.95.2->chromadb) (0.27.0)\n",
+ "Requirement already satisfied: certifi>=14.05.14 in /opt/conda/lib/python3.10/site-packages (from kubernetes>=28.1.0->chromadb) (2023.11.17)\n",
+ "Requirement already satisfied: six>=1.9.0 in /opt/conda/lib/python3.10/site-packages (from kubernetes>=28.1.0->chromadb) (1.16.0)\n",
+ "Requirement already satisfied: python-dateutil>=2.5.3 in /opt/conda/lib/python3.10/site-packages (from kubernetes>=28.1.0->chromadb) (2.8.2)\n",
+ "Collecting google-auth>=1.0.1 (from kubernetes>=28.1.0->chromadb)\n",
+ " Downloading google_auth-2.27.0-py2.py3-none-any.whl.metadata (4.7 kB)\n",
+ "Requirement already satisfied: websocket-client!=0.40.0,!=0.41.*,!=0.42.*,>=0.32.0 in /opt/conda/lib/python3.10/site-packages (from kubernetes>=28.1.0->chromadb) (0.58.0)\n",
+ "Collecting requests-oauthlib (from kubernetes>=28.1.0->chromadb)\n",
+ " Downloading requests_oauthlib-1.3.1-py2.py3-none-any.whl (23 kB)\n",
+ "Collecting oauthlib>=3.2.2 (from kubernetes>=28.1.0->chromadb)\n",
+ " Downloading oauthlib-3.2.2-py3-none-any.whl (151 kB)\n",
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m151.7/151.7 kB\u001b[0m \u001b[31m1.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0ma \u001b[36m0:00:01\u001b[0m\n",
+ "\u001b[?25hRequirement already satisfied: urllib3>=1.24.2 in /opt/conda/lib/python3.10/site-packages (from kubernetes>=28.1.0->chromadb) (2.1.0)\n",
+ "Collecting coloredlogs (from onnxruntime>=1.14.1->chromadb)\n",
+ " Downloading coloredlogs-15.0.1-py2.py3-none-any.whl (46 kB)\n",
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m46.0/46.0 kB\u001b[0m \u001b[31m531.2 kB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0ma \u001b[36m0:00:01\u001b[0m\n",
+ "\u001b[?25hCollecting flatbuffers (from onnxruntime>=1.14.1->chromadb)\n",
+ " Downloading flatbuffers-23.5.26-py2.py3-none-any.whl.metadata (850 bytes)\n",
+ "Requirement already satisfied: protobuf in /opt/conda/lib/python3.10/site-packages (from onnxruntime>=1.14.1->chromadb) (4.25.1)\n",
+ "Requirement already satisfied: sympy in /opt/conda/lib/python3.10/site-packages (from onnxruntime>=1.14.1->chromadb) (1.10.1)\n",
+ "Collecting deprecated>=1.2.6 (from opentelemetry-api>=1.2.0->chromadb)\n",
+ " Downloading Deprecated-1.2.14-py2.py3-none-any.whl.metadata (5.4 kB)\n",
+ "Collecting importlib-metadata<7.0,>=6.0 (from opentelemetry-api>=1.2.0->chromadb)\n",
+ " Downloading importlib_metadata-6.11.0-py3-none-any.whl.metadata (4.9 kB)\n",
+ "Collecting backoff<3.0.0,>=1.10.0 (from opentelemetry-exporter-otlp-proto-grpc>=1.2.0->chromadb)\n",
+ " Downloading backoff-2.2.1-py3-none-any.whl (15 kB)\n",
+ "Collecting googleapis-common-protos~=1.52 (from opentelemetry-exporter-otlp-proto-grpc>=1.2.0->chromadb)\n",
+ " Downloading googleapis_common_protos-1.62.0-py2.py3-none-any.whl.metadata (1.5 kB)\n",
+ "Collecting opentelemetry-exporter-otlp-proto-common==1.22.0 (from opentelemetry-exporter-otlp-proto-grpc>=1.2.0->chromadb)\n",
+ " Downloading opentelemetry_exporter_otlp_proto_common-1.22.0-py3-none-any.whl.metadata (1.9 kB)\n",
+ "Collecting opentelemetry-proto==1.22.0 (from opentelemetry-exporter-otlp-proto-grpc>=1.2.0->chromadb)\n",
+ " Downloading opentelemetry_proto-1.22.0-py3-none-any.whl.metadata (2.3 kB)\n",
+ "Collecting opentelemetry-instrumentation-asgi==0.43b0 (from opentelemetry-instrumentation-fastapi>=0.41b0->chromadb)\n",
+ " Downloading opentelemetry_instrumentation_asgi-0.43b0-py3-none-any.whl.metadata (2.1 kB)\n",
+ "Collecting opentelemetry-instrumentation==0.43b0 (from opentelemetry-instrumentation-fastapi>=0.41b0->chromadb)\n",
+ " Downloading opentelemetry_instrumentation-0.43b0-py3-none-any.whl.metadata (5.9 kB)\n",
+ "Collecting opentelemetry-semantic-conventions==0.43b0 (from opentelemetry-instrumentation-fastapi>=0.41b0->chromadb)\n",
+ " Downloading opentelemetry_semantic_conventions-0.43b0-py3-none-any.whl.metadata (2.3 kB)\n",
+ "Collecting opentelemetry-util-http==0.43b0 (from opentelemetry-instrumentation-fastapi>=0.41b0->chromadb)\n",
+ " Downloading opentelemetry_util_http-0.43b0-py3-none-any.whl.metadata (2.5 kB)\n",
+ "Requirement already satisfied: setuptools>=16.0 in /opt/conda/lib/python3.10/site-packages (from opentelemetry-instrumentation==0.43b0->opentelemetry-instrumentation-fastapi>=0.41b0->chromadb) (69.0.2)\n",
+ "Requirement already satisfied: wrapt<2.0.0,>=1.0.0 in /opt/conda/lib/python3.10/site-packages (from opentelemetry-instrumentation==0.43b0->opentelemetry-instrumentation-fastapi>=0.41b0->chromadb) (1.14.1)\n",
+ "Collecting asgiref~=3.0 (from opentelemetry-instrumentation-asgi==0.43b0->opentelemetry-instrumentation-fastapi>=0.41b0->chromadb)\n",
+ " Downloading asgiref-3.7.2-py3-none-any.whl.metadata (9.2 kB)\n",
+ "Collecting monotonic>=1.5 (from posthog>=2.4.0->chromadb)\n",
+ " Downloading monotonic-1.6-py2.py3-none-any.whl (8.2 kB)\n",
+ "Requirement already satisfied: charset-normalizer<4,>=2 in /opt/conda/lib/python3.10/site-packages (from requests>=2.28->chromadb) (2.0.4)\n",
+ "Requirement already satisfied: idna<4,>=2.5 in /opt/conda/lib/python3.10/site-packages (from requests>=2.28->chromadb) (3.3)\n",
+ "Collecting huggingface_hub<1.0,>=0.16.4 (from tokenizers>=0.13.2->chromadb)\n",
+ " Using cached huggingface_hub-0.20.3-py3-none-any.whl.metadata (12 kB)\n",
+ "Requirement already satisfied: click<9.0.0,>=7.1.1 in /opt/conda/lib/python3.10/site-packages (from typer>=0.9.0->chromadb) (8.1.7)\n",
+ "Requirement already satisfied: h11>=0.8 in /opt/conda/lib/python3.10/site-packages (from uvicorn>=0.18.3->uvicorn[standard]>=0.18.3->chromadb) (0.14.0)\n",
+ "Collecting httptools>=0.5.0 (from uvicorn[standard]>=0.18.3->chromadb)\n",
+ " Downloading httptools-0.6.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (3.6 kB)\n",
+ "Collecting python-dotenv>=0.13 (from uvicorn[standard]>=0.18.3->chromadb)\n",
+ " Downloading python_dotenv-1.0.1-py3-none-any.whl.metadata (23 kB)\n",
+ "Collecting uvloop!=0.15.0,!=0.15.1,>=0.14.0 (from uvicorn[standard]>=0.18.3->chromadb)\n",
+ " Downloading uvloop-0.19.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (4.9 kB)\n",
+ "Collecting watchfiles>=0.13 (from uvicorn[standard]>=0.18.3->chromadb)\n",
+ " Downloading watchfiles-0.21.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (4.9 kB)\n",
+ "Collecting websockets>=10.4 (from uvicorn[standard]>=0.18.3->chromadb)\n",
+ " Downloading websockets-12.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (6.6 kB)\n",
+ "Collecting cachetools<6.0,>=2.0.0 (from google-auth>=1.0.1->kubernetes>=28.1.0->chromadb)\n",
+ " Downloading cachetools-5.3.2-py3-none-any.whl.metadata (5.2 kB)\n",
+ "Requirement already satisfied: pyasn1-modules>=0.2.1 in /opt/conda/lib/python3.10/site-packages (from google-auth>=1.0.1->kubernetes>=28.1.0->chromadb) (0.2.8)\n",
+ "Requirement already satisfied: rsa<5,>=3.1.4 in /opt/conda/lib/python3.10/site-packages (from google-auth>=1.0.1->kubernetes>=28.1.0->chromadb) (4.7.2)\n",
+ "Requirement already satisfied: filelock in /opt/conda/lib/python3.10/site-packages (from huggingface_hub<1.0,>=0.16.4->tokenizers>=0.13.2->chromadb) (3.6.0)\n",
+ "Collecting fsspec>=2023.5.0 (from huggingface_hub<1.0,>=0.16.4->tokenizers>=0.13.2->chromadb)\n",
+ " Downloading fsspec-2024.2.0-py3-none-any.whl.metadata (6.8 kB)\n",
+ "Requirement already satisfied: zipp>=0.5 in /opt/conda/lib/python3.10/site-packages (from importlib-metadata<7.0,>=6.0->opentelemetry-api>=1.2.0->chromadb) (3.8.0)\n",
+ "Requirement already satisfied: anyio<5,>=3.4.0 in /opt/conda/lib/python3.10/site-packages (from starlette<0.28.0,>=0.27.0->fastapi>=0.95.2->chromadb) (3.5.0)\n",
+ "Collecting humanfriendly>=9.1 (from coloredlogs->onnxruntime>=1.14.1->chromadb)\n",
+ " Downloading humanfriendly-10.0-py2.py3-none-any.whl (86 kB)\n",
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m86.8/86.8 kB\u001b[0m \u001b[31m935.5 kB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0ma \u001b[36m0:00:01\u001b[0m\n",
+ "\u001b[?25hRequirement already satisfied: mpmath>=0.19 in /opt/conda/lib/python3.10/site-packages (from sympy->onnxruntime>=1.14.1->chromadb) (1.3.0)\n",
+ "Requirement already satisfied: sniffio>=1.1 in /opt/conda/lib/python3.10/site-packages (from anyio<5,>=3.4.0->starlette<0.28.0,>=0.27.0->fastapi>=0.95.2->chromadb) (1.2.0)\n",
+ "Requirement already satisfied: pyasn1<0.5.0,>=0.4.6 in /opt/conda/lib/python3.10/site-packages (from pyasn1-modules>=0.2.1->google-auth>=1.0.1->kubernetes>=28.1.0->chromadb) (0.4.8)\n",
+ "Downloading chromadb-0.4.22-py3-none-any.whl (509 kB)\n",
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m509.0/509.0 kB\u001b[0m \u001b[31m5.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m:00:01\u001b[0m\n",
+ "\u001b[?25hDownloading chroma_hnswlib-0.7.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.4 MB)\n",
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m2.4/2.4 MB\u001b[0m \u001b[31m16.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m:00:01\u001b[0m\n",
+ "\u001b[?25hDownloading bcrypt-4.1.2-cp39-abi3-manylinux_2_28_x86_64.whl (698 kB)\n",
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m698.9/698.9 kB\u001b[0m \u001b[31m7.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m:00:01\u001b[0m\n",
+ "\u001b[?25hDownloading build-1.0.3-py3-none-any.whl (18 kB)\n",
+ "Downloading grpcio-1.60.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.4 MB)\n",
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m5.4/5.4 MB\u001b[0m \u001b[31m34.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m:00:01\u001b[0m\n",
+ "\u001b[?25hDownloading kubernetes-29.0.0-py2.py3-none-any.whl (1.6 MB)\n",
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.6/1.6 MB\u001b[0m \u001b[31m16.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m:00:01\u001b[0m\n",
+ "\u001b[?25hDownloading mmh3-4.1.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (67 kB)\n",
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m67.6/67.6 kB\u001b[0m \u001b[31m792.9 kB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0ma \u001b[36m0:00:01\u001b[0m\n",
+ "\u001b[?25hDownloading onnxruntime-1.17.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (6.8 MB)\n",
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m6.8/6.8 MB\u001b[0m \u001b[31m40.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m:00:01\u001b[0m\n",
+ "\u001b[?25hDownloading opentelemetry_api-1.22.0-py3-none-any.whl (57 kB)\n",
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m57.9/57.9 kB\u001b[0m \u001b[31m729.2 kB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0ma \u001b[36m0:00:01\u001b[0m\n",
+ "\u001b[?25hDownloading opentelemetry_exporter_otlp_proto_grpc-1.22.0-py3-none-any.whl (18 kB)\n",
+ "Downloading opentelemetry_exporter_otlp_proto_common-1.22.0-py3-none-any.whl (17 kB)\n",
+ "Downloading opentelemetry_proto-1.22.0-py3-none-any.whl (50 kB)\n",
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m50.8/50.8 kB\u001b[0m \u001b[31m725.3 kB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m \u001b[36m0:00:01\u001b[0m\n",
+ "\u001b[?25hDownloading opentelemetry_instrumentation_fastapi-0.43b0-py3-none-any.whl (11 kB)\n",
+ "Downloading opentelemetry_instrumentation-0.43b0-py3-none-any.whl (28 kB)\n",
+ "Downloading opentelemetry_instrumentation_asgi-0.43b0-py3-none-any.whl (14 kB)\n",
+ "Downloading opentelemetry_semantic_conventions-0.43b0-py3-none-any.whl (36 kB)\n",
+ "Downloading opentelemetry_util_http-0.43b0-py3-none-any.whl (6.9 kB)\n",
+ "Downloading opentelemetry_sdk-1.22.0-py3-none-any.whl (105 kB)\n",
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m105.6/105.6 kB\u001b[0m \u001b[31m1.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0mta \u001b[36m0:00:01\u001b[0m\n",
+ "\u001b[?25hDownloading posthog-3.4.0-py2.py3-none-any.whl (41 kB)\n",
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m41.1/41.1 kB\u001b[0m \u001b[31m615.5 kB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m00:01\u001b[0m\n",
+ "\u001b[?25hDownloading pulsar_client-3.4.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.4 MB)\n",
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m5.4/5.4 MB\u001b[0m \u001b[31m31.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m:00:01\u001b[0m\n",
+ "\u001b[?25hUsing cached tokenizers-0.15.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.6 MB)\n",
+ "Downloading tqdm-4.66.1-py3-none-any.whl (78 kB)\n",
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m78.3/78.3 kB\u001b[0m \u001b[31m1.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0meta \u001b[36m0:00:01\u001b[0m\n",
+ "\u001b[?25hDownloading typing_extensions-4.9.0-py3-none-any.whl (32 kB)\n",
+ "Downloading importlib_resources-6.1.1-py3-none-any.whl (33 kB)\n",
+ "Downloading Deprecated-1.2.14-py2.py3-none-any.whl (9.6 kB)\n",
+ "Downloading google_auth-2.27.0-py2.py3-none-any.whl (186 kB)\n",
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m186.8/186.8 kB\u001b[0m \u001b[31m2.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m:00:01\u001b[0m\n",
+ "\u001b[?25hDownloading googleapis_common_protos-1.62.0-py2.py3-none-any.whl (228 kB)\n",
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m228.7/228.7 kB\u001b[0m \u001b[31m2.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m:00:01\u001b[0m\n",
+ "\u001b[?25hDownloading httptools-0.6.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (341 kB)\n",
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m341.4/341.4 kB\u001b[0m \u001b[31m4.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m:00:01\u001b[0m\n",
+ "\u001b[?25hUsing cached huggingface_hub-0.20.3-py3-none-any.whl (330 kB)\n",
+ "Downloading importlib_metadata-6.11.0-py3-none-any.whl (23 kB)\n",
+ "Downloading python_dotenv-1.0.1-py3-none-any.whl (19 kB)\n",
+ "Downloading uvloop-0.19.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.4 MB)\n",
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m3.4/3.4 MB\u001b[0m \u001b[31m24.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m:00:01\u001b[0m\n",
+ "\u001b[?25hDownloading watchfiles-0.21.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB)\n",
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.3/1.3 MB\u001b[0m \u001b[31m14.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m:00:01\u001b[0m\n",
+ "\u001b[?25hDownloading websockets-12.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (130 kB)\n",
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m130.2/130.2 kB\u001b[0m \u001b[31m1.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0mta \u001b[36m0:00:01\u001b[0m\n",
+ "\u001b[?25hDownloading flatbuffers-23.5.26-py2.py3-none-any.whl (26 kB)\n",
+ "Downloading asgiref-3.7.2-py3-none-any.whl (24 kB)\n",
+ "Downloading cachetools-5.3.2-py3-none-any.whl (9.3 kB)\n",
+ "Downloading fsspec-2024.2.0-py3-none-any.whl (170 kB)\n",
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m170.9/170.9 kB\u001b[0m \u001b[31m2.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0mta \u001b[36m0:00:01\u001b[0m\n",
+ "\u001b[?25hBuilding wheels for collected packages: pypika\n",
+ " Building wheel for pypika (pyproject.toml) ... \u001b[?25ldone\n",
+ "\u001b[?25h Created wheel for pypika: filename=PyPika-0.48.9-py2.py3-none-any.whl size=53723 sha256=0347ae777b708d956edcd789627730b4fd7e82873510efab5f6c565d483fcfd2\n",
+ " Stored in directory: /root/.cache/pip/wheels/e1/26/51/d0bffb3d2fd82256676d7ad3003faea3bd6dddc9577af665f4\n",
+ "Successfully built pypika\n",
+ "Installing collected packages: pypika, monotonic, mmh3, flatbuffers, websockets, uvloop, typing-extensions, tqdm, python-dotenv, pyproject_hooks, pulsar-client, opentelemetry-util-http, opentelemetry-semantic-conventions, opentelemetry-proto, oauthlib, importlib-resources, importlib-metadata, humanfriendly, httptools, grpcio, googleapis-common-protos, fsspec, deprecated, chroma-hnswlib, cachetools, bcrypt, backoff, watchfiles, typer, requests-oauthlib, posthog, opentelemetry-exporter-otlp-proto-common, opentelemetry-api, huggingface_hub, google-auth, coloredlogs, build, asgiref, tokenizers, opentelemetry-sdk, opentelemetry-instrumentation, onnxruntime, kubernetes, opentelemetry-instrumentation-asgi, opentelemetry-exporter-otlp-proto-grpc, opentelemetry-instrumentation-fastapi, chromadb\n",
+ " Attempting uninstall: typing-extensions\n",
+ " Found existing installation: typing_extensions 4.3.0\n",
+ " Uninstalling typing_extensions-4.3.0:\n",
+ " Successfully uninstalled typing_extensions-4.3.0\n",
+ " Attempting uninstall: tqdm\n",
+ " Found existing installation: tqdm 4.64.1\n",
+ " Uninstalling tqdm-4.64.1:\n",
+ " Successfully uninstalled tqdm-4.64.1\n",
+ " Attempting uninstall: importlib-metadata\n",
+ " Found existing installation: importlib-metadata 4.11.3\n",
+ " Uninstalling importlib-metadata-4.11.3:\n",
+ " Successfully uninstalled importlib-metadata-4.11.3\n",
+ " Attempting uninstall: fsspec\n",
+ " Found existing installation: fsspec 2022.7.1\n",
+ " Uninstalling fsspec-2022.7.1:\n",
+ " Successfully uninstalled fsspec-2022.7.1\n",
+ " Attempting uninstall: bcrypt\n",
+ " Found existing installation: bcrypt 3.2.0\n",
+ " Uninstalling bcrypt-3.2.0:\n",
+ " Successfully uninstalled bcrypt-3.2.0\n",
+ "\u001b[31mERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.\n",
+ "spyder 5.3.3 requires pyqt5<5.16, which is not installed.\n",
+ "spyder 5.3.3 requires pyqtwebengine<5.16, which is not installed.\n",
+ "distributed 2022.7.0 requires tornado<6.2,>=6.0.3, but you have tornado 6.4 which is incompatible.\n",
+ "panel 0.13.1 requires bokeh<2.5.0,>=2.4.0, but you have bokeh 3.3.2 which is incompatible.\n",
+ "sagemaker 2.199.0 requires urllib3<1.27, but you have urllib3 2.1.0 which is incompatible.\n",
+ "spyder 5.3.3 requires ipython<8.0.0,>=7.31.1, but you have ipython 8.18.1 which is incompatible.\n",
+ "spyder 5.3.3 requires pylint<3.0,>=2.5.0, but you have pylint 3.0.2 which is incompatible.\u001b[0m\u001b[31m\n",
+ "\u001b[0mSuccessfully installed asgiref-3.7.2 backoff-2.2.1 bcrypt-4.1.2 build-1.0.3 cachetools-5.3.2 chroma-hnswlib-0.7.3 chromadb-0.4.22 coloredlogs-15.0.1 deprecated-1.2.14 flatbuffers-23.5.26 fsspec-2024.2.0 google-auth-2.27.0 googleapis-common-protos-1.62.0 grpcio-1.60.1 httptools-0.6.1 huggingface_hub-0.20.3 humanfriendly-10.0 importlib-metadata-6.11.0 importlib-resources-6.1.1 kubernetes-29.0.0 mmh3-4.1.0 monotonic-1.6 oauthlib-3.2.2 onnxruntime-1.17.0 opentelemetry-api-1.22.0 opentelemetry-exporter-otlp-proto-common-1.22.0 opentelemetry-exporter-otlp-proto-grpc-1.22.0 opentelemetry-instrumentation-0.43b0 opentelemetry-instrumentation-asgi-0.43b0 opentelemetry-instrumentation-fastapi-0.43b0 opentelemetry-proto-1.22.0 opentelemetry-sdk-1.22.0 opentelemetry-semantic-conventions-0.43b0 opentelemetry-util-http-0.43b0 posthog-3.4.0 pulsar-client-3.4.0 pypika-0.48.9 pyproject_hooks-1.0.0 python-dotenv-1.0.1 requests-oauthlib-1.3.1 tokenizers-0.15.1 tqdm-4.66.1 typer-0.9.0 typing-extensions-4.9.0 uvloop-0.19.0 watchfiles-0.21.0 websockets-12.0\n",
+ "\u001b[33mWARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv\u001b[0m\u001b[33m\n",
+ "\u001b[0m\n",
+ "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip is available: \u001b[0m\u001b[31;49m23.3.1\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m24.0\u001b[0m\n",
+ "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpip install --upgrade pip\u001b[0m\n",
+ "Requirement already satisfied: boto3 in /opt/conda/lib/python3.10/site-packages (1.33.9)\n",
+ "Collecting boto3\n",
+ " Downloading boto3-1.34.34-py3-none-any.whl.metadata (6.6 kB)\n",
+ "Collecting botocore<1.35.0,>=1.34.34 (from boto3)\n",
+ " Downloading botocore-1.34.34-py3-none-any.whl.metadata (5.7 kB)\n",
+ "Requirement already satisfied: jmespath<2.0.0,>=0.7.1 in /opt/conda/lib/python3.10/site-packages (from boto3) (0.10.0)\n",
+ "Collecting s3transfer<0.11.0,>=0.10.0 (from boto3)\n",
+ " Downloading s3transfer-0.10.0-py3-none-any.whl.metadata (1.7 kB)\n",
+ "Requirement already satisfied: python-dateutil<3.0.0,>=2.1 in /opt/conda/lib/python3.10/site-packages (from botocore<1.35.0,>=1.34.34->boto3) (2.8.2)\n",
+ "Collecting urllib3<2.1,>=1.25.4 (from botocore<1.35.0,>=1.34.34->boto3)\n",
+ " Downloading urllib3-2.0.7-py3-none-any.whl.metadata (6.6 kB)\n",
+ "Requirement already satisfied: six>=1.5 in /opt/conda/lib/python3.10/site-packages (from python-dateutil<3.0.0,>=2.1->botocore<1.35.0,>=1.34.34->boto3) (1.16.0)\n",
+ "Downloading boto3-1.34.34-py3-none-any.whl (139 kB)\n",
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m139.3/139.3 kB\u001b[0m \u001b[31m1.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0mta \u001b[36m0:00:01\u001b[0m\n",
+ "\u001b[?25hDownloading botocore-1.34.34-py3-none-any.whl (11.9 MB)\n",
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m11.9/11.9 MB\u001b[0m \u001b[31m41.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m:00:01\u001b[0m0:01\u001b[0m\n",
+ "\u001b[?25hDownloading s3transfer-0.10.0-py3-none-any.whl (82 kB)\n",
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m82.1/82.1 kB\u001b[0m \u001b[31m1.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m0:00:01\u001b[0m\n",
+ "\u001b[?25hDownloading urllib3-2.0.7-py3-none-any.whl (124 kB)\n",
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m124.2/124.2 kB\u001b[0m \u001b[31m1.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m:00:01\u001b[0m\n",
+ "\u001b[?25hInstalling collected packages: urllib3, botocore, s3transfer, boto3\n",
+ " Attempting uninstall: urllib3\n",
+ " Found existing installation: urllib3 2.1.0\n",
+ " Uninstalling urllib3-2.1.0:\n",
+ " Successfully uninstalled urllib3-2.1.0\n",
+ " Attempting uninstall: botocore\n",
+ " Found existing installation: botocore 1.33.9\n",
+ " Uninstalling botocore-1.33.9:\n",
+ " Successfully uninstalled botocore-1.33.9\n",
+ " Attempting uninstall: s3transfer\n",
+ " Found existing installation: s3transfer 0.8.2\n",
+ " Uninstalling s3transfer-0.8.2:\n",
+ " Successfully uninstalled s3transfer-0.8.2\n",
+ " Attempting uninstall: boto3\n",
+ " Found existing installation: boto3 1.33.9\n",
+ " Uninstalling boto3-1.33.9:\n",
+ " Successfully uninstalled boto3-1.33.9\n",
+ "\u001b[31mERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.\n",
+ "awscli 1.31.9 requires botocore==1.33.9, but you have botocore 1.34.34 which is incompatible.\n",
+ "awscli 1.31.9 requires s3transfer<0.9.0,>=0.8.0, but you have s3transfer 0.10.0 which is incompatible.\n",
+ "distributed 2022.7.0 requires tornado<6.2,>=6.0.3, but you have tornado 6.4 which is incompatible.\n",
+ "sagemaker 2.199.0 requires urllib3<1.27, but you have urllib3 2.0.7 which is incompatible.\u001b[0m\u001b[31m\n",
+ "\u001b[0mSuccessfully installed boto3-1.34.34 botocore-1.34.34 s3transfer-0.10.0 urllib3-2.0.7\n",
+ "\u001b[33mWARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv\u001b[0m\u001b[33m\n",
+ "\u001b[0m\n",
+ "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip is available: \u001b[0m\u001b[31;49m23.3.1\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m24.0\u001b[0m\n",
+ "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpip install --upgrade pip\u001b[0m\n"
+ ]
+ }
+ ],
"source": [
"import sys\n",
"!{sys.executable} -m pip install langchain\n",
@@ -39,7 +429,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 3,
"metadata": {
"collapsed": false,
"jupyter": {
@@ -76,7 +466,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 4,
"metadata": {
"collapsed": false,
"jupyter": {
@@ -84,23 +474,63 @@
},
"tags": []
},
- "outputs": [],
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "sagemaker.config INFO - Not applying SDK defaults from location: /etc/xdg/sagemaker/config.yaml\n",
+ "sagemaker.config INFO - Not applying SDK defaults from location: /root/.config/sagemaker/config.yaml\n"
+ ]
+ },
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "Using model 'meta-textgeneration-llama-codellama-7b' with wildcard version identifier '*'. You can pin to version '2.0.0' for more stable results. Note that models may have different input/output signatures after a major version upgrade.\n",
+ "Using model 'meta-textgeneration-llama-codellama-7b' with wildcard version identifier '*'. You can pin to version '2.0.0' for more stable results. Note that models may have different input/output signatures after a major version upgrade.\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "---------!"
+ ]
+ }
+ ],
"source": [
"model_id = \"meta-textgeneration-llama-codellama-7b\"\n",
"\n",
"from sagemaker.jumpstart.model import JumpStartModel\n",
"\n",
"model = JumpStartModel(model_id=model_id)\n",
- "predictor = model.deploy()"
+ "predictor = model.deploy(accept_eula = True)"
]
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 5,
"metadata": {
"tags": []
},
- "outputs": [],
+ "outputs": [
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "The endpoint attribute has been renamed in sagemaker>=2.\n",
+ "See: https://sagemaker.readthedocs.io/en/stable/v2.html for details.\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "meta-textgeneration-llama-codellama-7b-2024-02-05-20-09-07-925\n"
+ ]
+ }
+ ],
"source": [
"# Get the name of the endpoint\n",
"endpoint_name = str(predictor.endpoint)\n",
@@ -110,7 +540,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 6,
"metadata": {
"tags": []
},
@@ -168,7 +598,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 7,
"metadata": {
"tags": []
},
@@ -176,12 +606,12 @@
"source": [
"def print_completion(prompt: str, response: str) -> None:\n",
" bold, unbold = '\\033[1m', '\\033[0m'\n",
- " print(f\"{bold}> Input{unbold}\\n{prompt}{bold}\\n> Output{unbold}\\n{response['generated_text']}\\n\")"
+ " print(f\"{bold}> Input{unbold}\\n{prompt}{bold}\\n> Output{unbold}\\n{response[0]['generated_text']}\\n\")"
]
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 8,
"metadata": {
"collapsed": false,
"jupyter": {
@@ -189,7 +619,62 @@
},
"tags": []
},
- "outputs": [],
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\u001b[1m> Input\u001b[0m\n",
+ "import sagemaker\n",
+ "\n",
+ "# Create an HTML page about Amazon SageMaker\n",
+ "html_content = f'''\n",
+ "\n",
+ "\n",
+ "
\n",
+ " Amazon SageMaker\n",
+ "\n",
+ "\n",
+ " Welcome to Amazon SageMaker
\n",
+ " Amazon SageMaker is a fully managed service for building, training, and deploying machine learning models.
\n",
+ " Key Features
\n",
+ " \n",
+ " - Easy to use
\n",
+ " - Scalable
\n",
+ " - End-to-end machine learning workflow
\n",
+ "
\n",
+ " Get started with SageMaker today and unlock the power of machine learning!
\n",
+ "\n",
+ "\n",
+ "'''\n",
+ "\n",
+ "html_content\n",
+ "\u001b[1m\n",
+ "> Output\u001b[0m\n",
+ "\n",
+ "# Create a SageMaker client\n",
+ "sagemaker_client = sagemaker.SageMakerClient()\n",
+ "\n",
+ "# Create a SageMaker model\n",
+ "sagemaker_model = sagemaker.Model(\n",
+ " model_data='s3://sagemaker-us-east-1-123456789012/model/model.tar.gz',\n",
+ " image='123456789012.dkr.ecr.us-east-1.amazonaws.com/sagemaker-scikit-learn:latest',\n",
+ " role='arn:aws:iam::123456789012:role/service-role/AmazonSageMaker-ExecutionRole-20200101T000001',\n",
+ " sagemaker_session=sagemaker_client\n",
+ ")\n",
+ "\n",
+ "# Create a SageMaker endpoint configuration\n",
+ "sagemaker_endpoint_config = sagemaker.EndpointConfig(\n",
+ " name='sagemaker-endpoint-config',\n",
+ " production_variants=[\n",
+ " {\n",
+ " \n",
+ "\n",
+ "CPU times: user 19.6 ms, sys: 0 ns, total: 19.6 ms\n",
+ "Wall time: 8.35 s\n"
+ ]
+ }
+ ],
"source": [
"%%time\n",
"\n",
@@ -237,7 +722,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 10,
"metadata": {
"tags": []
},
@@ -245,16 +730,58 @@
"source": [
"def print_completion(prompt: str, response: str) -> None:\n",
" bold, unbold = '\\033[1m', '\\033[0m'\n",
- " print(f\"{bold}> Input{unbold}\\n{prompt}{bold}\\n> Output{unbold}\\n{response['generated_text']}\\n\")"
+ " print(f\"{bold}> Input{unbold}\\n{prompt}{bold}\\n> Output{unbold}\\n{response[0]['generated_text']}\\n\")"
]
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 11,
"metadata": {
"tags": []
},
- "outputs": [],
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\u001b[1m> Input\u001b[0m\n",
+ "import socket\n",
+ "\n",
+ "def ping_exponential_backoff(host: str):\u001b[1m\n",
+ "> Output\u001b[0m\n",
+ "\n",
+ " \"\"\"\n",
+ " Ping a host with exponential backoff.\n",
+ " :param host: host to ping\n",
+ " :return: True if host is reachable, False otherwise\n",
+ " \"\"\"\n",
+ " # TODO: Implement exponential backoff\n",
+ " # Hint: Use the socket module\n",
+ " # Hint: Use the time module\n",
+ " # Hint: Use the random module\n",
+ " # Hint: Use the logging module\n",
+ " # Hint: Use the sys module\n",
+ " # Hint: Use the traceback module\n",
+ " # Hint: Use the threading module\n",
+ " # Hint: Use the multiprocessing module\n",
+ " # Hint: Use the queue module\n",
+ " # Hint: Use the signal module\n",
+ " # Hint: Use the subprocess module\n",
+ " # Hint: Use the os module\n",
+ " # Hint: Use the re module\n",
+ " # Hint: Use the stat module\n",
+ " # Hint: Use the shutil module\n",
+ " # Hint: Use the pathlib module\n",
+ " # Hint: Use the glob module\n",
+ " # Hint: Use the fnmatch module\n",
+ " # Hint: Use the tempfile module\n",
+ " # Hint:\n",
+ "\n",
+ "CPU times: user 17.6 ms, sys: 228 µs, total: 17.8 ms\n",
+ "Wall time: 8.13 s\n"
+ ]
+ }
+ ],
"source": [
"%%time\n",
"\n",
@@ -271,11 +798,36 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 12,
"metadata": {
"tags": []
},
- "outputs": [],
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\u001b[1m> Input\u001b[0m\n",
+ "import argparse\n",
+ "\n",
+ "def main(string: str):\n",
+ " print(string)\n",
+ " print(string[::-1])\n",
+ "\n",
+ "if __name__ == \"__main__\":\u001b[1m\n",
+ "> Output\u001b[0m\n",
+ "\n",
+ " parser = argparse.ArgumentParser(description='Reverse a string')\n",
+ " parser.add_argument('string', help='String to reverse')\n",
+ " args = parser.parse_args()\n",
+ " main(args.string)\n",
+ "\n",
+ "\n",
+ "CPU times: user 4.57 ms, sys: 170 µs, total: 4.74 ms\n",
+ "Wall time: 1.68 s\n"
+ ]
+ }
+ ],
"source": [
"%%time\n",
"\n",
@@ -306,7 +858,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 13,
"metadata": {
"tags": []
},
@@ -320,16 +872,38 @@
"def print_infilling(prompt: str, response: str) -> str:\n",
" green, font_reset = \"\\x1b[38;5;2m\", \"\\x1b[0m\"\n",
" prefix, suffix = prompt.split(\"\")\n",
- " print(f\"{prefix}{green}{response['generated_text']}{font_reset}{suffix}\")"
+ " print(f\"{prefix}{green}{response[0]['generated_text']}{font_reset}{suffix}\")"
]
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 14,
"metadata": {
"tags": []
},
- "outputs": [],
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "def remove_non_ascii(s: str) -> str:\n",
+ " \"\"\"\u001b[38;5;2m\n",
+ " Remove non-ASCII characters from a string.\n",
+ "\n",
+ " :param s: The string to remove non-ASCII characters from.\n",
+ " :return: The string with non-ASCII characters removed.\n",
+ " \"\"\"\n",
+ " result = \"\"\n",
+ " for c in s:\n",
+ " if ord(c) < 128:\n",
+ " result += c\u001b[0m\n",
+ " return result\n",
+ "\n",
+ "CPU times: user 3.64 ms, sys: 1.52 ms, total: 5.16 ms\n",
+ "Wall time: 2.51 s\n"
+ ]
+ }
+ ],
"source": [
"%%time\n",
"\n",
@@ -349,11 +923,28 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 15,
"metadata": {
"tags": []
},
- "outputs": [],
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "# Installation instructions:\n",
+ " ```bash\n",
+ "\u001b[38;5;2m git clone https://github.com/LLaMA-AI/LLaMA-inference.git\n",
+ " cd LLaMA-inference\n",
+ " pip install -e .\u001b[0m\n",
+ " ```\n",
+ "This downloads the LLaMA inference code and installs the repository as a local pip package.\n",
+ "\n",
+ "CPU times: user 1.53 ms, sys: 3.53 ms, total: 5.06 ms\n",
+ "Wall time: 1.3 s\n"
+ ]
+ }
+ ],
"source": [
"%%time\n",
"\n",
@@ -375,11 +966,34 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 16,
"metadata": {
"tags": []
},
- "outputs": [],
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "class InterfaceManagerFactory(AbstractManagerFactory):\n",
+ " def __init__(\u001b[38;5;2mself, start):\n",
+ " self.start = start\n",
+ "\n",
+ " def build(self, id):\n",
+ " return InterfaceManager(id, self.start)\n",
+ "\n",
+ "\u001b[0m\n",
+ "def main():\n",
+ " factory = InterfaceManagerFactory(start=datetime.now())\n",
+ " managers = []\n",
+ " for i in range(10):\n",
+ " managers.append(factory.build(id=i))\n",
+ "\n",
+ "CPU times: user 4.32 ms, sys: 2.58 ms, total: 6.91 ms\n",
+ "Wall time: 1.19 s\n"
+ ]
+ }
+ ],
"source": [
"%%time\n",
"\n",
@@ -403,11 +1017,37 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 17,
"metadata": {
"tags": []
},
- "outputs": [],
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "/-- A quasi-prefunctoid is 1-connected iff all its etalisations are 1-connected. -/\n",
+ "theorem connected_iff_etalisation [C D : precategoroid] (P : quasi_prefunctoid C D) :\n",
+ " π₁ P = 0 ↔ \u001b[38;5;2m∀ f : C ⟶ D, π₁ (P.etalise f)\u001b[0m = 0 :=\n",
+ "begin\n",
+ " split,\n",
+ " { intros h f,\n",
+ " rw pi_1_etalisation at h,\n",
+ " simp [h],\n",
+ " refl\n",
+ " },\n",
+ " { intro h,\n",
+ " have := @quasi_adjoint C D P,\n",
+ " simp [←pi_1_etalisation, this, h],\n",
+ " refl\n",
+ " }\n",
+ "end\n",
+ "\n",
+ "CPU times: user 5.68 ms, sys: 0 ns, total: 5.68 ms\n",
+ "Wall time: 668 ms\n"
+ ]
+ }
+ ],
"source": [
"%%time\n",
"\n",
@@ -448,7 +1088,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 18,
"metadata": {
"tags": []
},
@@ -456,6 +1096,13 @@
"source": [
"predictor.delete_endpoint()"
]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": []
}
],
"metadata": {
@@ -1032,6 +1679,36 @@
"memoryGiB": 1152,
"name": "ml.p4de.24xlarge",
"vcpuNum": 96
+ },
+ {
+ "_defaultOrder": 57,
+ "_isFastLaunch": false,
+ "category": "Accelerated computing",
+ "gpuNum": 0,
+ "hideHardwareSpecs": false,
+ "memoryGiB": 32,
+ "name": "ml.trn1.2xlarge",
+ "vcpuNum": 8
+ },
+ {
+ "_defaultOrder": 58,
+ "_isFastLaunch": false,
+ "category": "Accelerated computing",
+ "gpuNum": 0,
+ "hideHardwareSpecs": false,
+ "memoryGiB": 512,
+ "name": "ml.trn1.32xlarge",
+ "vcpuNum": 128
+ },
+ {
+ "_defaultOrder": 59,
+ "_isFastLaunch": false,
+ "category": "Accelerated computing",
+ "gpuNum": 0,
+ "hideHardwareSpecs": false,
+ "memoryGiB": 512,
+ "name": "ml.trn1n.32xlarge",
+ "vcpuNum": 128
}
],
"instance_type": "ml.t3.medium",
diff --git a/text-to-image/stable-diffusion-finetune.ipynb b/text-to-image/stable-diffusion-finetune.ipynb
index 40c62b4..bdfd256 100644
--- a/text-to-image/stable-diffusion-finetune.ipynb
+++ b/text-to-image/stable-diffusion-finetune.ipynb
@@ -509,6 +509,7 @@
"_isFastLaunch": true,
"category": "General purpose",
"gpuNum": 0,
+ "hideHardwareSpecs": false,
"memoryGiB": 4,
"name": "ml.t3.medium",
"vcpuNum": 2
@@ -518,6 +519,7 @@
"_isFastLaunch": false,
"category": "General purpose",
"gpuNum": 0,
+ "hideHardwareSpecs": false,
"memoryGiB": 8,
"name": "ml.t3.large",
"vcpuNum": 2
@@ -527,6 +529,7 @@
"_isFastLaunch": false,
"category": "General purpose",
"gpuNum": 0,
+ "hideHardwareSpecs": false,
"memoryGiB": 16,
"name": "ml.t3.xlarge",
"vcpuNum": 4
@@ -536,6 +539,7 @@
"_isFastLaunch": false,
"category": "General purpose",
"gpuNum": 0,
+ "hideHardwareSpecs": false,
"memoryGiB": 32,
"name": "ml.t3.2xlarge",
"vcpuNum": 8
@@ -545,6 +549,7 @@
"_isFastLaunch": true,
"category": "General purpose",
"gpuNum": 0,
+ "hideHardwareSpecs": false,
"memoryGiB": 8,
"name": "ml.m5.large",
"vcpuNum": 2
@@ -554,6 +559,7 @@
"_isFastLaunch": false,
"category": "General purpose",
"gpuNum": 0,
+ "hideHardwareSpecs": false,
"memoryGiB": 16,
"name": "ml.m5.xlarge",
"vcpuNum": 4
@@ -563,6 +569,7 @@
"_isFastLaunch": false,
"category": "General purpose",
"gpuNum": 0,
+ "hideHardwareSpecs": false,
"memoryGiB": 32,
"name": "ml.m5.2xlarge",
"vcpuNum": 8
@@ -572,6 +579,7 @@
"_isFastLaunch": false,
"category": "General purpose",
"gpuNum": 0,
+ "hideHardwareSpecs": false,
"memoryGiB": 64,
"name": "ml.m5.4xlarge",
"vcpuNum": 16
@@ -581,6 +589,7 @@
"_isFastLaunch": false,
"category": "General purpose",
"gpuNum": 0,
+ "hideHardwareSpecs": false,
"memoryGiB": 128,
"name": "ml.m5.8xlarge",
"vcpuNum": 32
@@ -590,6 +599,7 @@
"_isFastLaunch": false,
"category": "General purpose",
"gpuNum": 0,
+ "hideHardwareSpecs": false,
"memoryGiB": 192,
"name": "ml.m5.12xlarge",
"vcpuNum": 48
@@ -599,6 +609,7 @@
"_isFastLaunch": false,
"category": "General purpose",
"gpuNum": 0,
+ "hideHardwareSpecs": false,
"memoryGiB": 256,
"name": "ml.m5.16xlarge",
"vcpuNum": 64
@@ -608,6 +619,7 @@
"_isFastLaunch": false,
"category": "General purpose",
"gpuNum": 0,
+ "hideHardwareSpecs": false,
"memoryGiB": 384,
"name": "ml.m5.24xlarge",
"vcpuNum": 96
@@ -617,6 +629,7 @@
"_isFastLaunch": false,
"category": "General purpose",
"gpuNum": 0,
+ "hideHardwareSpecs": false,
"memoryGiB": 8,
"name": "ml.m5d.large",
"vcpuNum": 2
@@ -626,6 +639,7 @@
"_isFastLaunch": false,
"category": "General purpose",
"gpuNum": 0,
+ "hideHardwareSpecs": false,
"memoryGiB": 16,
"name": "ml.m5d.xlarge",
"vcpuNum": 4
@@ -635,6 +649,7 @@
"_isFastLaunch": false,
"category": "General purpose",
"gpuNum": 0,
+ "hideHardwareSpecs": false,
"memoryGiB": 32,
"name": "ml.m5d.2xlarge",
"vcpuNum": 8
@@ -644,6 +659,7 @@
"_isFastLaunch": false,
"category": "General purpose",
"gpuNum": 0,
+ "hideHardwareSpecs": false,
"memoryGiB": 64,
"name": "ml.m5d.4xlarge",
"vcpuNum": 16
@@ -653,6 +669,7 @@
"_isFastLaunch": false,
"category": "General purpose",
"gpuNum": 0,
+ "hideHardwareSpecs": false,
"memoryGiB": 128,
"name": "ml.m5d.8xlarge",
"vcpuNum": 32
@@ -662,6 +679,7 @@
"_isFastLaunch": false,
"category": "General purpose",
"gpuNum": 0,
+ "hideHardwareSpecs": false,
"memoryGiB": 192,
"name": "ml.m5d.12xlarge",
"vcpuNum": 48
@@ -671,6 +689,7 @@
"_isFastLaunch": false,
"category": "General purpose",
"gpuNum": 0,
+ "hideHardwareSpecs": false,
"memoryGiB": 256,
"name": "ml.m5d.16xlarge",
"vcpuNum": 64
@@ -680,315 +699,413 @@
"_isFastLaunch": false,
"category": "General purpose",
"gpuNum": 0,
+ "hideHardwareSpecs": false,
"memoryGiB": 384,
"name": "ml.m5d.24xlarge",
"vcpuNum": 96
},
{
"_defaultOrder": 20,
+ "_isFastLaunch": false,
+ "category": "General purpose",
+ "gpuNum": 0,
+ "hideHardwareSpecs": true,
+ "memoryGiB": 0,
+ "name": "ml.geospatial.interactive",
+ "supportedImageNames": [
+ "sagemaker-geospatial-v1-0"
+ ],
+ "vcpuNum": 0
+ },
+ {
+ "_defaultOrder": 21,
"_isFastLaunch": true,
"category": "Compute optimized",
"gpuNum": 0,
+ "hideHardwareSpecs": false,
"memoryGiB": 4,
"name": "ml.c5.large",
"vcpuNum": 2
},
{
- "_defaultOrder": 21,
+ "_defaultOrder": 22,
"_isFastLaunch": false,
"category": "Compute optimized",
"gpuNum": 0,
+ "hideHardwareSpecs": false,
"memoryGiB": 8,
"name": "ml.c5.xlarge",
"vcpuNum": 4
},
{
- "_defaultOrder": 22,
+ "_defaultOrder": 23,
"_isFastLaunch": false,
"category": "Compute optimized",
"gpuNum": 0,
+ "hideHardwareSpecs": false,
"memoryGiB": 16,
"name": "ml.c5.2xlarge",
"vcpuNum": 8
},
{
- "_defaultOrder": 23,
+ "_defaultOrder": 24,
"_isFastLaunch": false,
"category": "Compute optimized",
"gpuNum": 0,
+ "hideHardwareSpecs": false,
"memoryGiB": 32,
"name": "ml.c5.4xlarge",
"vcpuNum": 16
},
{
- "_defaultOrder": 24,
+ "_defaultOrder": 25,
"_isFastLaunch": false,
"category": "Compute optimized",
"gpuNum": 0,
+ "hideHardwareSpecs": false,
"memoryGiB": 72,
"name": "ml.c5.9xlarge",
"vcpuNum": 36
},
{
- "_defaultOrder": 25,
+ "_defaultOrder": 26,
"_isFastLaunch": false,
"category": "Compute optimized",
"gpuNum": 0,
+ "hideHardwareSpecs": false,
"memoryGiB": 96,
"name": "ml.c5.12xlarge",
"vcpuNum": 48
},
{
- "_defaultOrder": 26,
+ "_defaultOrder": 27,
"_isFastLaunch": false,
"category": "Compute optimized",
"gpuNum": 0,
+ "hideHardwareSpecs": false,
"memoryGiB": 144,
"name": "ml.c5.18xlarge",
"vcpuNum": 72
},
{
- "_defaultOrder": 27,
+ "_defaultOrder": 28,
"_isFastLaunch": false,
"category": "Compute optimized",
"gpuNum": 0,
+ "hideHardwareSpecs": false,
"memoryGiB": 192,
"name": "ml.c5.24xlarge",
"vcpuNum": 96
},
{
- "_defaultOrder": 28,
+ "_defaultOrder": 29,
"_isFastLaunch": true,
"category": "Accelerated computing",
"gpuNum": 1,
+ "hideHardwareSpecs": false,
"memoryGiB": 16,
"name": "ml.g4dn.xlarge",
"vcpuNum": 4
},
{
- "_defaultOrder": 29,
+ "_defaultOrder": 30,
"_isFastLaunch": false,
"category": "Accelerated computing",
"gpuNum": 1,
+ "hideHardwareSpecs": false,
"memoryGiB": 32,
"name": "ml.g4dn.2xlarge",
"vcpuNum": 8
},
{
- "_defaultOrder": 30,
+ "_defaultOrder": 31,
"_isFastLaunch": false,
"category": "Accelerated computing",
"gpuNum": 1,
+ "hideHardwareSpecs": false,
"memoryGiB": 64,
"name": "ml.g4dn.4xlarge",
"vcpuNum": 16
},
{
- "_defaultOrder": 31,
+ "_defaultOrder": 32,
"_isFastLaunch": false,
"category": "Accelerated computing",
"gpuNum": 1,
+ "hideHardwareSpecs": false,
"memoryGiB": 128,
"name": "ml.g4dn.8xlarge",
"vcpuNum": 32
},
{
- "_defaultOrder": 32,
+ "_defaultOrder": 33,
"_isFastLaunch": false,
"category": "Accelerated computing",
"gpuNum": 4,
+ "hideHardwareSpecs": false,
"memoryGiB": 192,
"name": "ml.g4dn.12xlarge",
"vcpuNum": 48
},
{
- "_defaultOrder": 33,
+ "_defaultOrder": 34,
"_isFastLaunch": false,
"category": "Accelerated computing",
"gpuNum": 1,
+ "hideHardwareSpecs": false,
"memoryGiB": 256,
"name": "ml.g4dn.16xlarge",
"vcpuNum": 64
},
{
- "_defaultOrder": 34,
+ "_defaultOrder": 35,
"_isFastLaunch": false,
"category": "Accelerated computing",
"gpuNum": 1,
+ "hideHardwareSpecs": false,
"memoryGiB": 61,
"name": "ml.p3.2xlarge",
"vcpuNum": 8
},
{
- "_defaultOrder": 35,
+ "_defaultOrder": 36,
"_isFastLaunch": false,
"category": "Accelerated computing",
"gpuNum": 4,
+ "hideHardwareSpecs": false,
"memoryGiB": 244,
"name": "ml.p3.8xlarge",
"vcpuNum": 32
},
{
- "_defaultOrder": 36,
+ "_defaultOrder": 37,
"_isFastLaunch": false,
"category": "Accelerated computing",
"gpuNum": 8,
+ "hideHardwareSpecs": false,
"memoryGiB": 488,
"name": "ml.p3.16xlarge",
"vcpuNum": 64
},
{
- "_defaultOrder": 37,
+ "_defaultOrder": 38,
"_isFastLaunch": false,
"category": "Accelerated computing",
"gpuNum": 8,
+ "hideHardwareSpecs": false,
"memoryGiB": 768,
"name": "ml.p3dn.24xlarge",
"vcpuNum": 96
},
{
- "_defaultOrder": 38,
+ "_defaultOrder": 39,
"_isFastLaunch": false,
"category": "Memory Optimized",
"gpuNum": 0,
+ "hideHardwareSpecs": false,
"memoryGiB": 16,
"name": "ml.r5.large",
"vcpuNum": 2
},
{
- "_defaultOrder": 39,
+ "_defaultOrder": 40,
"_isFastLaunch": false,
"category": "Memory Optimized",
"gpuNum": 0,
+ "hideHardwareSpecs": false,
"memoryGiB": 32,
"name": "ml.r5.xlarge",
"vcpuNum": 4
},
{
- "_defaultOrder": 40,
+ "_defaultOrder": 41,
"_isFastLaunch": false,
"category": "Memory Optimized",
"gpuNum": 0,
+ "hideHardwareSpecs": false,
"memoryGiB": 64,
"name": "ml.r5.2xlarge",
"vcpuNum": 8
},
{
- "_defaultOrder": 41,
+ "_defaultOrder": 42,
"_isFastLaunch": false,
"category": "Memory Optimized",
"gpuNum": 0,
+ "hideHardwareSpecs": false,
"memoryGiB": 128,
"name": "ml.r5.4xlarge",
"vcpuNum": 16
},
{
- "_defaultOrder": 42,
+ "_defaultOrder": 43,
"_isFastLaunch": false,
"category": "Memory Optimized",
"gpuNum": 0,
+ "hideHardwareSpecs": false,
"memoryGiB": 256,
"name": "ml.r5.8xlarge",
"vcpuNum": 32
},
{
- "_defaultOrder": 43,
+ "_defaultOrder": 44,
"_isFastLaunch": false,
"category": "Memory Optimized",
"gpuNum": 0,
+ "hideHardwareSpecs": false,
"memoryGiB": 384,
"name": "ml.r5.12xlarge",
"vcpuNum": 48
},
{
- "_defaultOrder": 44,
+ "_defaultOrder": 45,
"_isFastLaunch": false,
"category": "Memory Optimized",
"gpuNum": 0,
+ "hideHardwareSpecs": false,
"memoryGiB": 512,
"name": "ml.r5.16xlarge",
"vcpuNum": 64
},
{
- "_defaultOrder": 45,
+ "_defaultOrder": 46,
"_isFastLaunch": false,
"category": "Memory Optimized",
"gpuNum": 0,
+ "hideHardwareSpecs": false,
"memoryGiB": 768,
"name": "ml.r5.24xlarge",
"vcpuNum": 96
},
{
- "_defaultOrder": 46,
+ "_defaultOrder": 47,
"_isFastLaunch": false,
"category": "Accelerated computing",
"gpuNum": 1,
+ "hideHardwareSpecs": false,
"memoryGiB": 16,
"name": "ml.g5.xlarge",
"vcpuNum": 4
},
{
- "_defaultOrder": 47,
+ "_defaultOrder": 48,
"_isFastLaunch": false,
"category": "Accelerated computing",
"gpuNum": 1,
+ "hideHardwareSpecs": false,
"memoryGiB": 32,
"name": "ml.g5.2xlarge",
"vcpuNum": 8
},
{
- "_defaultOrder": 48,
+ "_defaultOrder": 49,
"_isFastLaunch": false,
"category": "Accelerated computing",
"gpuNum": 1,
+ "hideHardwareSpecs": false,
"memoryGiB": 64,
"name": "ml.g5.4xlarge",
"vcpuNum": 16
},
{
- "_defaultOrder": 49,
+ "_defaultOrder": 50,
"_isFastLaunch": false,
"category": "Accelerated computing",
"gpuNum": 1,
+ "hideHardwareSpecs": false,
"memoryGiB": 128,
"name": "ml.g5.8xlarge",
"vcpuNum": 32
},
{
- "_defaultOrder": 50,
+ "_defaultOrder": 51,
"_isFastLaunch": false,
"category": "Accelerated computing",
"gpuNum": 1,
+ "hideHardwareSpecs": false,
"memoryGiB": 256,
"name": "ml.g5.16xlarge",
"vcpuNum": 64
},
{
- "_defaultOrder": 51,
+ "_defaultOrder": 52,
"_isFastLaunch": false,
"category": "Accelerated computing",
"gpuNum": 4,
+ "hideHardwareSpecs": false,
"memoryGiB": 192,
"name": "ml.g5.12xlarge",
"vcpuNum": 48
},
{
- "_defaultOrder": 52,
+ "_defaultOrder": 53,
"_isFastLaunch": false,
"category": "Accelerated computing",
"gpuNum": 4,
+ "hideHardwareSpecs": false,
"memoryGiB": 384,
"name": "ml.g5.24xlarge",
"vcpuNum": 96
},
{
- "_defaultOrder": 53,
+ "_defaultOrder": 54,
"_isFastLaunch": false,
"category": "Accelerated computing",
"gpuNum": 8,
+ "hideHardwareSpecs": false,
"memoryGiB": 768,
"name": "ml.g5.48xlarge",
"vcpuNum": 192
+ },
+ {
+ "_defaultOrder": 55,
+ "_isFastLaunch": false,
+ "category": "Accelerated computing",
+ "gpuNum": 8,
+ "hideHardwareSpecs": false,
+ "memoryGiB": 1152,
+ "name": "ml.p4d.24xlarge",
+ "vcpuNum": 96
+ },
+ {
+ "_defaultOrder": 56,
+ "_isFastLaunch": false,
+ "category": "Accelerated computing",
+ "gpuNum": 8,
+ "hideHardwareSpecs": false,
+ "memoryGiB": 1152,
+ "name": "ml.p4de.24xlarge",
+ "vcpuNum": 96
+ },
+ {
+ "_defaultOrder": 57,
+ "_isFastLaunch": false,
+ "category": "Accelerated computing",
+ "gpuNum": 0,
+ "hideHardwareSpecs": false,
+ "memoryGiB": 32,
+ "name": "ml.trn1.2xlarge",
+ "vcpuNum": 8
+ },
+ {
+ "_defaultOrder": 58,
+ "_isFastLaunch": false,
+ "category": "Accelerated computing",
+ "gpuNum": 0,
+ "hideHardwareSpecs": false,
+ "memoryGiB": 512,
+ "name": "ml.trn1.32xlarge",
+ "vcpuNum": 128
+ },
+ {
+ "_defaultOrder": 59,
+ "_isFastLaunch": false,
+ "category": "Accelerated computing",
+ "gpuNum": 0,
+ "hideHardwareSpecs": false,
+ "memoryGiB": 512,
+ "name": "ml.trn1n.32xlarge",
+ "vcpuNum": 128
}
],
"instance_type": "ml.t3.medium",
diff --git a/text-to-image/stable-diffusion-inference.ipynb b/text-to-image/stable-diffusion-inference.ipynb
index 91c69e6..10233a7 100644
--- a/text-to-image/stable-diffusion-inference.ipynb
+++ b/text-to-image/stable-diffusion-inference.ipynb
@@ -2,62 +2,53 @@
"cells": [
{
"cell_type": "markdown",
- "id": "16c61f54",
+ "id": "380b51db-e36e-4c72-9a10-d5a2f603c30f",
"metadata": {},
"source": [
- "# Introduction to JumpStart - Text to Image"
+ "# SageMaker JumpStart - Image Generation"
]
},
{
"cell_type": "markdown",
- "id": "bdc23bae",
+ "id": "c7b4a417",
"metadata": {},
"source": [
- "***\n",
- "Welcome to Amazon [SageMaker JumpStart](https://docs.aws.amazon.com/sagemaker/latest/dg/studio-jumpstart.html)! You can use JumpStart to solve many Machine Learning tasks through one-click in SageMaker Studio, or through [SageMaker JumpStart API](https://sagemaker.readthedocs.io/en/stable/overview.html#use-prebuilt-models-with-sagemaker-jumpstart). In this demo notebook, we demonstrate how to use the JumpStart API to generate images from text using state-of-the-art Stable Diffusion models. Furthermore, we show how to fine-tune the model to your dataset.\n",
- "\n",
- "Stable Diffusion is a text-to-image model that enables you to create photorealistic images from just a text prompt. A diffusion model trains by learning to remove noise that was added to a real image. This de-noising process generates a realistic image. These models can also generate images from text alone by conditioning the generation process on the text. For instance, Stable Diffusion is a latent diffusion where the model learns to recognize shapes in a pure noise image and gradually brings these shapes into focus if the shapes match the words in the input text.\n",
- "\n",
- "Training and deploying large models and running inference on models such as Stable Diffusion is often challenging and include issues such as cuda out of memory, payload size limit exceeded and so on. JumpStart simplifies this process by providing ready-to-use scripts that have been robustly tested. Furthermore, it provides guidance on each step of the process including the recommended instance types, how to select parameters to guide image generation process, prompt engineering etc. Moreover, you can deploy and run inference on any of the 80+ Diffusion models from JumpStart without having to write any piece of your own code.\n",
- "\n",
- "In this notebook, you will learn how to use JumpStart to generate highly realistic and artistic images of any subject/object/environment/scene. This may be as simple as an image of a cute dog or as detailed as a hyper-realistic image of a beautifully decoraded cozy kitchen by pixer in the style of greg rutkowski with dramatic sunset lighting and long shadows with cinematic atmosphere. This can be used to design products and build catalogs for ecommerce business needs or to generate realistic art pieces or stock images.\n",
+ "---\n",
"\n",
+ "This notebook's CI test result for us-west-2 is as follows. CI test results in other regions can be found at the end of the notebook.\n",
"\n",
- "Model lincese: By using this model, you agree to the [CreativeML Open RAIL-M++ license](https://huggingface.co/stabilityai/stable-diffusion-2/blob/main/LICENSE-MODEL).\n",
+ "\n",
"\n",
- "***"
+ "---"
]
},
{
"cell_type": "markdown",
- "id": "5db28351",
+ "id": "e740afe5",
"metadata": {},
"source": [
- "1. [Set Up](#1.-Set-Up)\n",
- "2. [Run inference on the pre-trained model](#2.-Run-inference-on-the-pre-trained-model)\n",
- " * [Select a model](#2.1.-Select-a-Model)\n",
- " * [Retrieve JumpStart Artifacts & Deploy an Endpoint](#2.2.-Retrieve-JumpStart-Artifacts-&-Deploy-an-Endpoint)\n",
- " * [Query endpoint and parse response](#2.3.-Query-endpoint-and-parse-response)\n",
- " * [Supported Inference parameters](#2.4.-Supported-Inference-parameters)\n",
- " * [Compressed Image Output](#2.5.-Compressed-Image-Output)\n",
- " * [Prompt Engineering](#2.6.-Prompt-Engineering)\n",
- " * [Clean up the endpoint](#2.7.-Clean-up-the-endpoint)\n",
- "3. [Conclusion](#3.-Conclusion)\n"
+ "---\n",
+ "Welcome to [Amazon SageMaker Jumpstart](https://docs.aws.amazon.com/sagemaker/latest/dg/studio-jumpstart.html)! You can use Amazon SageMaker Jumpstart to solve many Machine Learning tasks through one-click in SageMaker Studio, or through [SageMaker Python SDK](https://sagemaker.readthedocs.io/en/stable/overview.html#use-prebuilt-models-with-sagemaker-jumpstart).\n",
+ "\n",
+ "In this demo notebook, we demonstrate how to use the SageMaker Python SDK to deploy Stable Diffusion models for image generation task. The container being utilized here is a customized stabilityai container that has been optimized to excel in terms of both speed and quality. We demonstrate how to use SageMaker Python SDK for Text-to-Image and Image-to-Image generation. Text-to-Image is the task of generating realistic image given any text input. Here, we show how to use state-of-the-art pre-trained Stable Diffusion models for generating image from text and image.\n",
+ "\n",
+ "---"
]
},
{
"cell_type": "markdown",
- "id": "ce462973",
+ "id": "d2b17eca",
"metadata": {},
"source": [
- "Note: This notebook was tested on ml.t3.medium instance in Amazon SageMaker Studio with Python 3 (Data Science 2.0) kernel and in Amazon SageMaker Notebook instance with conda_python3 kernel. If using Workshop Studio accounts, make sure that you're using the Data Science 2.0 Kernel.\n",
- "\n",
- "Note: To deploy the pre-trained model, you can use the `ml.g4dn.2xlarge` instance type. If `ml.g5.2xlarge` is available in your region, we recommend using that instance type for deployment. "
+ "1. [Set Up](#1.-Set-Up)\n",
+ "2. [Select a model](#2.-Select-a-model)\n",
+ "3. [Deploy an endpoint & Query endpoint](#3.-Deploy-an-Endpoint-&-Query-endpoint)\n",
+ "4. [Clean Endpoint](#4.-Clean-Endpoint)"
]
},
{
"cell_type": "markdown",
- "id": "9ea47727",
+ "id": "ba8c73ef",
"metadata": {},
"source": [
"### 1. Set Up"
@@ -65,78 +56,95 @@
},
{
"cell_type": "markdown",
- "id": "35b91e81",
+ "id": "fe1848c2",
"metadata": {},
"source": [
- "***\n",
- "Before executing the notebook, there are some initial steps required for set up. This notebook requires latest version of sagemaker and ipywidgets\n",
+ "---\n",
+ "Before executing the notebook, there are some initial steps required for set up\n",
"\n",
- "***"
+ "---"
]
},
{
"cell_type": "code",
"execution_count": null,
- "id": "25293522",
+ "id": "b4c9977e",
"metadata": {
+ "jumpStartAlterations": [
+ "dropModelSelection"
+ ],
"tags": []
},
"outputs": [],
"source": [
- "!pip install ipywidgets==7.0.0 --quiet"
+ "%pip install --upgrade sagemaker --quiet"
]
},
{
"cell_type": "markdown",
- "id": "48370155",
+ "id": "3903a7ce",
"metadata": {},
"source": [
- "#### Permissions and environment variables\n",
- "\n",
- "***\n",
- "To host on Amazon SageMaker, we need to set up and authenticate the use of AWS services. Here, we use the execution role associated with the current notebook as the AWS account role with SageMaker access.\n",
- "\n",
- "***"
+ "## 2. Select a pre-trained model"
]
},
{
"cell_type": "code",
"execution_count": null,
- "id": "90518e45",
+ "id": "9e91d71a",
"metadata": {
+ "jumpStartAlterations": [
+ "dropModelSelection"
+ ],
"tags": []
},
"outputs": [],
"source": [
- "import sagemaker, boto3, json\n",
- "from sagemaker import get_execution_role\n",
- "\n",
- "aws_role = get_execution_role()\n",
- "aws_region = boto3.Session().region_name\n",
- "sess = sagemaker.Session()"
+ "model_id = \"model-imagegeneration-stabilityai-stable-diffusion-xl-base-1-0\""
]
},
{
- "cell_type": "markdown",
- "id": "310fca48",
- "metadata": {},
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "adc4ba45",
+ "metadata": {
+ "jumpStartAlterations": [
+ "dropModelSelection"
+ ],
+ "tags": []
+ },
+ "outputs": [],
"source": [
- "## 2. Run inference on the pre-trained model\n",
+ "import IPython\n",
+ "from ipywidgets import Dropdown\n",
+ "from sagemaker.jumpstart.notebook_utils import list_jumpstart_models\n",
+ "from sagemaker.jumpstart.filters import And\n",
"\n",
- "***\n",
"\n",
- "Using JumpStart, we can perform inference on the pre-trained model, even without fine-tuning it first on a new dataset.\n",
- "***"
+ "filter_value = And(\"task == imagegeneration\")\n",
+ "ss_models = list_jumpstart_models(filter=filter_value)\n",
+ "\n",
+ "dropdown = Dropdown(\n",
+ " value=model_id,\n",
+ " options=ss_models,\n",
+ " description=\"Sagemaker Pre-Trained Image Generation Models:\",\n",
+ " style={\"description_width\": \"initial\"},\n",
+ " layout={\"width\": \"max-content\"},\n",
+ ")\n",
+ "display(IPython.display.Markdown(\"## Select a pre-trained model from the dropdown below\"))\n",
+ "display(dropdown)"
]
},
{
"cell_type": "markdown",
- "id": "0e072e72-8bb4-4a8d-b887-2e9658dc3672",
+ "id": "328e4336",
"metadata": {},
"source": [
- "### 2.1. Select a Model\n",
+ "### 3. Deploy an Endpoint & Query Endpoint\n",
+ "\n",
"***\n",
- "Let's pick the stable diffusion model for deployment as an endpoint. A complete list of SageMaker pre-trained models can also be accessed at [Sagemaker pre-trained Models](https://sagemaker.readthedocs.io/en/stable/doc_utils/pretrainedmodels.html#).\n",
+ "\n",
+ "Using SageMaker, we can perform inference on the pre-trained model.\n",
"\n",
"***"
]
@@ -144,112 +152,83 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "a75e2cd9-c76b-4ed7-a9c5-aed145824aef",
+ "id": "3af5b279",
"metadata": {
+ "jumpStartAlterations": [
+ "dropModelSelection"
+ ],
"tags": []
},
"outputs": [],
"source": [
- "model_id = 'model-txt2img-stabilityai-stable-diffusion-v2-1-base'\n",
- "model_version= \"*\""
+ "# Deploying the model\n",
+ "from sagemaker.jumpstart.model import JumpStartModel\n",
+ "from sagemaker.serializers import JSONSerializer\n",
+ "import time\n",
+ "\n",
+ "# The model is deployed on the ml.g5.4xlarge instance. To see all the supported parameters by the JumpStartModel\n",
+ "# class use this link - https://sagemaker.readthedocs.io/en/stable/api/inference/model.html#sagemaker.jumpstart.model.JumpStartModel\n",
+ "my_model = JumpStartModel(model_id=dropdown.value)\n",
+ "predictor = my_model.deploy()\n",
+ "# We will wait for a few seconds so model is properly loaded.\n",
+ "time.sleep(60)"
]
},
{
"cell_type": "markdown",
- "id": "282e37a1-e379-4bd3-af2c-02d02fd41d78",
+ "id": "36dd1358",
"metadata": {},
"source": [
- "### 2.2. Retrieve JumpStart Artifacts & Deploy an Endpoint\n",
- "\n",
- "***\n",
- "\n",
- "Using JumpStart, we can perform inference on the pre-trained model, even without fine-tuning it first on a new dataset. We start by retrieving the `deploy_image_uri`, `deploy_source_uri`, and `model_uri` for the pre-trained model. To host the pre-trained model, we create an instance of [sagemaker.model.Model](https://sagemaker.readthedocs.io/en/stable/api/inference/model.html) and deploy it.\n",
- "\n",
- "### This may take upto 10 minutes. Please do not kill the kernel while you wait.\n",
- "\n",
- "While you wait, you can checkout the [Generate images from text with the stable diffusion model on Amazon SageMaker JumpStart](https://aws.amazon.com/blogs/machine-learning/generate-images-from-text-with-the-stable-diffusion-model-on-amazon-sagemaker-jumpstart/) blog to learn more about Stable Diffusion model and JumpStart.\n",
- "\n",
- "\n",
- "***"
+ "Importing relevant packages for querying endpoint and image visualization"
]
},
{
"cell_type": "code",
"execution_count": null,
- "id": "a8a79ec9",
+ "id": "4c2c1462-f9a9-4fc7-8a6f-b7ff3b24c63b",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
- "from sagemaker import image_uris, model_uris, script_uris, hyperparameters\n",
- "from sagemaker.model import Model\n",
- "from sagemaker.predictor import Predictor\n",
- "from sagemaker.utils import name_from_base\n",
- "\n",
- "\n",
- "endpoint_name = name_from_base(f\"jumpstart-example-infer-{model_id}\")\n",
- "\n",
- "# Please use ml.g5.24xlarge instance type if it is available in your region. ml.g5.24xlarge has 24GB GPU compared to 16GB in ml.p3.2xlarge and supports generation of larger and better quality images.\n",
- "inference_instance_type = \"ml.g4dn.2xlarge\"\n",
- "\n",
- "# Retrieve the inference docker container uri. This is the base HuggingFace container image for the default model above.\n",
- "deploy_image_uri = image_uris.retrieve(\n",
- " region=None,\n",
- " framework=None, # automatically inferred from model_id\n",
- " image_scope=\"inference\",\n",
- " model_id=model_id,\n",
- " model_version=model_version,\n",
- " instance_type=inference_instance_type,\n",
- ")\n",
- "\n",
- "# Retrieve the inference script uri. This includes all dependencies and scripts for model loading, inference handling etc.\n",
- "deploy_source_uri = script_uris.retrieve(\n",
- " model_id=model_id, model_version=model_version, script_scope=\"inference\"\n",
- ")\n",
- "\n",
- "\n",
- "# Retrieve the model uri. This includes the pre-trained nvidia-ssd model and parameters.\n",
- "model_uri = model_uris.retrieve(\n",
- " model_id=model_id, model_version=model_version, model_scope=\"inference\"\n",
- ")\n",
- "\n",
- "# To increase the maximum response size from the endpoint.\n",
- "env = {\n",
- " \"MMS_MAX_RESPONSE_SIZE\": \"20000000\",\n",
- "}\n",
- "\n",
- "# Create the SageMaker model instance\n",
- "model = Model(\n",
- " image_uri=deploy_image_uri,\n",
- " source_dir=deploy_source_uri,\n",
- " model_data=model_uri,\n",
- " entry_point=\"inference.py\", # entry point file in source_dir and present in deploy_source_uri\n",
- " role=aws_role,\n",
- " predictor_cls=Predictor,\n",
- " name=endpoint_name,\n",
- " env=env,\n",
- ")\n",
- "\n",
- "# deploy the Model. Note that we need to pass Predictor class when we deploy model through Model class,\n",
- "# for being able to run inference through the sagemaker API.\n",
- "model_predictor = model.deploy(\n",
- " initial_instance_count=1,\n",
- " instance_type=inference_instance_type,\n",
- " predictor_cls=Predictor,\n",
- " endpoint_name=endpoint_name,\n",
- ")"
+ "from PIL import Image\n",
+ "import io\n",
+ "import base64\n",
+ "import json\n",
+ "import boto3\n",
+ "from typing import Union, Tuple\n",
+ "import os"
]
},
{
"cell_type": "markdown",
- "id": "b2e0fd36",
+ "id": "ab6fcceb-0ccc-43af-a204-da1612ca2b59",
"metadata": {},
"source": [
- "### 2.3. Query endpoint and parse response\n",
+ "## Query Stable Diffusion endpoint\n",
+ "\n",
+ "### Supported features\n",
"\n",
"***\n",
- "Input to the endpoint is any string of text dumped in json and encoded in `utf-8` format. Output of the endpoint is a `json` with generated text.\n",
+ "This model supports many advanced parameters while performing inference. They include:\n",
+ "\n",
+ "* **text**: prompt to guide the image generation. Must be specified and should be string.\n",
+ "* **width**: width of the hallucinated image. If specified, it must be a positive integer divisible by 8.\n",
+ "* **height**: height of the hallucinated image. If specified, it must be a positive integer divisible by 8. Image size should be larger than 256x256.\n",
+ "* **sampler**: Available samplers are EulerEDMSampler, HeunEDMSampler,EulerAncestralSampler, DPMPP2SAncestralSampler, DPMPP2MSampler, LinearMultistepSampler\n",
+ "* **cfg_scale**: A higher cfg_scale results in image closely related to the prompt, at the expense of image quality. If specified, it must be a float. cfg_scale<=1 is ignored.\n",
+ "* **steps**: number of denoising steps during image generation. More steps lead to higher quality image. If specified, it must a positive integer.\n",
+ "* **seed**: fix the randomized state for reproducibility. If specified, it must be an integer.\n",
+ "* **use_refiner**: Refiner is used by defauly with the SDXL model. You can disbale it by using this parameter\n",
+ "* **init_image**: Image to be used as the starting point.\n",
+ "* **image_strength**: Indicates extent to transform the reference image. Must be between 0 and 1.\n",
+ "* **refiner_steps**: Number of denoising steps during image generation for the refiner. More steps lead to higher quality image. If specified, it must a positive integer.\n",
+ "* **refiner_strength**: Indicates extent to transform the input image to the refiner.\n",
+ "* **negative_prompt**: guide image generation against this prompt. If specified, it must be a string. It is specified in the text_prompts with a negative weight.\n",
+ "\n",
+ "\n",
+ "***\n",
+ "### Text to Image\n",
"\n",
"***"
]
@@ -257,54 +236,70 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "84fb30d0",
+ "id": "00851369-9e37-4e14-b9ee-f440d538df5b",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
- "import matplotlib.pyplot as plt\n",
- "import numpy as np\n",
- "\n",
- "\n",
- "def query(model_predictor, text):\n",
- " \"\"\"Query the model predictor.\"\"\"\n",
- "\n",
- " encoded_text = text.encode(\"utf-8\")\n",
- "\n",
- " query_response = model_predictor.predict(\n",
- " encoded_text,\n",
- " {\n",
- " \"ContentType\": \"application/x-text\",\n",
- " \"Accept\": \"application/json\",\n",
- " },\n",
- " )\n",
- " return query_response\n",
- "\n",
+ "payload = {\n",
+ " \"text_prompts\": [{\"text\": \"jaguar in the Amazon rainforest\"}],\n",
+ " \"width\": 1024,\n",
+ " \"height\": 1024,\n",
+ " \"sampler\": \"DPMPP2MSampler\",\n",
+ " \"cfg_scale\": 7.0,\n",
+ " \"steps\": 50,\n",
+ " \"seed\": 133,\n",
+ " \"use_refiner\": True,\n",
+ " \"refiner_steps\": 40,\n",
+ " \"refiner_strength\": 0.2,\n",
+ "}"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "c2f50de9",
+ "metadata": {
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
+ },
+ "outputs": [],
+ "source": [
+ "def decode_and_show(model_response) -> None:\n",
+ " \"\"\"\n",
+ " Decodes and displays an image from SDXL output\n",
"\n",
- "def parse_response(query_response):\n",
- " \"\"\"Parse response and return generated image and the prompt\"\"\"\n",
+ " Args:\n",
+ " model_response (GenerationResponse): The response object from the deployed SDXL model.\n",
"\n",
- " response_dict = json.loads(query_response)\n",
- " return response_dict[\"generated_image\"], response_dict[\"prompt\"]\n",
+ " Returns:\n",
+ " None\n",
+ " \"\"\"\n",
+ " image = Image.open(io.BytesIO(base64.b64decode(model_response)))\n",
+ " display(image)\n",
+ " image.close()\n",
"\n",
"\n",
- "def display_img_and_prompt(img, prmpt):\n",
- " \"\"\"Display hallucinated image.\"\"\"\n",
- " plt.figure(figsize=(12, 12))\n",
- " plt.imshow(np.array(img))\n",
- " plt.axis(\"off\")\n",
- " plt.title(prmpt)\n",
- " plt.show()"
+ "response = predictor.predict(payload)\n",
+ "# If you get time out error please check the endpoint logs in cloudWatch for model loading status\n",
+ "# and invoke it again\n",
+ "decode_and_show(response[\"generated_image\"])"
]
},
{
"cell_type": "markdown",
- "id": "aea0434b",
+ "id": "77dc9b26",
"metadata": {},
"source": [
+ "### Image to Image\n",
+ "\n",
"***\n",
- "Below, we put in some example input text. You can put in any text and the model predicts the image corresponding to that text.\n",
+ "To perform inference that takes an image as input, you must pass the image into init_image as a base64-encoded string.\n",
+ "\n",
+ "Below is a helper function for converting images to base64-encoded strings:\n",
"\n",
"***"
]
@@ -312,164 +307,115 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "a5a12e3e-c269-432a-8e41-7e0903c975af",
+ "id": "9a19a41d",
"metadata": {
- "pycharm": {
- "is_executing": true
- },
- "tags": []
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
- "text = \"cottage in impressionist style\"\n",
- "query_response = query(model_predictor, text)\n",
- "img, prmpt = parse_response(query_response)\n",
- "display_img_and_prompt(img, prmpt)"
+ "def encode_image(\n",
+ " image_path: str, resize: bool = True, size: Tuple[int, int] = (1024, 1024)\n",
+ ") -> Union[str, None]:\n",
+ " \"\"\"\n",
+ " Encode an image as a base64 string, optionally resizing it to a supported resolution.\n",
+ "\n",
+ " Args:\n",
+ " image_path (str): The path to the image file.\n",
+ " resize (bool, optional): Whether to resize the image. Defaults to True.\n",
+ "\n",
+ " Returns:\n",
+ " Union[str, None]: The encoded image as a string, or None if encoding failed.\n",
+ " \"\"\"\n",
+ " assert os.path.exists(image_path)\n",
+ "\n",
+ " if resize:\n",
+ " image = Image.open(image_path)\n",
+ " image = image.resize(size)\n",
+ " image.save(\"image_path_resized.png\")\n",
+ " image_path = \"image_path_resized.png\"\n",
+ " image = Image.open(image_path)\n",
+ " assert image.size == size\n",
+ " with open(image_path, \"rb\") as image_file:\n",
+ " img_byte_array = image_file.read()\n",
+ " # Encode the byte array as a Base64 string\n",
+ " try:\n",
+ " base64_str = base64.b64encode(img_byte_array).decode(\"utf-8\")\n",
+ " return base64_str\n",
+ " except Exception as e:\n",
+ " print(f\"Failed to encode image {image_path} as base64 string.\")\n",
+ " print(e)\n",
+ " return None\n",
+ " image.close()"
]
},
{
"cell_type": "markdown",
- "id": "7d591919-1be0-4e9f-b7ff-0aa6e0959053",
- "metadata": {
- "pycharm": {
- "is_executing": true
- }
- },
+ "id": "e65fe817",
+ "metadata": {},
"source": [
- "### 2.4. Supported Inference parameters\n",
- "\n",
- "***\n",
- "This model also supports many advanced parameters while performing inference. They include:\n",
- "\n",
- "* **prompt**: prompt to guide the image generation. Must be specified and can be a string or a list of strings.\n",
- "* **width**: width of the hallucinated image. If specified, it must be a positive integer divisible by 8.\n",
- "* **height**: height of the hallucinated image. If specified, it must be a positive integer divisible by 8.\n",
- "* **num_inference_steps**: Number of denoising steps during image generation. More steps lead to higher quality image. If specified, it must a positive integer.\n",
- "* **guidance_scale**: Higher guidance scale results in image closely related to the prompt, at the expense of image quality. If specified, it must be a float. guidance_scale<=1 is ignored.\n",
- "* **negative_prompt**: guide image generation against this prompt. If specified, it must be a string or a list of strings and used with guidance_scale. If guidance_scale is disabled, this is also disabled. Moreover, if prompt is a list of strings then negative_prompt must also be a list of strings. \n",
- "* **num_images_per_prompt**: number of images returned per prompt. If specified it must be a positive integer. \n",
- "* **seed**: Fix the randomized state for reproducibility. If specified, it must be an integer.\n",
- "\n",
- "***"
+ "Let's feed an image into the model as well as the prompt this time. We can set image_strength to weight the relative importance of the image and the prompt. For the demo, we'll use a picture of the dog."
]
},
{
"cell_type": "code",
"execution_count": null,
- "id": "4fee71b1-5584-4916-bd78-5b895be08d41",
+ "id": "2a4954c3",
"metadata": {
- "pycharm": {
- "is_executing": true
- },
- "tags": []
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
- "import json\n",
- "\n",
- "# Training data for different models had different image sizes and it is often observed that the model performs best when the generated image\n",
- "# has dimensions same as the training data dimension. For dimensions not matching the default dimensions, it may result in a black image.\n",
- "# Stable Diffusion v1-4 was trained on 512x512 images and Stable Diffusion v2 was trained on 768x768 images.\n",
- "payload = {\n",
- " \"prompt\": \"astronaut on a horse\",\n",
- " \"width\": 512,\n",
- " \"height\": 512,\n",
- " \"num_images_per_prompt\": 1,\n",
- " \"num_inference_steps\": 50,\n",
- " \"guidance_scale\": 7.5,\n",
- "}\n",
- "\n",
- "\n",
- "def query_endpoint_with_json_payload(model_predictor, payload, content_type, accept):\n",
- " \"\"\"Query the model predictor with json payload.\"\"\"\n",
- "\n",
- " encoded_payload = json.dumps(payload).encode(\"utf-8\")\n",
- "\n",
- " query_response = model_predictor.predict(\n",
- " encoded_payload,\n",
- " {\n",
- " \"ContentType\": content_type,\n",
- " \"Accept\": accept,\n",
- " },\n",
- " )\n",
- " return query_response\n",
- "\n",
- "\n",
- "def parse_response_multiple_images(query_response):\n",
- " \"\"\"Parse response and return generated image and the prompt\"\"\"\n",
- "\n",
- " response_dict = json.loads(query_response)\n",
- " return response_dict[\"generated_images\"], response_dict[\"prompt\"]\n",
- "\n",
- "\n",
- "query_response = query_endpoint_with_json_payload(\n",
- " model_predictor, payload, \"application/json\", \"application/json\"\n",
- ")\n",
- "generated_images, prompt = parse_response_multiple_images(query_response)\n",
- "\n",
- "for img in generated_images:\n",
- " display_img_and_prompt(img, prompt)"
- ]
- },
- {
- "cell_type": "markdown",
- "id": "62857efd-e53d-4730-a3d2-b7a9bcd03771",
- "metadata": {
- "pycharm": {
- "is_executing": true
- },
- "tags": []
- },
- "source": [
- "### 2.5. Compressed Image Output\n",
- "\n",
- "---\n",
- "\n",
- "Default response type above from an endpoint is a nested array with RGB values and if the generated image size is large, this may hit response size limit. To address this, we also support endpoint response where each image is returned as a JPEG image returned as bytes. To do this, please set `Accept = 'application/json;jpeg'`.\n",
- "\n",
- "\n",
- "---"
+ "# Here is the original image:\n",
+ "region = boto3.Session().region_name\n",
+ "s3_bucket = f\"jumpstart-cache-prod-{region}\"\n",
+ "key_prefix = \"model-metadata/assets\"\n",
+ "input_img_file_name = \"dog_suit.jpg\"\n",
+ "\n",
+ "s3 = boto3.client(\"s3\")\n",
+ "\n",
+ "s3.download_file(s3_bucket, f\"{key_prefix}/{input_img_file_name}\", input_img_file_name)\n",
+ "image = Image.open(input_img_file_name)\n",
+ "display(image)\n",
+ "image.close()"
]
},
{
"cell_type": "code",
"execution_count": null,
- "id": "bfdf0bd9-37a6-4401-afbd-34388a4ecbe8",
+ "id": "780d4e8f",
"metadata": {
- "pycharm": {
- "is_executing": true
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
},
"tags": []
},
"outputs": [],
"source": [
- "from PIL import Image\n",
- "from io import BytesIO\n",
- "import base64\n",
- "import json\n",
- "\n",
- "query_response = query_endpoint_with_json_payload(\n",
- " model_predictor, payload, \"application/json\", \"application/json;jpeg\"\n",
- ")\n",
- "generated_images, prompt = parse_response_multiple_images(query_response)\n",
- "\n",
- "# generated_images are a list of jpeg images as bytes with b64 encoding.\n",
- "\n",
- "\n",
- "def display_encoded_images(generated_images, prompt):\n",
- " # we decode the images and convert to RGB format before displaying\n",
- " for generated_image in generated_images:\n",
- " generated_image_decoded = BytesIO(base64.b64decode(generated_image.encode()))\n",
- " generated_image_rgb = Image.open(generated_image_decoded).convert(\"RGB\")\n",
- " display_img_and_prompt(generated_image_rgb, prompt)\n",
+ "size = (512, 512)\n",
+ "dog_data = encode_image(input_img_file_name, size=size)\n",
"\n",
+ "payload = {\n",
+ " \"text_prompts\": [{\"text\": \"dog in embroidery\"}],\n",
+ " \"init_image\": dog_data,\n",
+ " \"cfg_scale\": 9,\n",
+ " \"image_strength\": 0.8,\n",
+ " \"seed\": 42,\n",
+ "}\n",
"\n",
- "display_encoded_images(generated_images, prompt)"
+ "response = predictor.predict(payload)\n",
+ "decode_and_show(response[\"generated_image\"])"
]
},
{
"cell_type": "markdown",
- "id": "3569c635",
+ "id": "925a6024-03c9-4426-adb6-ff0d18d587b0",
"metadata": {},
"source": [
"### 2.6. Prompt Engineering\n",
@@ -486,12 +432,9 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "f39309df",
+ "id": "df259c8d-b985-4548-adea-6fdba014cbe5",
"metadata": {
- "collapsed": false,
- "jupyter": {
- "outputs_hidden": false
- }
+ "tags": []
},
"outputs": [],
"source": [
@@ -505,56 +448,84 @@
" \"landscape of the beautiful city of paris rebuilt near the pacific ocean in sunny california, amazing weather, sandy beach, palm trees, splendid haussmann architecture, digital painting, highly detailed, intricate, without duplication, art by craig mullins, greg rutkwowski, concept art, matte painting, trending on artstation\",\n",
"]\n",
"for prompt in prompts:\n",
- " payload = {\"prompt\": prompt, \"width\": 512, \"height\": 512}\n",
- " query_response = query_endpoint_with_json_payload(\n",
- " model_predictor, payload, \"application/json\", \"application/json;jpeg\"\n",
- " )\n",
- " generated_images, prompt = parse_response_multiple_images(query_response)\n",
- " display_encoded_images(generated_images, \"generated image with detailed prompt\")"
+ " payload = {\"text_prompts\": [{\"text\": prompt}],\n",
+ " \"width\": 1024,\n",
+ " \"height\": 1024,\n",
+ " \"sampler\": \"DPMPP2MSampler\",\n",
+ " \"cfg_scale\": 7.0,\n",
+ " \"steps\": 50,\n",
+ " \"seed\": 133,\n",
+ " \"use_refiner\": True,\n",
+ " \"refiner_steps\": 40,\n",
+ " \"refiner_strength\": 0.2,}\n",
+ " response = predictor.predict(payload)\n",
+ " decode_and_show(response[\"generated_image\"])"
]
},
{
"cell_type": "markdown",
- "id": "870d1173",
+ "id": "90386683",
"metadata": {},
"source": [
- "### 2.7. Clean up the endpoint"
+ "### 4. Clean Endpoint\n"
]
},
{
"cell_type": "code",
"execution_count": null,
- "id": "63cb143b",
- "metadata": {},
+ "id": "3f799024",
+ "metadata": {
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
+ },
"outputs": [],
"source": [
"# Delete the SageMaker endpoint\n",
- "model_predictor.delete_model()\n",
- "model_predictor.delete_endpoint()"
+ "predictor.delete_model()\n",
+ "predictor.delete_endpoint()"
]
},
{
"cell_type": "markdown",
- "id": "a504c9ac",
+ "id": "581debbb",
"metadata": {},
"source": [
- "### 3. Conclusion\n",
- "---\n",
- "In this tutorial, we learnt how to deploy a pre-trained Stable Diffusion model on SageMaker using JumpStart. We saw that Stable Diffusion models can generate highly photo-realistic images from text. JumpStart provides both Stable Diffusion 1 and Stable Diffusion 2 and their FP16 revisions. JumpStart also provides additional 84 diffusion models which have been trained to generate images from different themes and different languages. You can deploy any of these models without writing any code of your own. To deploy a specific model, you can select a `model_id` in the dropdown menu in [2.1. Select a Model](#2.1.-Select-a-Model).\n",
+ "## Notebook CI Test Results\n",
+ "\n",
+ "This notebook was tested in multiple regions. The test results are as follows, except for us-west-2 which is shown at the top of the notebook.\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
"\n",
- "You can tweak the image generation process by selecting the appropriate parameters during inference. Guidance on how to set these parameters is provided in [2.4. Supported Inference parameters](#2.4.-Supported-Inference-parameters). We also saw how returning a large image payload can lead to response size limit issues. JumpStart handles it by encoding the image at the endpoint and decoding it in the notebook before displaying. Finally, we saw how prompt engineering is a crucial step in generating high quality images. We discussed how to set your own prompts and saw a some examples of good prompts.\n",
+ "\n",
"\n",
- "To learn more about Inference on pre-trained Stable Diffusion models, please check out the blog [Generate images from text with the stable diffusion model on Amazon SageMaker JumpStart](https://aws.amazon.com/blogs/machine-learning/generate-images-from-text-with-the-stable-diffusion-model-on-amazon-sagemaker-jumpstart/)\n",
- "\n"
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ ""
]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "id": "5cffe96a-e8d8-4978-84c3-b0c294d8dacf",
- "metadata": {},
- "outputs": [],
- "source": []
}
],
"metadata": {
@@ -1131,13 +1102,43 @@
"memoryGiB": 1152,
"name": "ml.p4de.24xlarge",
"vcpuNum": 96
+ },
+ {
+ "_defaultOrder": 57,
+ "_isFastLaunch": false,
+ "category": "Accelerated computing",
+ "gpuNum": 0,
+ "hideHardwareSpecs": false,
+ "memoryGiB": 32,
+ "name": "ml.trn1.2xlarge",
+ "vcpuNum": 8
+ },
+ {
+ "_defaultOrder": 58,
+ "_isFastLaunch": false,
+ "category": "Accelerated computing",
+ "gpuNum": 0,
+ "hideHardwareSpecs": false,
+ "memoryGiB": 512,
+ "name": "ml.trn1.32xlarge",
+ "vcpuNum": 128
+ },
+ {
+ "_defaultOrder": 59,
+ "_isFastLaunch": false,
+ "category": "Accelerated computing",
+ "gpuNum": 0,
+ "hideHardwareSpecs": false,
+ "memoryGiB": 512,
+ "name": "ml.trn1n.32xlarge",
+ "vcpuNum": 128
}
],
"instance_type": "ml.t3.medium",
"kernelspec": {
- "display_name": "Python 3 (Data Science 3.0)",
+ "display_name": "Python 3 (Data Science 2.0)",
"language": "python",
- "name": "python3__SAGEMAKER_INTERNAL__arn:aws:sagemaker:us-west-2:236514542706:image/sagemaker-data-science-310-v1"
+ "name": "python3__SAGEMAKER_INTERNAL__arn:aws:sagemaker:us-west-2:236514542706:image/sagemaker-data-science-38"
},
"language_info": {
"codemirror_mode": {
@@ -1149,16 +1150,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.10.6"
- },
- "pycharm": {
- "stem_cell": {
- "cell_type": "raw",
- "metadata": {
- "collapsed": false
- },
- "source": []
- }
+ "version": "3.8.13"
}
},
"nbformat": 4,
diff --git a/train-and-deploy-LLaMa-2-7b/Deploy_pretrained_LLaMa-2.ipynb b/train-and-deploy-LLaMa-2-7b/Deploy_pretrained_LLaMa-2.ipynb
index 024cc52..59e03ef 100644
--- a/train-and-deploy-LLaMa-2-7b/Deploy_pretrained_LLaMa-2.ipynb
+++ b/train-and-deploy-LLaMa-2-7b/Deploy_pretrained_LLaMa-2.ipynb
@@ -83,12 +83,109 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 2,
"id": "85addd9d-ec89-44a7-9fb5-9bc24fe9993b",
"metadata": {
"tags": []
},
- "outputs": [],
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Requirement already satisfied: sagemaker in /opt/conda/lib/python3.10/site-packages (2.199.0)\n",
+ "Collecting sagemaker\n",
+ " Downloading sagemaker-2.206.0-py3-none-any.whl.metadata (13 kB)\n",
+ "Collecting datasets\n",
+ " Using cached datasets-2.16.1-py3-none-any.whl.metadata (20 kB)\n",
+ "Requirement already satisfied: attrs<24,>=23.1.0 in /opt/conda/lib/python3.10/site-packages (from sagemaker) (23.1.0)\n",
+ "Requirement already satisfied: boto3<2.0,>=1.33.3 in /opt/conda/lib/python3.10/site-packages (from sagemaker) (1.34.34)\n",
+ "Requirement already satisfied: cloudpickle==2.2.1 in /opt/conda/lib/python3.10/site-packages (from sagemaker) (2.2.1)\n",
+ "Requirement already satisfied: google-pasta in /opt/conda/lib/python3.10/site-packages (from sagemaker) (0.2.0)\n",
+ "Requirement already satisfied: numpy<2.0,>=1.9.0 in /opt/conda/lib/python3.10/site-packages (from sagemaker) (1.26.2)\n",
+ "Requirement already satisfied: protobuf<5.0,>=3.12 in /opt/conda/lib/python3.10/site-packages (from sagemaker) (4.25.1)\n",
+ "Requirement already satisfied: smdebug-rulesconfig==1.0.1 in /opt/conda/lib/python3.10/site-packages (from sagemaker) (1.0.1)\n",
+ "Requirement already satisfied: importlib-metadata<7.0,>=1.4.0 in /opt/conda/lib/python3.10/site-packages (from sagemaker) (6.11.0)\n",
+ "Requirement already satisfied: packaging>=20.0 in /opt/conda/lib/python3.10/site-packages (from sagemaker) (23.2)\n",
+ "Requirement already satisfied: pandas in /opt/conda/lib/python3.10/site-packages (from sagemaker) (2.1.3)\n",
+ "Requirement already satisfied: pathos in /opt/conda/lib/python3.10/site-packages (from sagemaker) (0.3.1)\n",
+ "Requirement already satisfied: schema in /opt/conda/lib/python3.10/site-packages (from sagemaker) (0.7.5)\n",
+ "Requirement already satisfied: PyYAML~=6.0 in /opt/conda/lib/python3.10/site-packages/PyYAML-6.0-py3.10-linux-x86_64.egg (from sagemaker) (6.0)\n",
+ "Requirement already satisfied: jsonschema in /opt/conda/lib/python3.10/site-packages (from sagemaker) (4.20.0)\n",
+ "Requirement already satisfied: platformdirs in /opt/conda/lib/python3.10/site-packages (from sagemaker) (2.5.2)\n",
+ "Requirement already satisfied: tblib<3,>=1.7.0 in /opt/conda/lib/python3.10/site-packages (from sagemaker) (1.7.0)\n",
+ "Collecting urllib3<1.27 (from sagemaker)\n",
+ " Using cached urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB)\n",
+ "Requirement already satisfied: requests in /opt/conda/lib/python3.10/site-packages (from sagemaker) (2.31.0)\n",
+ "Requirement already satisfied: docker in /opt/conda/lib/python3.10/site-packages (from sagemaker) (6.1.3)\n",
+ "Requirement already satisfied: tqdm in /opt/conda/lib/python3.10/site-packages (from sagemaker) (4.66.1)\n",
+ "Requirement already satisfied: psutil in /opt/conda/lib/python3.10/site-packages (from sagemaker) (5.9.0)\n",
+ "Requirement already satisfied: filelock in /opt/conda/lib/python3.10/site-packages (from datasets) (3.6.0)\n",
+ "Requirement already satisfied: pyarrow>=8.0.0 in /opt/conda/lib/python3.10/site-packages (from datasets) (14.0.1)\n",
+ "Collecting pyarrow-hotfix (from datasets)\n",
+ " Using cached pyarrow_hotfix-0.6-py3-none-any.whl.metadata (3.6 kB)\n",
+ "Requirement already satisfied: dill<0.3.8,>=0.3.0 in /opt/conda/lib/python3.10/site-packages (from datasets) (0.3.7)\n",
+ "Collecting xxhash (from datasets)\n",
+ " Using cached xxhash-3.4.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (12 kB)\n",
+ "Requirement already satisfied: multiprocess in /opt/conda/lib/python3.10/site-packages (from datasets) (0.70.15)\n",
+ "Collecting fsspec<=2023.10.0,>=2023.1.0 (from fsspec[http]<=2023.10.0,>=2023.1.0->datasets)\n",
+ " Using cached fsspec-2023.10.0-py3-none-any.whl.metadata (6.8 kB)\n",
+ "Requirement already satisfied: aiohttp in /opt/conda/lib/python3.10/site-packages (from datasets) (3.9.3)\n",
+ "Requirement already satisfied: huggingface-hub>=0.19.4 in /opt/conda/lib/python3.10/site-packages (from datasets) (0.20.3)\n",
+ "Requirement already satisfied: botocore<1.35.0,>=1.34.34 in /opt/conda/lib/python3.10/site-packages (from boto3<2.0,>=1.33.3->sagemaker) (1.34.34)\n",
+ "Requirement already satisfied: jmespath<2.0.0,>=0.7.1 in /opt/conda/lib/python3.10/site-packages (from boto3<2.0,>=1.33.3->sagemaker) (0.10.0)\n",
+ "Requirement already satisfied: s3transfer<0.11.0,>=0.10.0 in /opt/conda/lib/python3.10/site-packages (from boto3<2.0,>=1.33.3->sagemaker) (0.10.0)\n",
+ "Requirement already satisfied: aiosignal>=1.1.2 in /opt/conda/lib/python3.10/site-packages (from aiohttp->datasets) (1.3.1)\n",
+ "Requirement already satisfied: frozenlist>=1.1.1 in /opt/conda/lib/python3.10/site-packages (from aiohttp->datasets) (1.4.1)\n",
+ "Requirement already satisfied: multidict<7.0,>=4.5 in /opt/conda/lib/python3.10/site-packages (from aiohttp->datasets) (6.0.5)\n",
+ "Requirement already satisfied: yarl<2.0,>=1.0 in /opt/conda/lib/python3.10/site-packages (from aiohttp->datasets) (1.9.4)\n",
+ "Requirement already satisfied: async-timeout<5.0,>=4.0 in /opt/conda/lib/python3.10/site-packages (from aiohttp->datasets) (4.0.3)\n",
+ "Requirement already satisfied: typing-extensions>=3.7.4.3 in /opt/conda/lib/python3.10/site-packages (from huggingface-hub>=0.19.4->datasets) (4.9.0)\n",
+ "Requirement already satisfied: zipp>=0.5 in /opt/conda/lib/python3.10/site-packages (from importlib-metadata<7.0,>=1.4.0->sagemaker) (3.8.0)\n",
+ "Requirement already satisfied: charset-normalizer<4,>=2 in /opt/conda/lib/python3.10/site-packages (from requests->sagemaker) (2.0.4)\n",
+ "Requirement already satisfied: idna<4,>=2.5 in /opt/conda/lib/python3.10/site-packages (from requests->sagemaker) (3.3)\n",
+ "Requirement already satisfied: certifi>=2017.4.17 in /opt/conda/lib/python3.10/site-packages (from requests->sagemaker) (2023.11.17)\n",
+ "Requirement already satisfied: websocket-client>=0.32.0 in /opt/conda/lib/python3.10/site-packages (from docker->sagemaker) (0.58.0)\n",
+ "Requirement already satisfied: six in /opt/conda/lib/python3.10/site-packages (from google-pasta->sagemaker) (1.16.0)\n",
+ "Requirement already satisfied: jsonschema-specifications>=2023.03.6 in /opt/conda/lib/python3.10/site-packages (from jsonschema->sagemaker) (2023.11.2)\n",
+ "Requirement already satisfied: referencing>=0.28.4 in /opt/conda/lib/python3.10/site-packages (from jsonschema->sagemaker) (0.31.1)\n",
+ "Requirement already satisfied: rpds-py>=0.7.1 in /opt/conda/lib/python3.10/site-packages (from jsonschema->sagemaker) (0.13.2)\n",
+ "Requirement already satisfied: python-dateutil>=2.8.2 in /opt/conda/lib/python3.10/site-packages (from pandas->sagemaker) (2.8.2)\n",
+ "Requirement already satisfied: pytz>=2020.1 in /opt/conda/lib/python3.10/site-packages (from pandas->sagemaker) (2022.1)\n",
+ "Requirement already satisfied: tzdata>=2022.1 in /opt/conda/lib/python3.10/site-packages (from pandas->sagemaker) (2023.3)\n",
+ "Requirement already satisfied: ppft>=1.7.6.7 in /opt/conda/lib/python3.10/site-packages (from pathos->sagemaker) (1.7.6.7)\n",
+ "Requirement already satisfied: pox>=0.3.3 in /opt/conda/lib/python3.10/site-packages (from pathos->sagemaker) (0.3.3)\n",
+ "Requirement already satisfied: contextlib2>=0.5.5 in /opt/conda/lib/python3.10/site-packages (from schema->sagemaker) (21.6.0)\n",
+ "Downloading sagemaker-2.206.0-py3-none-any.whl (1.4 MB)\n",
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.4/1.4 MB\u001b[0m \u001b[31m9.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m:00:01\u001b[0m00:01\u001b[0m\n",
+ "\u001b[?25hUsing cached datasets-2.16.1-py3-none-any.whl (507 kB)\n",
+ "Using cached fsspec-2023.10.0-py3-none-any.whl (166 kB)\n",
+ "Using cached urllib3-1.26.18-py2.py3-none-any.whl (143 kB)\n",
+ "Using cached pyarrow_hotfix-0.6-py3-none-any.whl (7.9 kB)\n",
+ "Using cached xxhash-3.4.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (194 kB)\n",
+ "Installing collected packages: xxhash, urllib3, pyarrow-hotfix, fsspec, datasets, sagemaker\n",
+ " Attempting uninstall: urllib3\n",
+ " Found existing installation: urllib3 2.0.7\n",
+ " Uninstalling urllib3-2.0.7:\n",
+ " Successfully uninstalled urllib3-2.0.7\n",
+ " Attempting uninstall: fsspec\n",
+ " Found existing installation: fsspec 2024.2.0\n",
+ " Uninstalling fsspec-2024.2.0:\n",
+ " Successfully uninstalled fsspec-2024.2.0\n",
+ " Attempting uninstall: sagemaker\n",
+ " Found existing installation: sagemaker 2.199.0\n",
+ " Uninstalling sagemaker-2.199.0:\n",
+ " Successfully uninstalled sagemaker-2.199.0\n",
+ "\u001b[31mERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.\n",
+ "distributed 2022.7.0 requires tornado<6.2,>=6.0.3, but you have tornado 6.4 which is incompatible.\u001b[0m\u001b[31m\n",
+ "\u001b[0mSuccessfully installed datasets-2.16.1 fsspec-2023.10.0 pyarrow-hotfix-0.6 sagemaker-2.206.0 urllib3-1.26.18 xxhash-3.4.1\n",
+ "\u001b[33mWARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv\u001b[0m\u001b[33m\n",
+ "\u001b[0m\n",
+ "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip is available: \u001b[0m\u001b[31;49m23.3.1\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m24.0\u001b[0m\n",
+ "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpip install --upgrade pip\u001b[0m\n"
+ ]
+ }
+ ],
"source": [
"!pip install --upgrade sagemaker datasets"
]
@@ -109,7 +206,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 3,
"id": "e756bd54",
"metadata": {
"jumpStartAlterations": [
@@ -132,17 +229,40 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 4,
"id": "1722b230-b7bc-487f-b4ee-98ca42848423",
"metadata": {
"tags": []
},
- "outputs": [],
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "sagemaker.config INFO - Not applying SDK defaults from location: /etc/xdg/sagemaker/config.yaml\n",
+ "sagemaker.config INFO - Not applying SDK defaults from location: /root/.config/sagemaker/config.yaml\n"
+ ]
+ },
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "Using model 'meta-textgeneration-llama-2-7b' with wildcard version identifier '*'. You can pin to version '3.0.2' for more stable results. Note that models may have different input/output signatures after a major version upgrade.\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "---------!"
+ ]
+ }
+ ],
"source": [
"from sagemaker.jumpstart.model import JumpStartModel\n",
"\n",
"pretrained_model = JumpStartModel(model_id=model_id)\n",
- "pretrained_predictor = pretrained_model.deploy()"
+ "pretrained_predictor = pretrained_model.deploy(accept_eula = True)"
]
},
{
@@ -155,7 +275,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 5,
"id": "7e01bcc7-0ae3-4e67-9b06-aaf7ab0a081e",
"metadata": {
"tags": []
@@ -196,7 +316,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 6,
"id": "b795a085-048f-42b2-945f-0cd339c1cf91",
"metadata": {
"tags": []
@@ -205,18 +325,34 @@
"source": [
"def print_response(payload, response):\n",
" print(payload[\"inputs\"])\n",
- " print(f\"> {response[0]['generation']}\")\n",
+ " print(f\"> {response[0]['generated_text']}\")\n",
" print(\"\\n==================================\\n\")"
]
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 7,
"id": "5dd833f8-1ddc-4805-80b2-19e7db629880",
"metadata": {
"tags": []
},
- "outputs": [],
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "I believe the meaning of life is\n",
+ "> I believe the meaning of life is to achieve complete joy, to be happy and to help others become happy, not only during one’s lifetime, but after it as well.\n",
+ "This is the task of every saint, and that is the nature of my work. I am a spiritual teacher, and through the practice of my path I have learned to achieve this goal.\n",
+ "I have learned to deal with all negative emotions, such as anger, fear, and insecurity, and how to overcome them. I have achieved great inner strength, which allows me to be fully present in this world. I am at peace and do not identify with any of the problems and suffering that life offers.\n",
+ "I have learned how to focus my attention inward and develop a direct connection with God. I have realized that my own life has a higher meaning, and that I am living it according to God’s plan. I have achieved the purpose of my life.\n",
+ "This is what the meaning of life is to me. I believe\n",
+ "\n",
+ "==================================\n",
+ "\n"
+ ]
+ }
+ ],
"source": [
"payload = {\n",
" \"inputs\": \"I believe the meaning of life is\",\n",
@@ -245,7 +381,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 8,
"id": "d7691ce4-b5d7-4b1f-a741-2d7333c14a45",
"metadata": {},
"outputs": [],
@@ -842,6 +978,36 @@
"memoryGiB": 1152,
"name": "ml.p4de.24xlarge",
"vcpuNum": 96
+ },
+ {
+ "_defaultOrder": 57,
+ "_isFastLaunch": false,
+ "category": "Accelerated computing",
+ "gpuNum": 0,
+ "hideHardwareSpecs": false,
+ "memoryGiB": 32,
+ "name": "ml.trn1.2xlarge",
+ "vcpuNum": 8
+ },
+ {
+ "_defaultOrder": 58,
+ "_isFastLaunch": false,
+ "category": "Accelerated computing",
+ "gpuNum": 0,
+ "hideHardwareSpecs": false,
+ "memoryGiB": 512,
+ "name": "ml.trn1.32xlarge",
+ "vcpuNum": 128
+ },
+ {
+ "_defaultOrder": 59,
+ "_isFastLaunch": false,
+ "category": "Accelerated computing",
+ "gpuNum": 0,
+ "hideHardwareSpecs": false,
+ "memoryGiB": 512,
+ "name": "ml.trn1n.32xlarge",
+ "vcpuNum": 128
}
],
"instance_type": "ml.t3.medium",