Skip to content

armgit / dspy

Public Imported from GitHub
0

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

Python

Clean up hotpotqa_with_assertions

Shangyint99f9d377758b
diff --git a/hotpotqa_with_assertions.ipynb b/hotpotqa_with_assertions.ipynb
index 338207d5f..1597ef126 100644
--- a/hotpotqa_with_assertions.ipynb
+++ b/hotpotqa_with_assertions.ipynb
@@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
- "execution_count": 20,
+ "execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
@@ -18,7 +18,7 @@
},
{
"cell_type": "code",
- "execution_count": 21,
+ "execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
@@ -29,7 +29,7 @@
},
{
"cell_type": "code",
- "execution_count": 22,
+ "execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
@@ -41,7 +41,7 @@
},
{
"cell_type": "code",
- "execution_count": 8,
+ "execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
@@ -52,7 +52,7 @@
},
{
"cell_type": "code",
- "execution_count": 9,
+ "execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
@@ -79,7 +79,7 @@
},
{
"cell_type": "code",
- "execution_count": 10,
+ "execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
@@ -94,7 +94,7 @@
},
{
"cell_type": "code",
- "execution_count": 11,
+ "execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
@@ -117,7 +117,7 @@
},
{
"cell_type": "code",
- "execution_count": 12,
+ "execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
@@ -132,7 +132,7 @@
},
{
"cell_type": "code",
- "execution_count": 13,
+ "execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
@@ -168,7 +168,7 @@
},
{
"cell_type": "code",
- "execution_count": 14,
+ "execution_count": 10,
"metadata": {},
"outputs": [],
"source": [
@@ -215,7 +215,7 @@
},
{
"cell_type": "code",
- "execution_count": 15,
+ "execution_count": 11,
"metadata": {},
"outputs": [],
"source": [
@@ -224,7 +224,7 @@
},
{
"cell_type": "code",
- "execution_count": 16,
+ "execution_count": 12,
"metadata": {},
"outputs": [],
"source": [
@@ -275,7 +275,7 @@
"metadata": {},
"outputs": [],
"source": [
- "max_bootstrapped_demos = 3"
+ "max_bootstrapped_demos = 2"
]
},
{
@@ -320,36 +320,6 @@
")\n",
"evaluate(compiled_baleen)\n"
]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
- "source": [
- "# Yes Compilation + Yes Assertion + Teacher enable backtracking\n",
- "from functools import partial\n",
- "baleen = SimplifiedBaleen()\n",
- "teleprompter = BootstrapFewShot(\n",
- " metric=validate_context_and_answer_and_hops,\n",
- " max_bootstrapped_demos=max_bootstrapped_demos,\n",
- " num_candidate_programs=6,\n",
- ")\n",
- "compiled_baleen = teleprompter.compile(\n",
- " student=assert_transform_module(\n",
- " SimplifiedBaleenAssertions().map_named_predictors(Retry),\n",
- " suggest_backtrack_handler,\n",
- " ),\n",
- " teacher=assert_transform_module(\n",
- " SimplifiedBaleenAssertions().map_named_predictors(Retry),\n",
- " partial(suggest_backtrack_handler, bypass_suggest=False)\n",
- " ),\n",
- " teacher=baleen,\n",
- " trainset=trainset,\n",
- " valset=devset\n",
- ")\n",
- "evaluate(compiled_baleen)"
- ]
}
],
"metadata": {