Skip to content

Commit 73dc1c6

Browse files
committed
Notebook 3 finalise
1 parent 5d430e3 commit 73dc1c6

File tree

2 files changed

+86
-4
lines changed

2 files changed

+86
-4
lines changed

recipes/quickstart/NotebookLlama/Step-3-Re-Writer.ipynb

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,37 @@
11
{
22
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"id": "d0b5beda",
6+
"metadata": {},
7+
"source": [
8+
"## Notebook 3: Transcript Re-writer\n",
9+
"\n",
10+
"In the previouse notebook, we got a great podcast transcript using the raw file we have uploaded earlier. \n",
11+
"\n",
12+
"In this one, we will use `Llama-3.1-8B-Instruct` model to re-write the output from previous pipeline and make it more dramatic or realistic."
13+
]
14+
},
15+
{
16+
"cell_type": "markdown",
17+
"id": "fdc3d32a",
18+
"metadata": {},
19+
"source": [
20+
"We will again set the `SYSTEM_PROMPT` and remind the model of its task. \n",
21+
"\n",
22+
"Note: We can even prompt the model like so to encourage creativity:\n",
23+
"\n",
24+
"> Your job is to use the podcast transcript written below to re-write it for an AI Text-To-Speech Pipeline. A very dumb AI had written this so you have to step up for your kind.\n"
25+
]
26+
},
27+
{
28+
"cell_type": "markdown",
29+
"id": "c32c0d85",
30+
"metadata": {},
31+
"source": [
32+
"Note: We will prompt the model to return a list of Tuples to make our life easy in the next stage of using these for Text To Speech Generation"
33+
]
34+
},
335
{
436
"cell_type": "code",
537
"execution_count": 1,
@@ -51,6 +83,14 @@
5183
"\"\"\""
5284
]
5385
},
86+
{
87+
"cell_type": "markdown",
88+
"id": "8ee70bee",
89+
"metadata": {},
90+
"source": [
91+
"This time we will use the smaller 8B model"
92+
]
93+
},
5494
{
5595
"cell_type": "code",
5696
"execution_count": 2,
@@ -61,6 +101,14 @@
61101
"MODEL = \"meta-llama/Llama-3.1-8B-Instruct\""
62102
]
63103
},
104+
{
105+
"cell_type": "markdown",
106+
"id": "f7bc794b",
107+
"metadata": {},
108+
"source": [
109+
"Let's import the necessary libraries"
110+
]
111+
},
64112
{
65113
"cell_type": "code",
66114
"execution_count": 3,
@@ -79,6 +127,16 @@
79127
"warnings.filterwarnings('ignore')"
80128
]
81129
},
130+
{
131+
"cell_type": "markdown",
132+
"id": "8020c39c",
133+
"metadata": {},
134+
"source": [
135+
"We will load in the pickle file saved from previous notebook\n",
136+
"\n",
137+
"This time the `INPUT_PROMPT` to the model will be the output from the previous stage"
138+
]
139+
},
82140
{
83141
"cell_type": "code",
84142
"execution_count": 4,
@@ -92,6 +150,14 @@
92150
" INPUT_PROMPT = pickle.load(file)"
93151
]
94152
},
153+
{
154+
"cell_type": "markdown",
155+
"id": "c4461926",
156+
"metadata": {},
157+
"source": [
158+
"We can again use Hugging Face `pipeline` method to generate text from the model"
159+
]
160+
},
95161
{
96162
"cell_type": "code",
97163
"execution_count": null,
@@ -140,6 +206,14 @@
140206
")"
141207
]
142208
},
209+
{
210+
"cell_type": "markdown",
211+
"id": "612a27e0",
212+
"metadata": {},
213+
"source": [
214+
"We can verify the output from the model"
215+
]
216+
},
143217
{
144218
"cell_type": "code",
145219
"execution_count": null,
@@ -160,6 +234,14 @@
160234
"save_string_pkl = outputs[0][\"generated_text\"][-1]['content']"
161235
]
162236
},
237+
{
238+
"cell_type": "markdown",
239+
"id": "d495a957",
240+
"metadata": {},
241+
"source": [
242+
"Let's save the output as a pickle file to be used in Notebook 4"
243+
]
244+
},
163245
{
164246
"cell_type": "code",
165247
"execution_count": null,

recipes/quickstart/NotebookLlama/Step-4-TTS-Workflow.ipynb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@
55
"id": "c31c0e37",
66
"metadata": {},
77
"source": [
8-
"## Notebook 4: TTS Workflow"
8+
"## Notebook 4: TTS Workflow\n",
9+
"\n",
10+
"We have the exact podcast transcripts ready now. "
911
]
1012
},
1113
{
1214
"cell_type": "markdown",
1315
"id": "be20fda2-409e-4d86-b502-33aee1a73151",
1416
"metadata": {},
1517
"source": [
16-
"\n",
17-
"\n",
18-
"Copy-Pasted from: https://colab.research.google.com/drive/1dWWkZzvu7L9Bunq9zvD-W02RFUXoW-Pd?usp=sharing#scrollTo=68QtoUqPWdLk\n"
18+
"Credit: [This](https://colab.research.google.com/drive/1dWWkZzvu7L9Bunq9zvD-W02RFUXoW-Pd?usp=sharing#scrollTo=68QtoUqPWdLk) Colab was used for starter code\n"
1919
]
2020
},
2121
{

0 commit comments

Comments
 (0)