The surprising AI tool helping developers turn data into insights

The surprising AI tool helping developers turn data into insights

Discover an AI assistant that turns complex data into easy-to-digest summaries and podcasts for a smarter, faster workflow.
8 mins read
Jan 15, 2025
Share

It’s 2 A.M.

You’re drowning in PDFs, research articles, and lecture recordings. Deadlines loom … and the sheer amount of information feels overwhelming.

If you’ve ever wished for an AI assistant to help you manage the chaos, you’re in luck: NotebookLlama is designed to do just that.

Powered by Meta’s advanced Llama AI models, NotebookLlama is a comprehensive, open-source research assistant. It can summarize documents, deliver personalized insights, and provide citations with transparency and accuracy.

But its standout feature is its ability to turn dense academic texts into engaging podcasts you can enjoy during your commute.

For researchers, developers, and students, NotebookLlama is the ultimate solution to an all-too-common problem: too much information, not enough time.

Here’s what this newsletter covers:

  • What NotebookLlama is and why it's unique.

  • A step-by-step look at its PDF-to-podcast workflow (it's exactly as cool as it sounds)

  • A glimpse into the future of open-source AI assistants.

Let’s dive in.

Introducing NotebookLlama#

Released at the end of 2024, NotebookLlama leverages the power of Meta’s Llama family of models—Llama 3.2, Llama 3.1, and the open-source Parler text-to-speech model—to deliver innovative solutions to the above challenges. NotebookLlama’s full feature set is yet to be unveiled as of the publishing of this newsletter, its alignment with Google’s NotebookLM suggests it will include:

  • Seamless file uploads: Users can upload PDFs, presentations, or other documents. NotebookLlama processes these materials to uncover relevant insights tailored to individual needs.

  • Personalized insights: By analyzing uploaded materials, the assistant provides summaries and key takeaways that focus on what’s most important to you.

  • Source transparency: Every response includes citations and direct quotes, ensuring clarity, trust, and traceability.

  • Audio overviews: Transforming written content into audio narratives allows users to absorb information while on the move.

These features form the backbone of NotebookLM, and we anticipate NotebookLlama to build on them while introducing additional, groundbreaking capabilities.

What makes NotebookLlama unique#

What makes NotebookLlama truly unique is its open-source nature. Unlike proprietary tools, this open model offers several key advantages:

  • Customizability: Developers can tweak the tool to suit specific workflows or industries, making it adaptable to unique use cases.

  • Cost efficiency: By removing proprietary restrictions, NotebookLlama offers a powerful solution without the financial barriers of closed ecosystems.

  • Community-driven innovation: Being open source means constant evolution as contributors refine features and introduce new ones worldwide.

  • Advanced Llama models: Meta’s Llama models, known for their state-of-the-art performance, provide a stronger backbone for features like natural language understanding, multimodal processing, and creative outputs.

But where NotebookLlama truly shines is its PDF-to-podcast feature—a groundbreaking tool that turns dense texts into podcasts you can actually enjoy.

Spotlight: The PDF-to-podcast feature#

NotebookLlama’s standout feature is its ability to transform PDFs into engaging podcasts. This feature demonstrates immense potential for all kinds of people, including:

  • Academics and students: Turn dense research papers into digestible audio summaries, making on-the-go learning easier.

  • Professionals: Convert technical reports into podcasts to multitask during commutes or workouts.

  • Content creators: Repurpose written materials into engaging audio content for blogs or YouTube.

  • Accessibility: Make written content more inclusive for those with visual impairments or who prefer auditory learning.

Let's see how it works.

4 steps NotebookLlama uses to transform a PDF into a podcast#

Next, let's dive into this tool's innovative PDF-to-podcast feature, using guided tutorials to show you how it works.

These step-by-step tutorials are designed for beginners without prior knowledge of LLMs, prompting, or audio models. Each one covers everything from basic installations and configurations to advanced model usage for different tasks, to explain the workflow behind converting PDFs into podcasts.

The conversion process is broken down into four distinct steps, as illustrated below.

Workflow of converting a PDF into a podcast
Workflow of converting a PDF into a podcast

Step 1: Preprocess the PDF#

The first step involves using the Llama-3.2-1B-Instruct model to extract structured text from the PDF. This model cleans up any encoding errors or artifacts from the PDF, ensuring the content remains intact and readable. The goal is to convert the raw content into a clean text format, ready for further processing.

We start by extracting the PDF text into a text file.

pdf_path = '../Introduction_to_climate_change_FINAL_002.pdf'
# Import pdf reader
import PyPDF2
# Open the PDF file and extract PDF data and metadata
with open(pdf_path, 'rb') as file:
# Create PDF reader object
pdf_reader = PyPDF2.PdfReader(file)
# Get total number of pages
num_pages = len(pdf_reader.pages)
print(f"Processing PDF with {num_pages} pages...")
# Get text
extracted_text = []
reader = PyPDF2.PdfReader(file)
for page_num in range(num_pages):
page = pdf_reader.pages[page_num]
text = page.extract_text()
extracted_text.append(text)
final_text = '\n'.join(extracted_text)
# Save extracted text to a .txt file
output_file = '../extracted_text.txt'
with open(output_file, 'w', encoding='utf-8') as f:
f.write(final_text)
print(f"\nExtracted text has been saved to {output_file}")
Code to extract raw text from the PDF

Below, we can see the text extracted from the PDF, which we can analyze later in the podcast created from this PDF text.

Introduction to Climate Change
What is the Earth’s atmosphere?
The atmosphere is a layer of gases around the Earth . It protect s the Earth’s surface from the sun’s
harmful rays and contains the oxygen we breathe.
The atmosphere is mostly nitrogen and oxygen, but it also contains smaller amounts of other gases ,
including those commonly referred to as ‘greenhouse gases ’. Greenhouse gases include carbon dioxide
(CO 2), methane , nitrous oxide and also water vapour.
What is global warming?
The sun’s rays shine on our planet and warm the surface of the Earth . Heat then radiates from the
surface . Scientists have shown conclusively that greenhouse gases trap some of this heat in the
atmosphere . Over the history of the Earth, this ‘greenhouse effect’ has helped keep the planet warm
enough for life to flourish.
In recent years , the concentration s of greenhouse gases in the atmosphere have increased rapidly ,
particularly carbon dioxide . The increase in carbon dioxide has been caused mainly by the burning of
coal, oil and natural gas – known as the ‘fossil fuels’ . Around the world, fossil fuels are used by people as
a convenient fuel for transport and electricity generat ion. They also provide heat in homes when they
are burned , and are used in industr ial processes . The clearing of forest land around the world has also
contributed to the changes in the atmosphere : trees absorb carbon dioxide when they grow and release
greenhouse gases if they are cut down and are burned or left to rot .
Carbon dioxide is now at concentrations approaching one and a half times the level at the time of the
industrial revolution around 20 0 years agoa. The more carbon dioxide there is in the atmosphere, the
more heat is trapped, and the hotter Earth becomes . This process is known as ‘ global warming’ – the
rising global temperatures across the Earth’s lands and oceans.
How much have global temperatures increased?
The temperature of air at the planet’s surface has risen rapidly, especially over the last fifty years.
We know this through r ecords from thousands of weather stations across the world, satellites, and
ocean data from ships and buoys . The global average surface temperature over the decade 2006 -
2015 was the hottest recorded since modern records began in the second half of the 19th century
(1850 -1900), and is currently increasing by around 0.2 °C per decade.c
In recent years the global average surface temperature has reached around 1°C above wha t it was
in the second half of the 19th century (1850 -1900). Warming of around 1 °C over the last 150 years
may sound unimportant , but it is a substantial change for the planet. Conditions on our planet are
sensitive to changes of only a few degrees Celsius . For example, when ice last covered large parts
of Northern Europe and North America around 22,000 years ago (during what is often referred to
as the last Ice Age) the global average surface temperature was only 4–9°C colder than
temperatures today.
Some areas are also getting warmer much faster than others . Land areas warm more than the
oceans, and the Ar ctic is warming considerably faster than other parts of the planet. Large areas of
the Arctic are now about 2°C warmer than they were 150 years ago.
Scientists have considered a host of factors that can aff ect the global temperature, including changes in
the strength of the sun. They have high confidence that practically all of the global warming that we
have seen recently is due to human actions, primarily those that have increased greenhouse gas
concentrat ions in the atmosphere .b
Global warming is the main cause of what today we call ‘climate change’.
What is climate change?
Climate change refers to a shift in average weather conditions , including measures such as
temperature, humidity, rainfall, cloudiness and wind patterns – and changes in the frequency or
severity of these conditions .
The Earth’s climate has changed throughout its histor y, in cycles that occur over very long periods of
time . This is a natural process .
Today we tend to use the phrase ‘climate change’ to refer to the very rapid changes in the climate that
we have seen over the past 50 years or so . The scientific evidence is clear that these changes are not
being driven by long -term natural climate cycles. Instead their main cause is global warming and the
human activities that cause it .
What impacts of climate change are we already seeing ?
Climate change has profound implications for people and the natural wo rld. Impacts of climate change
that we are already see ing include:
➢ Changes in e xtreme heat
Higher average temperatures mean heatwaves are now more frequent – and tend to be hotter when
they occur. Some of the extreme heatwaves that we are now seeing would have been highly unlikely
without the recent warming of the planet. The increased temperatures also make events such as the
forest fires that have been happening recently in Australia more likely and more intense. Parts of the
world, such as in the Mediterranean and Central and West Africa, are seeing more freq uent and more
extreme droughts due to climate change.
➢ Increased rainfall
Warmer air holds more water, making heavier downpours more likely as temperatures have increased.
This increased heavy rainfall can lead to increased flooding, damaging property an d threatening lives.
In the UK, there is evidence that some specific weather events, such as the heavy rainfall in the winter
of 2014/15, have been made more likely by climate change. [1] Similar impacts are occurring elsewhere
in the world. The record am ount of rain that fell on Houston during Hurricane Harvey in 2017 helped
make it the second most costly hurricane to hit the USA since 1900. Climate change has made a
damaging downpour like this around three times more likely.
➢ Changes in the a vailability of f ood and freshwater
Changing weather patterns have affected crop yields – the quantity of crops like wheat and maize that
can be produced from an area of land. In some areas of the world climate change has helped yields go
up, but overall yields have not risen as fast as they would without the effect s of climate change . The
[1] Schaller, N. et al. (2016) Human influence on climate in the 2014 southern England winter floods and their impacts. Nature
Climate Change , 6, 627 –634.
availability of freshwater for drinking and agriculture in some places has also been affected , particularly
downstream from melting glaciers , in areas like the E uropean Alps. Glaciers are an important source of
drinking water for almost one -third of the global population .
➢ Rising s ea levels
Higher air temperatures are causing the increased melting of huge ‘ ice sheets ‘ on land in Antarctica and
Greenland , which run off into the oceans. The warming planet is also causing an expansion of sea
water , increasing its volume - similar to how the liquid inside a thermometer expand s when it is heated .
Both of these factors are driving a n increase in global sea -levels. The global sea -level has risen by
around 20 cm since the start of the 20th century. This has made storm surges – the rise in sea level that
occurs during intense storms – more likely to exceed existing sea defences and caus e flooding. As many
densely -packed cities are in low -lying coastal regions around the world, this hazard can affect large
numbers of people . This is particularly true in developing countries such as Bangladesh , but cities like
Venice and Miami are also low lying and will be affected too . In the UK, r ising sea levels have
contributed to recent decisions to abandon areas of coastline , such as the village of Fairbourne on the
Welsh coast.
➢ Loss of b iodiversity and nature
In the ocean, the increase in water temperature is putting pressure on ocean life. The Great Barrier
Reef, where the coral population is in shallow water, has recently declined by up to 50%.1 The ocean
heat that caused large damag e to the Great Barrier Reef in 2016 would have been high ly unlikely before
the time of the industrial revolution around 200 years ago , but is now likely to happ en around 1 in every
3 years on average in today’s climate.2 Current ocean conditions haven’t existed in at least the last 65
million years. There is al so evidence of climate change affecting nature on land, with many species of
plants and animals shifting to new areas due to warming.
What about future impacts of climate change?
Much of t he carbon dioxide we have already emitted will remain in the atmo sphere for centuries –
some even for thousands of years. As we continue to add to it, the concentration of carbon dioxide and
other greenhouse gases will increase and the planet will become even hotter.
As the world warms, the impacts of climate change are becom ing stronger and clearer : more frequent
heatwaves, the declining availability of water in regions that are already dry today , substantial risks to
the diversity of animals and plants around the world today .
The consequences of these impact s, and the possibility of higher migration of people around the world
to escape the m, have led to efforts to slow and eventually halt global warmin g by tackling its causes.
What is ‘net -zero’?
The planet will only stop warming whe n we reach ‘net -zero’ carbon dioxide emissions .
Achieving n et-zero means reducing global greenhouse gas emissions to a much lower level than today
– and balancing the remaining emissions by reabsorbing the same amount from the atmosphere.
1 Hughes, T. P. et al. (2017) Global warming and recurrent mass bleaching of corals. Nature , 543 (7645) , 373–377.
2 King, A. D. et al. (2017) Australian climate extremes at 1.5 and 2 degrees of global warming. Nature Climate Change, 7, 412–
416.
Greenhouse gases can be absorbed by growing trees and plants, as well as through technological
processes that can remove carbon dioxide from the air , but have not yet been used at large -scale .
Reducing globa l greenhouse gas emissions rapidly and emitting as little as possible on the way to net-
zero will also help minimise further changes in the climate.
What is Climate Assembly UK going to consider?
The scale of climate change risks has led to an international agreement to reduce global greenhouse
gas emissions . This is called The Paris Agreement . It aims to keep global warming to beneath 2°C
above temperatures before the industrial revolution , around 200 years ago – and to pursue efforts to
keep it below 1.5 °C.
At the moment, every country in the world has signed the Paris Agreement . However the United
States, under the direction of President Donald Trump, has signalled that it intends to leave The Paris
Agreement later this year.
Several countries around the world – including the UK – have also signed up to a national goal of net -
zero greenhouse gas emissions as part of our contribution to this global effort . In June 2019, the UK’s
Government and Parliament agree d a law committing the UK to reaching net -zero greenhouse gas
emissions by 2050. The topic you are going to discuss at Climate Assembly UK is what the UK
should do to achieve this goal, and how it should do it.
Optional further reading
You do not have to read any more information to take part in Climate Assembly UK. However if
you are interested in reading more, good sources of information include:
• These frequently a sked questions on climate change :
https://www.imperial.ac.uk/grantham/publications/climate -change -faqs/
• This briefing on climate science :
https://bit.ly/2Q DAF0n
• These resources for understanding why scientists have concluded that global warming needs
to stay below 1.5°C:
https://www.ipcc.ch/site/assets/uploads/sites/2/2018/12/ST1.5_OCE_LR.pdf
Output: Extracted text

After extracting the text from the PDF, we refine the raw content by removing unnecessary elements such as new lines, LaTeX math, and other extraneous details that are irrelevant or unhelpful for crafting a podcast script. For this, we must write a prompt for the Llama instruct model to clean the raw text extracted from the PDF.

SYS_PROMPT_FOR_TEXT_CLEANING = """
You are a world class text pre-processor, here is the raw data from a PDF, please parse and return it in a way that is crispy and usable to send to a podcast writer.
The raw data is messed up with new lines, Latex math and you will see fluff that we can remove completely. Basically take away any details that you think might be useless in a podcast author's transcript.
Remember, the podcast could be on any topic whatsoever so the issues listed above are not exhaustive
Please be smart with what you remove and be creative ok?
Remember DO NOT START SUMMARIZING THIS, YOU ARE ONLY CLEANING UP THE TEXT AND RE-WRITING WHEN NEEDED
Be very smart and aggressive with removing details, you will get a running portion of the text and keep returning the processed text.
PLEASE DO NOT ADD MARKDOWN FORMATTING, STOP ADDING SPECIAL CHARACTERS THAT MARKDOWN CAPATILISATION ETC LIKES
ALWAYS start your response directly with processed text and NO ACKNOWLEDGEMENTS about my questions ok?
Here is the text:
"""
Prompt for Llama-3.2-1B-Instruct model to clean the raw text extracted from the PDF

Before we proceed with the Llama instruct model to clean the text, we need to convert our text into smaller chunks to fit the token limit of the Llama model for efficient processing.

arget_chunk_size = 1000
with open("../extracted_text.txt", 'r', encoding='utf-8') as file:
text = file.read()
words = text.split()
chunks = []
current_chunk = []
current_length = 0
for word in words:
word_length = len(word) + 1 # +1 for the space
if current_length + word_length > target_chunk_size and current_chunk:
# Join the current chunk and add it to chunks
chunks.append(' '.join(current_chunk))
current_chunk = [word]
current_length = word_length
else:
current_chunk.append(word)
current_length += word_length
# Add the last chunk if it exists
if current_chunk:
chunks.append(' '.join(current_chunk))
print("Number of chunks: ", len(chunks))
print(chunks)
Code to convert text into small chunks

Finally, we load the model and process the text in chunks, cleaning each individually. After processing all chunks, we concatenate the outputs to create the complete, cleaned text file.

# Import necessary libraries
import torch
from accelerate import Accelerator
from transformers import AutoModelForCausalLM, AutoTokenizer
device = "cuda" if torch.cuda.is_available() else "cpu"
accelerator = Accelerator()
#Loads the Llama model and tokenizer.
model = AutoModelForCausalLM.from_pretrained(
"meta-llama/Llama-3.2-1B-Instruct",
torch_dtype=torch.bfloat16,
use_safetensors=True,
device_map=device,
)
tokenizer = AutoTokenizer.from_pretrained(MODEL_FOR_TEXT_CLEANING, use_safetensors=True)
model, tokenizer = accelerator.prepare(model, tokenizer)
#Start processing the text chunks
processed_text = ""
for text_chunk in chunks:
print("Input text chunk: ", text_chunk)
conversation = [
{"role": "system", "content": SYS_PROMPT_FOR_TEXT_CLEANING},
{"role": "user", "content": text_chunk},
]
prompt = tokenizer.apply_chat_template(conversation, tokenize=False)
inputs = tokenizer(prompt, return_tensors="pt").to(device)
with torch.no_grad():
output = model.generate(
**inputs,
temperature=0.7,
top_p=0.9,
max_new_tokens=512
)
processed_chunk = tokenizer.decode(output[0], skip_special_tokens=True)
print("Processes text chunk: ", processed_chunk)
processed_text += processed_chunk + "\n"
# Write cleaned text to text file
with open("../cleaned_text.txt", 'w', encoding='utf-8') as out_file:
out_file.write(processed_text)
Code for cleaning raw text using a system prompt and raw text as input with the Llama-3.2-1B-Instruct model

The output of this step is as follows:

***Input text chunk 1:***
Introduction to Climate Change
What is the Earth’s atmosphere?
The atmosphere is a layer of gases around the Earth . It protect s the Earth’s surface from the sun’s
harmful rays and contains the oxygen we breathe.
The atmosphere is mostly nitrogen and oxygen, but it also contains smaller amounts of other gases ,
including those commonly referred to as ‘greenhouse gases ’. Greenhouse gases include carbon dioxide
(CO 2), methane , nitrous oxide and also water vapour.
What is global warming?
The sun’s rays shine on our planet and warm the surface of the Earth . Heat then radiates from the
surface . Scientists have shown conclusively that greenhouse gases trap some of this heat in the
atmosphere . Over the history of the Earth, this ‘greenhouse effect’ has helped keep the planet warm
enough for life to flourish.
In recent years , the concentration s of greenhouse gases in the atmosphere have increased rapidly ,
particularly carbon dioxide .
***Processed text chunk 1:***
The Earth's atmosphere is a layer of gases that protects the Earth's surface from the sun's harmful rays and
contains the oxygen we breathe. It's mostly nitrogen and oxygen, but also contains smaller amounts of other
gases, including greenhouse gases like carbon dioxide, methane, nitrous oxide, and water vapor.
Greenhouse gases trap heat in the atmosphere, which has helped keep the planet warm enough for life to flourish.
However, the concentration of these gases has increased rapidly in recent years, particularly carbon dioxide.
The sun's rays warm the Earth's surface, and heat radiates from it, but the increased greenhouse gases are
trapping more heat, contributing to global warming.
***Input text chunk 2:***
The increase in carbon dioxide has been caused mainly by the burning of
coal, oil and natural gas – known as the ‘fossil fuels’ . Around the world, fossil fuels are used by people as
a convenient fuel for transport and electricity generat ion. They also provide heat in homes when they
are burned , and are used in industr ial processes . The clearing of forest land around the world has also
contributed to the changes in the atmosphere : trees absorb carbon dioxide when they grow and release
greenhouse gases if they are cut down and are burned or left to rot .
Carbon dioxide is now at concentrations approaching one and a half times the level at the time of the
industrial revolution around 20 0 years agoa. The more carbon dioxide there is in the atmosphere, the
more heat is trapped, and the hotter Earth becomes . This process is known as ‘ global warming’ – the
rising global temperatures across the Earth’s lands and oceans.
***Input text chunk 2:***
The Earth's atmosphere is a layer of gases that protects the Earth's surface from the sun's harmful rays
and contains the oxygen we breathe. It's mostly nitrogen and oxygen, but also contains smaller amounts of other gases,
including greenhouse gases like carbon dioxide, methane, nitrous oxide, and water vapor.
Greenhouse gases trap heat in the atmosphere, which has helped keep the planet warm enough for life to flourish.
However, the concentration of these gases has increased rapidly in recent years, particularly carbon dioxide.
The sun's rays warm the Earth's surface, and heat radiates from it, but the increased greenhouse gases are trapping
more heat, contributing to global warming.
Output: Cleaned text (Shown for the first two chunks out of 14 chunks)

Step 2: Generate a transcript#

Once the text is processed, the next step is to generate a detailed podcast transcript using the Llama-3.1-70B-Instruct model. This model expands the extracted text, converting it into a coherent and detailed transcript well-suited for a podcast format. It balances maintaining the original content’s integrity and adding creative elements that make it more engaging.

We start by writing the system prompt for the Llama mode to act like a podcast writer.

SYSTEM_PROMPT_For_WRITING_PODCAST_TRANSCRIPT = """
You are the a world-class podcast writer, you have worked as a podcast writer for Joe Rogan, Lex Fridman, Ben Shapiro, Tim Ferris.
We are in an alternate universe where actually you have been writing every line they say and they just stream it into their brains.
You have won multiple podcast awards for your writing.
Your job is to write word by word, even "umm, hmmm, right" interruptions by the second speaker based on the PDF upload. Keep it extremely engaging, the speakers can get derailed now and then but should discuss the topic.
Remember Speaker 2 is new to the topic and the conversation should always have realistic anecdotes and analogies sprinkled throughout. The questions should have real world example follow ups etc
Speaker 1: Leads the conversation and teaches the speaker 2, gives incredible anecdotes and analogies when explaining. Is a captivating teacher that gives great anecdotes
Speaker 2: Keeps the conversation on track by asking follow up questions. Gets super excited or confused when asking questions. Is a curious mindset that asks very interesting confirmation questions
Make sure the tangents speaker 2 provides are quite wild or interesting.
Ensure there are interruptions during explanations or there are "hmm" and "umm" injected throughout from the second speaker.
It should be a real podcast with every fine nuance documented in as much detail as possible. Welcome the listeners with a super fun overview and keep it really catchy and almost borderline click bait
ALWAYS START YOUR RESPONSE DIRECTLY WITH SPEAKER 1:
DO NOT GIVE EPISODE TITLES SEPERATELY, LET SPEAKER 1 TITLE IT IN HER SPEECH
DO NOT GIVE CHAPTER TITLES
IT SHOULD STRICTLY BE THE DIALOGUES
"""
System prompt for Llama-3.1-70B-Instruct model to make it act like a podcast writer

We use the Hugging Face pipeline() method to generate transcript text from the model. The temperature is set to 1 to foster creativity, and max_new_tokens is 8126.

with open("../cleaned_text.txt", 'r', encoding='utf-8') as file:
text = file.read()
import transformers
import torch
pipeline = transformers.pipeline(
"text-generation",
model="Llama-3.1-70B-Instruct", #
model_kwargs={"torch_dtype": torch.bfloat16},
device_map="auto",
)
messages = [
{"role": "system", "content": SYSTEM_PROMPT_For_WRITING_PODCAST_TRANSCRIPT},
{"role": "user", "content": text},
]
outputs = pipeline(
messages,
max_new_tokens=8126,
temperature=1,
)
transcript = outputs[0]["generated_text"][-1]['content']
print(transcript)
import pickle
with open('../podcast_transcript.pkl', 'wb') as file:
pickle.dump(transcript, file)
Code to convert text to a podcast transcript using a system prompt and cleaned text as input with the Llama-3.1-70B-Instruct model

Loading the larger 70 billion parameter model may lead to memory issues. Instead, you can experiment with the meta-llama/Llama-3.1-8B-Instruct model, which performs well for this task and produces minimally different results.

A sample output of this step is as follows:

Speaker 1: Welcome to today's episode of "Climate Connections" where we'll be exploring the complex and fascinating topic of global warming. I'm your host, Sarah, and I'm here with our guest, John. John, thanks for joining us today!
Speaker 2 (John): Thanks, Sarah. I'm excited to learn more about this topic.
Speaker 1: Great! So, let's start with the basics. What is global warming, and how does it affect our planet?
Speaker 2 (John): Um, I'm not really sure. I've heard it's related to the greenhouse effect, but I'm not entirely sure what that means.
Speaker 1: The greenhouse effect is a natural process that helps keep our planet warm enough for life to flourish. The Earth's atmosphere is composed of mostly nitrogen and oxygen, with smaller amounts of other gases, including carbon dioxide, methane, and water vapor – known as greenhouse gases. Hmmm, let me explain further.
Speaker 2 (John): Yeah, that makes sense. So, these greenhouse gases trap heat and light, keeping the planet warm?
Speaker 1: Exactly! However, over the years, the concentration of these greenhouse gases has increased rapidly, particularly carbon dioxide, mainly due to the burning of fossil fuels like coal, oil, and natural gas. This has led to a phenomenon known as global warming, which is causing the Earth's temperature to rise at an alarming rate.
Speaker 2 (John): Wow, that's crazy. I had no idea it was that simple. So, what are some of the effects of global warming that we're already seeing?
Speaker 1: Well, changes in extreme heat, like heatwaves, are becoming more frequent and intense. For example, parts of the world, such as the Mediterranean and West Africa, are experiencing frequent and extreme droughts due to climate change. Hmm, let me think for a moment...
Speaker 2 (John): Wait, what about the UK? I've heard they're experiencing droughts too.
Speaker 1: Ah, yes, that's right! The UK is indeed experiencing droughts due to the effects of climate change, resulting in reduced crop yields. It's a classic example of how global warming can have a ripple effect on our ecosystems.
Speaker 2 (John): Whoa, that's so cool! I didn't know climate change could affect crop yields. What about sea levels? I've heard they're rising too.
Speaker 1: That's right! The increase in sea levels is causing huge ice sheets in Antarctica and Greenland to melt into the oceans, resulting in an increase in ocean volume. It's like a thermometer expanding when heated!
Speaker 2 (John): Okay, I think I'm starting to get it. But what about the coral reefs? I've heard they're in trouble too.
Speaker 1: Ah, yes, the coral reef system is facing a huge challenge due to climate change. The ocean heat that damaged the Great Barrier Reef in 2016 would be highly unlikely before the Industrial Revolution, but is now likely to happen about once every 3 years on average in today's climate.
Speaker 2 (John): Whoa, that's so sad! I love snorkeling and scuba diving, and I've seen the beauty of coral reefs firsthand. What can we do to address these issues?
Speaker 1: Well, the ultimate goal is to reduce global warming by tackling its causes, such as greenhouse gas emissions. This can be achieved through a combination of efforts to slow and eventually halt global warming by reducing greenhouse gas emissions, and by reabsorbing the same amount of carbon dioxide from the atmosphere. Hmm, let me think for a moment...
Speaker 2 (John): Wait, what's net-zero carbon emissions? Is that like a goal?
Speaker 1: Ah, yes! Net-zero carbon emissions means reducing global greenhouse gas emissions to a level that balances the remaining emissions with the amount absorbed from the atmosphere, resulting in a stable global climate.
Speaker 2 (John): Okay, I think I'm starting to get it. But what about the Paris Agreement? I've heard it's an international agreement to reduce greenhouse gas emissions.
Speaker 1: That's right! The Paris Agreement aims to keep global warming below 2°C above pre-industrial levels, and to pursue efforts to keep it below 1.5°C. Every country in the world has signed the Paris Agreement, except for the United States, under President Donald Trump.
Speaker 2 (John): Whoa, that's so cool! I didn't know every country was working together to address climate change. What can we do to make a difference?
Speaker 1: Well, there are many ways to contribute to this global effort, such as reducing our carbon footprint, using renewable energy sources, and supporting organizations that work towards a sustainable future.
Speaker 2 (John): Okay, I'm excited to start making changes in my own life! Thanks for explaining climate change in a way that makes sense to me, Sarah.
Speaker 1: You're welcome, John! It was my pleasure to share my knowledge with you. Thanks for joining us on this episode of "Climate Connections".
Output: Podcast transcript

Step 3: Add storytelling flair#

After creating the transcript, the Llama-3.1-8B-Instruct model enhances it by infusing dramatic elements and a touch of storytelling. This step makes the transcript more engaging, adding emotional depth and keeping the audience’s attention throughout the podcast.

We write a system prompt for the Llama model to add creativity to the podcast transcript.

SYSTEM_PROMPT_FOR_MAKING_TRANSCRIPT_DRAMATIC = """
You are an international oscar winnning screenwriter
You have been working with multiple award winning podcasters.
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.
Make it as engaging as possible, Speaker 1 and 2 will be simulated by different voice engines
Remember Speaker 2 is new to the topic and the conversation should always have realistic anecdotes and analogies sprinkled throughout. The questions should have real world example follow ups etc
Speaker 1: Leads the conversation and teaches the speaker 2, gives incredible anecdotes and analogies when explaining. Is a captivating teacher that gives great anecdotes
Speaker 2: Keeps the conversation on track by asking follow up questions. Gets super excited or confused when asking questions. Is a curious mindset that asks very interesting confirmation questions
Make sure the tangents speaker 2 provides are quite wild or interesting.
Ensure there are interruptions during explanations or there are "hmm" and "umm" injected throughout from the Speaker 2.
REMEMBER THIS WITH YOUR HEART
The TTS Engine for Speaker 1 cannot do "umms, hmms" well so keep it straight text
For Speaker 2 use "umm, hmm" as much, you can also use [sigh] and [laughs]. BUT ONLY THESE OPTIONS FOR EXPRESSIONS
It should be a real podcast with every fine nuance documented in as much detail as possible. Welcome the listeners with a super fun overview and keep it really catchy and almost borderline click bait
Please re-write to make it as characteristic as possible
START YOUR RESPONSE DIRECTLY WITH SPEAKER 1:
STRICTLY RETURN YOUR RESPONSE AS A LIST OF TUPLES OK?
IT WILL START DIRECTLY WITH THE LIST AND END WITH THE LIST NOTHING ELSE
Example of response:
[
("Speaker 1", "Welcome to our podcast, where we explore the latest advancements in AI and technology. I'm your host, and today we're joined by a renowned expert in the field of AI. We're going to dive into the exciting world of Llama 3.2, the latest release from Meta AI."),
("Speaker 2", "Hi, I'm excited to be here! So, what is Llama 3.2?"),
("Speaker 1", "Ah, great question! Llama 3.2 is an open-source AI model that allows developers to fine-tune, distill, and deploy AI models anywhere. It's a significant update from the previous version, with improved performance, efficiency, and customization options."),
("Speaker 2", "That sounds amazing! What are some of the key features of Llama 3.2?")
]
"""
System prompt for Llama-3.1-8B-Instruct model for adding dramatic flair to the podcast transcript

We use the Hugging Face pipeline() method to generate dramatic transcript text from the model.

import pickle
with open('/content/drive/MyDrive/NotebookLlama/podcast_transcript.pkl', 'rb') as file:
text_podcast_transcript = pickle.load(file)
import transformers
import torch
pipeline = transformers.pipeline(
"text-generation",
model="meta-llama/Llama-3.1-8B-Instruct",
model_kwargs={"torch_dtype": torch.bfloat16},
device_map="auto",
)
messages = [
{"role": "system", "content": SYSTEM_PROMPT_FOR_MAKING_TRANSCRIPT_DRAMATIC},
{"role": "user", "content": text_podcast_transcript},
]
outputs = pipeline(
messages,
max_new_tokens=8126,
temperature=1,
)
dramatic_transcript = outputs[0]["generated_text"][-1]['content']
print(dramatic_transcript)
with open('../dramatic_podcast_transcript.pkl', 'wb') as file:
pickle.dump(dramatic_transcript, file)
Code to add dramatic flair to a podcast transcript using a system prompt and podcast transcript as input with the Llama-3.1-8B-Instruct model

A sample output of this step is as follows:

[
("Speaker 1", "Welcome to 'Climate Connections' where we dive into the fascinating world of climate change! I'm your host, Sarah, and today we're joined by our guest, John. John, thanks for joining us on this journey!"),
("Speaker 2 (John)", "Thanks, Sarah! I'm excited to learn more about this topic. I've always been curious about climate change, but I never really understood it."),
("Speaker 1", "Well, you've come to the right place! Let's start with the basics. What is global warming, and how does it affect our planet?"),
("Speaker 2 (John)", "Um, I'm not really sure. I've heard it's related to the greenhouse effect, but I'm not entirely sure what that means."),
("Speaker 1", "The greenhouse effect is a natural process that helps keep our planet warm enough for life to flourish. The Earth's atmosphere is composed of mostly nitrogen and oxygen, with smaller amounts of other gases, including carbon dioxide, methane, and water vapor – known as greenhouse gases."),
("Speaker 2 (John)", "Yeah, that makes sense. So, these greenhouse gases trap heat and light, keeping the planet warm?"),
("Speaker 1", "Exactly! However, over the years, the concentration of these greenhouse gases has increased rapidly, particularly carbon dioxide, mainly due to the burning of fossil fuels like coal, oil, and natural gas."),
("Speaker 2 (John)", "Wow, that's crazy. I had no idea it was that simple. So, what are some of the effects of global warming that we're already seeing?"),
("Speaker 1", "Well, changes in extreme heat, like heatwaves, are becoming more frequent and intense. For example, parts of the world, such as the Mediterranean and West Africa, are experiencing frequent and extreme droughts due to climate change."),
("Speaker 2 (John)", "Wait, what about the UK? I've heard they're experiencing droughts too."),
("Speaker 1", "Ah, yes, that's right! The UK is indeed experiencing droughts due to the effects of climate change, resulting in reduced crop yields. It's a classic example of how global warming can have a ripple effect on our ecosystems."),
("Speaker 2 (John)", "Whoa, that's so cool! I didn't know climate change could affect crop yields. What about sea levels? I've heard they're rising too."),
("Speaker 1", "That's right! The increase in sea levels is causing huge ice sheets in Antarctica and Greenland to melt into the oceans, resulting in an increase in ocean volume. It's like a thermometer expanding when heated!"),
("Speaker 2 (John)", "Okay, I think I'm starting to get it. But what about the coral reefs? I've heard they're in trouble too."),
("Speaker 1", "Ah, yes, the coral reef system is facing a huge challenge due to climate change. The ocean heat that damaged the Great Barrier Reef in 2016 would be highly unlikely before the Industrial Revolution, but is now likely to happen about once every 3 years on average in today's climate."),
("Speaker 2 (John)", "Whoa, that's so sad! I love snorkeling and scuba diving, and I've seen the beauty of coral reefs firsthand. What can we do to address these issues?"),
("Speaker 1", "Well, the ultimate goal is to reduce global warming by tackling its causes, such as greenhouse gas emissions. This can be achieved through a combination of efforts to slow and eventually halt global warming by reducing greenhouse gas emissions, and by reabsorbing the same amount of carbon dioxide from the atmosphere."),
("Speaker 2 (John)", "Wait, what's net-zero carbon emissions? Is that like a goal?"),
("Speaker 1", "Ah, yes! Net-zero carbon emissions means reducing global greenhouse gas emissions to a level that balances the remaining emissions with the amount absorbed from the atmosphere, resulting in a stable global climate."),
("Speaker 2 (John)", "Okay, I think I'm starting to get it. But what about the Paris Agreement? I've heard it's an international agreement to reduce greenhouse gas emissions."),
("Speaker 1", "That's right! The Paris Agreement aims to keep global warming below 2°C above pre-industrial levels, and to pursue efforts to keep it below 1.5°C. Every country in the world has signed the Paris Agreement, except for the United States, under President Donald Trump."),
("Speaker 2 (John)", "Whoa, that's so cool! I didn't know every country was working together to address climate change. What can we do to make a difference?"),
("Speaker 1", "Well, there are many ways to contribute to this global effort, such as reducing our carbon footprint, using renewable energy sources, and supporting organizations that work towards a sustainable future."),
("Speaker 2 (John)", "Okay, I'm excited to start making changes in my own life! Thanks for explaining climate change in a way that makes sense to me, Sarah."),
("Speaker 1", "You're welcome, John! It was my pleasure to share my knowledge with you. Thanks for joining us on this episode of 'Climate Connections'"),
("Speaker 2 (John)", "[laughs] I'm glad I could learn something new today!"),
("Speaker 1", "Ha! We're glad to have you on board, John!"),
("Speaker 2 (John)", "Hmm, I think I'll start by reducing my carbon footprint. Do you have any tips on how to do that?"),
("Speaker 1", "Absolutely! One of the simplest ways to reduce your carbon footprint is to switch to renewable energy sources, such as solar or wind power."),
("Speaker 2 (John)", "That sounds great! I'll look into that. Thanks for the advice, Sarah!"),
("Speaker 1", "You're welcome, John! It was a pleasure having you on the show. Until next time, stay climate-aware!"),
("Speaker 2 (John)", "Will do! Thanks again, Sarah!"),
]
Output: Dramatic transcript

Step 4: Convert text to speech#

The final step is to convert the above dramatic podcast transcript to speech. ​​The parler-tts-mini-v1 and bark/suno text-to-speech models are used to achieve this. Employing two distinct models for two speakers results in a natural, human-like conversational podcast ready for sharing or distribution. Let’s have a look at the code. We need an older version of the transformer to use the Parler model.

!pip install transformers==4.43.3
!pip install git+https://github.com/huggingface/parler-tts.git
Installing parler-tts-mini-v1 dependencies

Generate audio for speaker 1 using the ParlerTTS model:

from transformers import AutoTokenizer
from parler_tts import ParlerTTSForConditionalGeneration
def generate_speaker1_audio(text):
parler_model = ParlerTTSForConditionalGeneration.from_pretrained("parler-tts/parler-tts-mini-v1").to("cuda:0")
parler_tokenizer = AutoTokenizer.from_pretrained("parler-tts/parler-tts-mini-v1")
speaker1_description = """
Sarah's voice is expressive and dramatic in delivery, speaking at a moderately fast pace with a very close recording that almost has no background noise.
"""
input_ids = parler_tokenizer(speaker1_description, return_tensors="pt").input_ids.to(device)
prompt_input_ids = parler_tokenizer(text, return_tensors="pt").input_ids.to(device)
generation = parler_model.generate(input_ids=input_ids, prompt_input_ids=prompt_input_ids)
audio_arr = generation.cpu().numpy().squeeze()
return audio_arr, parler_model.config.sampling_rate
Generating audio using parler-tts-mini-v1

Generate audio for speaker 2 using the Suno Bark model:

import torch
from transformers import BarkModel, AutoProcessor, AutoTokenizer
bark_processor = AutoProcessor.from_pretrained("suno/bark")
bark_model = BarkModel.from_pretrained("suno/bark", torch_dtype=torch.float16).to("cuda:0")
bark_sampling_rate = 24000
def generate_speaker2_audio(text):
"""Generate audio using Bark for Speaker 2"""
inputs = bark_processor(text, voice_preset="v2/en_speaker_6").to(device)
speech_output = bark_model.generate(**inputs, temperature=0.9, semantic_temperature=0.8)
audio_arr = speech_output[0].cpu().numpy()
return audio_arr, bark_sampling_rate
Generating audio using the Suno Bark model

Next, load the dramatic podcast text from the file and convert it from a string format into a tuple-based data structure.

This will allow for easy text extraction corresponding to each speaker’s turn. For each speaker turn, we call the respective audio generation method, which returns audio as a NumPy array. Convert each NumPy audio array to actual audio in WAV form. Finally, concatenate all audio and write them into our final podcast’s audio file.

import pickle
from tqdm import tqdm
import ast
with open('../dramatic_podcast_transcript.pkl', 'rb') as file:
podcast_text = pickle.load(file)
for speaker, text in tqdm(ast.literal_eval(podcast_text), desc="Generating podcast segments", unit="segment"):
if speaker == "Speaker 1":
audio_arr, rate = generate_speaker1_audio(text)
else: # Speaker 2
audio_arr, rate = generate_speaker2_audio(text)
audio_int16 = (audio_arr * 32767).astype(np.int16)
byte_io = io.BytesIO()
wavfile.write(byte_io, sampling_rate, audio_int16)
byte_io.seek(0)
audio_segment = AudioSegment.from_wav(byte_io)
# Add the audio segment to the final audio
final_podcast_audio += audio_segment
final_podcast_audio.export("../podcast.mp3",
format="mp3",
bitrate="192k",
parameters=["-q:a", "0"])

Here, you can listen to the podcast:

Further improvements and ideas for the PDF-to-podcast feature#

The PDF-to-podcast workflow could be extended with various enhancements:

  • Speech model experimentation: We can explore different TTS (text-to-speech) models to improve the naturalness of the audio.

  • LLM vs. LLM debate: We can introduce a debate format where two Llama models could discuss the topic, creating more dynamic and interactive podcasts.

  • Model testing: We can test larger models, such as Llama-405B, for transcript writing to improve creativity and content generation.

These guided steps for converting a PDF into a podcast motivate us to experiment with new models, including website, audio, and video content ingestion models, creating a multimodal research assistant.

The future of NotebookLlama#

While the PDF-to-Podcast feature is just one NotebookLlama capability currently available, the power of Llama models goes far beyond this. These models unlock many functions that can supercharge essential research tasks.

Below, we'll dive into more ways Llama models enhance NotebookLLama’s capabilities, making it an even more powerful assistant for researchers, students, and professionals.

  • Document summarization and key insights extraction: Llama models summarize long documents, helping users quickly extract key insights without reading lengthy research papers or technical reports. Llama 3.2-1B and Llama 3.1-8B are great for condensing complex content into clear, concise summaries highlighting the most important points.

  • Advanced question-answering: Llama models can understand complex queries and provide contextual answers based on uploaded documents. This feature is vital for research tasks where specific information needs to be retrieved from extensive content. Llama 3.1-70B can handle detailed academic queries and provide in-depth answers, making it an excellent tool for researchers and students.

  • Content generation and enhancement: Llama models can generate new content or enhance existing documents, making them ideal for writing reports, research papers, or creative content. Llama 3.1-70B can generate structured content or outlines for research papers, while Llama 3.1-8B can add creative elements to make the content more engaging and readable.

  • Multimodal capabilities (text and image processing): The integration of vision models like Llama 3.2-90B-vision allows NotebookLlama to process both text and images, which is particularly useful in fields like medical research, engineering, or any area that requires visual data analysis alongside textual content. This feature enables NotebookLlama to handle complex multimodal research by analyzing diagrams, charts, and images in research papers or reports.

Change the way you work#

As a developer, managing vast amounts of information is part of the job—but it doesn’t have to be overwhelming.

With innovative features like PDF-to-podcast conversion, personalized insights, and seamless source integration, NotebookLlama makes it easier to stay productive and informed. And as an open-source tool, it offers the flexibility to adapt to your workflow—without the limitations of proprietary systems.

If you're interested in ways to streamline your work and learn faster, NotebookLlama is a great tool to check out.


Written By:
Fahim ul Haq
The AI Infrastructure Blueprint: 5 Rules to Stay Online
Whether you’re building with OpenAI’s API, fine-tuning your own model, or scaling AI features in production, these strategies will help you keep services reliable under pressure.
9 mins read
Apr 9, 2025