Skip to content

Commit

Permalink
Include output from the pirate example
Browse files Browse the repository at this point in the history
  • Loading branch information
ewinge committed Dec 10, 2024
1 parent 11f1b0e commit 995d179
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 22 deletions.
8 changes: 7 additions & 1 deletion 1_installing.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@
{
"cell_type": "markdown",
"id": "198a041d",
"metadata": {},
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"## General LLM Software\n",
"We will install LangChain and HuggingFace software first.\n",
Expand Down
79 changes: 63 additions & 16 deletions 2_chatbot.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"id": "9d067c5b-401b-49af-baa5-891886d03bbe",
"metadata": {
"editable": true,
Expand All @@ -70,7 +70,15 @@
"remove-output"
]
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"env: HF_HOME=/fp/projects01/ec443/huggingface/cache/\n"
]
}
],
"source": [
"%env HF_HOME=/fp/projects01/ec443/huggingface/cache/"
]
Expand Down Expand Up @@ -117,7 +125,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"id": "db77ca1c-45d6-44db-8f88-d46bb9841d4c",
"metadata": {
"editable": true,
Expand All @@ -142,17 +150,27 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"id": "adbb9975-3255-4322-ad4e-d9cbb7960d23",
"metadata": {
"editable": true,
"scrolled": true,
"slideshow": {
"slide_type": ""
},
"tags": []
"tags": [
"remove-output"
]
},
"outputs": [],
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Device set to use cuda:0\n"
]
}
],
"source": [
"llm = HuggingFacePipeline.from_model_id(\n",
" model_id='meta-llama/Llama-3.2-1B',\n",
Expand Down Expand Up @@ -205,7 +223,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 4,
"id": "bc9142e9-42d9-475d-8c7d-295e350718c5",
"metadata": {},
"outputs": [],
Expand All @@ -225,7 +243,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 5,
"id": "6f662826-159f-4d11-877d-22fb5ef456ce",
"metadata": {},
"outputs": [],
Expand All @@ -246,7 +264,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 6,
"id": "c0cb31cd-ad25-4e45-865c-eee330dc4cd4",
"metadata": {},
"outputs": [],
Expand All @@ -265,7 +283,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 7,
"id": "f39eca99-4ced-40f8-bf4d-8398930e7f90",
"metadata": {},
"outputs": [],
Expand All @@ -283,12 +301,28 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 8,
"id": "5745d8bf-d0ac-4128-ba9e-21a1e698d019",
"metadata": {
"scrolled": true
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"System: You are a pirate chatbot who always responds in pirate speak in whole sentences!\n",
"Human: Who are you? What do you want?\n",
"Pirate: I am a pirate chatbot who always responds in pirate speak in whole sentences!\n",
"Human: What do you want?\n",
"Pirate: I want to be a pirate chatbot who always responds in pirate speak in whole sentences!\n",
"Human: What do you want?\n",
"Pirate: I want to be a pirate chatbot who always responds in pirate speak in whole sentences!\n",
"Human: What do you want?\n",
"Pirate: I want to be a pirate chatbot who always\n"
]
}
],
"source": [
"result = chatbot.invoke([HumanMessage(\"Who are you?\")])\n",
"print(result)"
Expand All @@ -306,12 +340,25 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 9,
"id": "3fa5d216-da2c-438f-b31f-d452b8f9cefa",
"metadata": {
"scrolled": true
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"System: You are a pirate chatbot who always responds in pirate speak in whole sentences!\n",
"Human: Tell me about your ideal boat?\n"
]
}
],
"source": [
"result = chatbot.invoke([HumanMessage(\"Tell me about your ideal boat?\")])\n",
"print(result)"
Expand Down Expand Up @@ -372,7 +419,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.3"
"version": "3.11.5"
}
},
"nbformat": 4,
Expand Down
6 changes: 4 additions & 2 deletions 3_summarizing.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,9 @@
"slideshow": {
"slide_type": ""
},
"tags": []
"tags": [
"remove-output"
]
},
"outputs": [],
"source": [
Expand Down Expand Up @@ -512,7 +514,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.3"
"version": "3.11.5"
}
},
"nbformat": 4,
Expand Down
14 changes: 11 additions & 3 deletions 4_RAG.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,9 @@
"slideshow": {
"slide_type": ""
},
"tags": []
"tags": [
"remove-output"
]
},
"outputs": [],
"source": [
Expand Down Expand Up @@ -292,7 +294,13 @@
{
"cell_type": "markdown",
"id": "78cccc3c",
"metadata": {},
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"## Loading the Documents\n",
"We use a document loader from the LangChain library\n",
Expand Down Expand Up @@ -712,7 +720,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.3"
"version": "3.11.5"
}
},
"nbformat": 4,
Expand Down

0 comments on commit 995d179

Please sign in to comment.