Skip to content

armgit / dspy

Public Imported from GitHub
0

DSPy: The framework for programming—not prompting—language models

Python

updated longformqa and migrated assertions_examples

Arnav Singhvi2b28474ad69a
diff --git a/dspy/datasets/hotpotqa.py b/dspy/datasets/hotpotqa.py
index c8031fc9a..f1cc73482 100644
--- a/dspy/datasets/hotpotqa.py
+++ b/dspy/datasets/hotpotqa.py
@@ -41,9 +41,9 @@ class HotPotQA(Dataset):
else:
self._dev = None
- # for example in self._train:
- # if keep_details == 'dev_titles':
- # del example['gold_titles']
+ for example in self._train:
+ if keep_details == 'dev_titles':
+ del example['gold_titles']
test = []
for raw_example in hf_official_dev:
diff --git a/examples/longformqa/longformqa_assertions.ipynb b/examples/longformqa/longformqa_assertions.ipynb
index 28f912b9c..a2e2611c7 100644
--- a/examples/longformqa/longformqa_assertions.ipynb
+++ b/examples/longformqa/longformqa_assertions.ipynb
@@ -43,6 +43,7 @@
"\n",
"import sys\n",
"import os\n",
+ "import regex as re\n",
"\n",
"try: # When on google Colab, let's clone the notebook so we download the cache.\n",
" import google.colab\n",
@@ -111,7 +112,7 @@
"metadata": {},
"outputs": [],
"source": [
- "dataset = HotPotQA(train_seed=1, train_size=300, eval_seed=2023, dev_size=300, test_size=0)\n",
+ "dataset = HotPotQA(train_seed=1, train_size=300, eval_seed=2023, dev_size=300, test_size=0, keep_details=True)\n",
"trainset = [x.with_inputs('question') for x in dataset.train]\n",
"devset = [x.with_inputs('question') for x in dataset.dev]"
]
diff --git a/hotpotqa_with_assertions.ipynb b/examples/qa/hotpot/hotpotqa_with_assertions.ipynb
similarity index 99%
rename from hotpotqa_with_assertions.ipynb
rename to examples/qa/hotpot/hotpotqa_with_assertions.ipynb
index 0d35b4da5..f15d1061e 100644
--- a/hotpotqa_with_assertions.ipynb
+++ b/examples/qa/hotpot/hotpotqa_with_assertions.ipynb
@@ -272,7 +272,7 @@
" trainset=trainset,\n",
" valset=devset[:100]\n",
")\n",
- "evaluate(compiled_baleen)\n"
+ "evaluate(compiled_baleen)"
]
}
],
@@ -292,7 +292,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.11.5"
+ "version": "3.10.13"
}
},
"nbformat": 4,