DSPy: The framework for programming—not prompting—language models
Python
local pip install on colab
Jasper Xianfbb5c371ca9e
diff --git a/pyserini.ipynb b/pyserini.ipynbindex 2e761399f..2a460d610 100644--- a/pyserini.ipynb+++ b/pyserini.ipynb@@ -19,15 +19,15 @@},{"cell_type": "code",- "execution_count": 1,+ "execution_count": 5,"metadata": {},"outputs": [{- "name": "stderr",+ "name": "stdout","output_type": "stream","text": [- "/tmp/ipykernel_2513/4167226831.py:5: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html\n",- " import pkg_resources\n"+ "The autoreload extension is already loaded. To reload it, use:\n",+ " %reload_ext autoreload\n"]}],@@ -42,6 +42,8 @@" import google.colab\n"," repo_path = 'dspy'\n"," !git -C $repo_path pull origin || git clone https://github.com/stanfordnlp/dspy $repo_path\n",+ " %cd $repo_path\n",+ " !pip install -e .\n"," if not \"pyserini\" in {pkg.key for pkg in pkg_resources.working_set}:\n"," !pip install pyserini\n"," if not \"torch\" in {pkg.key for pkg in pkg_resources.working_set}:\n",@@ -50,16 +52,15 @@" !pip install faiss-cpu\n","except:\n"," repo_path = '.'\n",+ " # Install the package if it's not installed\n",+ " if not \"dspy-ai\" in {pkg.key for pkg in pkg_resources.working_set}:\n",+ " !pip install -U pip\n",+ " !pip install dspy-ai\n",+ " # !pip install -e $repo_path\n","\n","if repo_path not in sys.path:\n"," sys.path.append(repo_path)\n","\n",- "# Install the package if it's not installed\n",- "if not \"dspy-ai\" in {pkg.key for pkg in pkg_resources.working_set}:\n",- " !pip install -U pip\n",- " !pip install dspy-ai\n",- " # !pip install -e $repo_path\n",- "\n","import dspy"]},@@ -72,7 +73,7 @@},{"cell_type": "code",- "execution_count": 2,+ "execution_count": 6,"metadata": {},"outputs": [{@@ -122,7 +123,7 @@},{"cell_type": "code",- "execution_count": 4,+ "execution_count": 7,"metadata": {},"outputs": [{@@ -133,16 +134,16 @@"To disable this warning, you can either:\n","\t- Avoid using `tokenizers` before the fork if possible\n","\t- Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)\n",- "--2023-09-15 20:57:57-- https://public.ukp.informatik.tu-darmstadt.de/thakur/BEIR/datasets/nfcorpus.zip\n",+ "--2023-09-16 12:33:31-- https://public.ukp.informatik.tu-darmstadt.de/thakur/BEIR/datasets/nfcorpus.zip\n","Resolving public.ukp.informatik.tu-darmstadt.de (public.ukp.informatik.tu-darmstadt.de)... 130.83.167.186\n","Connecting to public.ukp.informatik.tu-darmstadt.de (public.ukp.informatik.tu-darmstadt.de)|130.83.167.186|:443... connected.\n","HTTP request sent, awaiting response... 200 OK\n","Length: 2448432 (2.3M) [application/zip]\n","Saving to: ‘collections/nfcorpus.zip’\n","\n",- "nfcorpus.zip 100%[===================>] 2.33M 3.33MB/s in 0.7s \n",+ "nfcorpus.zip 100%[===================>] 2.33M 2.64MB/s in 0.9s \n","\n",- "2023-09-15 20:57:59 (3.33 MB/s) - ‘collections/nfcorpus.zip’ saved [2448432/2448432]\n",+ "2023-09-16 12:33:33 (2.64 MB/s) - ‘collections/nfcorpus.zip’ saved [2448432/2448432]\n","\n","huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...\n","To disable this warning, you can either:\n",@@ -166,7 +167,7 @@},{"cell_type": "code",- "execution_count": 5,+ "execution_count": 10,"metadata": {},"outputs": [{@@ -177,8 +178,8 @@"To disable this warning, you can either:\n","\t- Avoid using `tokenizers` before the fork if possible\n","\t- Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)\n",- "3633it [00:00, 101455.50it/s]\n",- "100%|███████████████████████████████████████████| 57/57 [08:56<00:00, 9.41s/it]\n"+ "3633it [00:00, 106850.95it/s]\n",+ "100%|███████████████████████████████████████████| 57/57 [08:52<00:00, 9.35s/it]\n"]}],@@ -203,9 +204,51 @@},{"cell_type": "code",- "execution_count": 3,+ "execution_count": 11,"metadata": {},"outputs": [+ {+ "data": {+ "application/vnd.jupyter.widget-view+json": {+ "model_id": "ad31b8b0072648d1913010f5c3373164",+ "version_major": 2,+ "version_minor": 0+ },+ "text/plain": [+ "Downloading data files: 0%| | 0/1 [00:00<?, ?it/s]"+ ]+ },+ "metadata": {},+ "output_type": "display_data"+ },+ {+ "data": {+ "application/vnd.jupyter.widget-view+json": {+ "model_id": "3424554a6fb54fd381c21ddf8d76d83d",+ "version_major": 2,+ "version_minor": 0+ },+ "text/plain": [+ "Extracting data files: 0%| | 0/1 [00:00<?, ?it/s]"+ ]+ },+ "metadata": {},+ "output_type": "display_data"+ },+ {+ "data": {+ "application/vnd.jupyter.widget-view+json": {+ "model_id": "0beb45f6707943bfb0182786fd32fc97",+ "version_major": 2,+ "version_minor": 0+ },+ "text/plain": [+ "Generating train split: 0 examples [00:00, ? examples/s]"+ ]+ },+ "metadata": {},+ "output_type": "display_data"+ },{"name": "stdout","output_type": "stream",