Minor fixes

This commit is contained in:
Edward Donner
2025-04-25 13:25:00 +02:00
parent 2c6870cf58
commit 217e08ded7
7 changed files with 30 additions and 29 deletions

View File

@@ -16,7 +16,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 1, "execution_count": null,
"id": "c44c5494-950d-4d2f-8d4f-b87b57c5b330", "id": "c44c5494-950d-4d2f-8d4f-b87b57c5b330",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
@@ -35,7 +35,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 2, "execution_count": null,
"id": "d1715421-cead-400b-99af-986388a97aff", "id": "d1715421-cead-400b-99af-986388a97aff",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
@@ -45,20 +45,10 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 3, "execution_count": null,
"id": "337d5dfc-0181-4e3b-8ab9-e78e0c3f657b", "id": "337d5dfc-0181-4e3b-8ab9-e78e0c3f657b",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [],
{
"name": "stdout",
"output_type": "stream",
"text": [
"OpenAI API Key exists and begins sk-proj-\n",
"Anthropic API Key exists and begins sk-ant-\n",
"Google API Key exists and begins AIzaSyA5\n"
]
}
],
"source": [ "source": [
"# Load environment variables in a file called .env\n", "# Load environment variables in a file called .env\n",
"# Print the key prefixes to help with any debugging\n", "# Print the key prefixes to help with any debugging\n",
@@ -86,7 +76,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 4, "execution_count": null,
"id": "22586021-1795-4929-8079-63f5bb4edd4c", "id": "22586021-1795-4929-8079-63f5bb4edd4c",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
@@ -102,7 +92,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 5, "execution_count": null,
"id": "b16e6021-6dc4-4397-985a-6679d6c8ffd5", "id": "b16e6021-6dc4-4397-985a-6679d6c8ffd5",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
@@ -114,7 +104,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 6, "execution_count": null,
"id": "02ef9b69-ef31-427d-86d0-b8c799e1c1b1", "id": "02ef9b69-ef31-427d-86d0-b8c799e1c1b1",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
@@ -292,7 +282,7 @@
"# Let's use Markdown\n", "# Let's use Markdown\n",
"# Are you wondering why it makes any difference to set system_message when it's not referred to in the code below it?\n", "# Are you wondering why it makes any difference to set system_message when it's not referred to in the code below it?\n",
"# I'm taking advantage of system_message being a global variable, used back in the message_gpt function (go take a look)\n", "# I'm taking advantage of system_message being a global variable, used back in the message_gpt function (go take a look)\n",
"# Not a great software engineering practice, but quite sommon during Jupyter Lab R&D!\n", "# Not a great software engineering practice, but quite common during Jupyter Lab R&D!\n",
"\n", "\n",
"system_message = \"You are a helpful assistant that responds in markdown\"\n", "system_message = \"You are a helpful assistant that responds in markdown\"\n",
"\n", "\n",
@@ -578,7 +568,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.11.11" "version": "3.11.12"
} }
}, },
"nbformat": 4, "nbformat": 4,

View File

@@ -748,7 +748,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.11.11" "version": "3.11.12"
} }
}, },
"nbformat": 4, "nbformat": 4,

View File

@@ -475,7 +475,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.11.11" "version": "3.11.12"
} }
}, },
"nbformat": 4, "nbformat": 4,

View File

@@ -429,7 +429,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.11.11" "version": "3.11.12"
} }
}, },
"nbformat": 4, "nbformat": 4,

View File

@@ -43,7 +43,6 @@
"from dotenv import load_dotenv\n", "from dotenv import load_dotenv\n",
"from huggingface_hub import login\n", "from huggingface_hub import login\n",
"from datasets import load_dataset, Dataset, DatasetDict\n", "from datasets import load_dataset, Dataset, DatasetDict\n",
"from loaders import ItemLoader\n",
"import matplotlib.pyplot as plt\n", "import matplotlib.pyplot as plt\n",
"from collections import Counter, defaultdict\n", "from collections import Counter, defaultdict\n",
"import numpy as np\n", "import numpy as np\n",
@@ -85,8 +84,9 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"# One more import after HF login\n", "# More imports after HF login\n",
"\n", "\n",
"from loaders import ItemLoader\n",
"from items import Item" "from items import Item"
] ]
}, },
@@ -624,7 +624,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.11.11" "version": "3.11.12"
} }
}, },
"nbformat": 4, "nbformat": 4,

View File

@@ -918,7 +918,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.11.11" "version": "3.11.12"
} }
}, },
"nbformat": 4, "nbformat": 4,

View File

@@ -38,8 +38,6 @@
"from dotenv import load_dotenv\n", "from dotenv import load_dotenv\n",
"from huggingface_hub import login\n", "from huggingface_hub import login\n",
"from datasets import load_dataset, Dataset, DatasetDict\n", "from datasets import load_dataset, Dataset, DatasetDict\n",
"from items import Item\n",
"from loaders import ItemLoader\n",
"import matplotlib.pyplot as plt\n", "import matplotlib.pyplot as plt\n",
"from collections import Counter, defaultdict\n", "from collections import Counter, defaultdict\n",
"import numpy as np\n", "import numpy as np\n",
@@ -74,6 +72,19 @@
"login(hf_token, add_to_git_credential=True)" "login(hf_token, add_to_git_credential=True)"
] ]
}, },
{
"cell_type": "code",
"execution_count": null,
"id": "767081df-ee34-4309-ab4c-46d62b4ae367",
"metadata": {},
"outputs": [],
"source": [
"# And some more imports - with thanks to Alex C for pointing out that I need to do these after the HF login..\n",
"\n",
"from items import Item\n",
"from loaders import ItemLoader"
]
},
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
@@ -416,7 +427,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.11.10" "version": "3.11.12"
} }
}, },
"nbformat": 4, "nbformat": 4,