Skip to content

Commit 2fee9e9

Browse files
committed
load env
1 parent 108b5e7 commit 2fee9e9

File tree

2 files changed

+13
-49
lines changed

2 files changed

+13
-49
lines changed

main.ipynb

+13-48
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,23 @@
66
"metadata": {},
77
"outputs": [],
88
"source": [
9-
"!pip3 install google\n",
10-
"!pip3 install beautifulsoup4"
9+
"!pip install google\n",
10+
"!pip install beautifulsoup4"
1111
]
1212
},
1313
{
1414
"cell_type": "code",
15-
"execution_count": 24,
15+
"execution_count": 5,
1616
"metadata": {},
1717
"outputs": [],
1818
"source": [
1919
"from googlesearch import search\n",
2020
"import requests\n",
2121
"import re\n",
2222
"import os\n",
23-
"from bs4 import BeautifulSoup"
23+
"from bs4 import BeautifulSoup\n",
24+
"from dotenv import load_dotenv, find_dotenv\n",
25+
"_ = load_dotenv(find_dotenv())"
2426
]
2527
},
2628
{
@@ -155,7 +157,7 @@
155157
},
156158
{
157159
"cell_type": "code",
158-
"execution_count": 25,
160+
"execution_count": 6,
159161
"metadata": {},
160162
"outputs": [],
161163
"source": [
@@ -202,42 +204,18 @@
202204
},
203205
{
204206
"cell_type": "code",
205-
"execution_count": 12,
207+
"execution_count": null,
206208
"metadata": {},
207-
"outputs": [
208-
{
209-
"name": "stdout",
210-
"output_type": "stream",
211-
"text": [
212-
"[Document(page_content='Skip to main contentWhat is a large language model (LLM)?Explore popular open-source LLMsLarge language model definitionA large language model (LLM) is a deep learning algorithm that can perform a variety of natural language processing (NLP) tasks. Large language models use transformer models and are trained using massive datasets — hence, large. This enables them to recognize, translate, predict, or generate text or other content.Large language models are also referred to as neural networks (NNs), which are computing systems inspired by the human brain. These neural networks work using a network of nodes that are layered, much like neurons.In addition to teaching human languages to artificial intelligence (AI) applications, large language models can also be trained to perform a variety of tasks like understanding protein structures, writing software code, and more. Like the human brain, large language models must be pre-trained and then fine-tuned so that they can solve text classification, question', metadata={'source': 'scraped.txt'}), Document(page_content='text classification, question answering, document summarization, and text generation problems. Their problem-solving capabilities can be applied to fields like healthcare, finance, and entertainment where large language models serve a variety of NLP applications, such as translation, chatbots, AI assistants, and so on.Large language models also have large numbers of parameters, which are akin to memories the model collects as it learns from training. Think of these parameters as the model’s knowledge bank.So, what is a transformer model? A transformer model is the most common architecture of a large language model. It consists of an encoder and a decoder. A transformer model processes data by tokenizing the input, then simultaneously conducting mathematical equations to discover relationships between tokens. This enables the computer to see the patterns a human would see were it given the same query.Transformer models work with self-attention mechanisms, which enables the model to learn more quickly than', metadata={'source': 'scraped.txt'}), Document(page_content=\"to learn more quickly than traditional models like long short-term memory models. Self-attention is what enables the transformer model to consider different parts of the sequence, or the entire context of a sentence, to generate predictions.Related: Apply transformers to your search applicationsKey components of large language modelsLarge language models are composed of multiple neural network layers. Recurrent layers, feedforward layers, embedding layers, and attention layers work in tandem to process the input text and generate output content.The embedding layer creates embeddings from the input text. This part of the large language model captures the semantic and syntactic meaning of the input, so the model can understand context.The feedforward layer (FFN) of a large language model is made of up multiple fully connected layers that transform the input embeddings. In so doing, these layers enable the model to glean higher-level abstractions — that is, to understand the user's intent with the text\", metadata={'source': 'scraped.txt'}), Document(page_content=\"user's intent with the text input.The recurrent layer interprets the words in the input text in sequence. It captures the relationship between words in a sentence.The attention mechanism enables a language model to focus on single parts of the input text that is relevant to the task at hand. This layer allows the model to generate the most accurate outputs.There are three main kinds of large language models:Generic or raw language models predict the next word based on the language in the training data. These language models perform information retrieval tasks.Instruction-tuned language models are trained to predict responses to the instructions given in the input. This allows them to perform sentiment analysis, or to generate text or code.Dialog-tuned language models are trained to have a dialog by predicting the next response. Think of chatbots or conversational AI.What is the difference between large language models and generative AI?Generative AI is an umbrella term that refers to artificial intelligence\", metadata={'source': 'scraped.txt'}), Document(page_content='to artificial intelligence models that have the capability to generate content. Generative AI can generate text, code, images, video, and music. Examples of generative AI include Midjourney, DALL-E, and ChatGPT.Large language models are a type of generative AI that are trained on text and produce textual content. ChatGPT is a popular example of generative text AI.All large language models are generative AI1.How do large language models work?A large language model is based on a transformer model and works by receiving an input, encoding it, and then decoding it to produce an output prediction. But before a large language model can receive text input and generate an output prediction, it requires training, so that it can fulfill general functions, and fine-tuning, which enables it to perform specific tasks.Training: Large language models are pre-trained using large textual datasets from sites like Wikipedia, GitHub, or others. These datasets consist of trillions of words, and their quality will affect the', metadata={'source': 'scraped.txt'}), Document(page_content='their quality will affect the language model\\'s performance. At this stage, the large language model engages in unsupervised learning, meaning it processes the datasets fed to it without specific instructions. During this process, the LLM\\'s AI algorithm can learn the meaning of words, and of the relationships between words. It also learns to distinguish words based on context. For example, it would learn to understand whether \"right\" means \"correct,\" or the opposite of \"left', metadata={'source': 'scraped.txt'})]\n"
213-
]
214-
}
215-
],
209+
"outputs": [],
216210
"source": [
217211
"chunks = createChunking(doc)"
218212
]
219213
},
220214
{
221215
"cell_type": "code",
222-
"execution_count": 13,
216+
"execution_count": null,
223217
"metadata": {},
224-
"outputs": [
225-
{
226-
"data": {
227-
"text/plain": [
228-
"[Document(page_content='Skip to main contentWhat is a large language model (LLM)?Explore popular open-source LLMsLarge language model definitionA large language model (LLM) is a deep learning algorithm that can perform a variety of natural language processing (NLP) tasks. Large language models use transformer models and are trained using massive datasets — hence, large. This enables them to recognize, translate, predict, or generate text or other content.Large language models are also referred to as neural networks (NNs), which are computing systems inspired by the human brain. These neural networks work using a network of nodes that are layered, much like neurons.In addition to teaching human languages to artificial intelligence (AI) applications, large language models can also be trained to perform a variety of tasks like understanding protein structures, writing software code, and more. Like the human brain, large language models must be pre-trained and then fine-tuned so that they can solve text classification, question', metadata={'source': 'scraped.txt'}),\n",
229-
" Document(page_content='text classification, question answering, document summarization, and text generation problems. Their problem-solving capabilities can be applied to fields like healthcare, finance, and entertainment where large language models serve a variety of NLP applications, such as translation, chatbots, AI assistants, and so on.Large language models also have large numbers of parameters, which are akin to memories the model collects as it learns from training. Think of these parameters as the model’s knowledge bank.So, what is a transformer model? A transformer model is the most common architecture of a large language model. It consists of an encoder and a decoder. A transformer model processes data by tokenizing the input, then simultaneously conducting mathematical equations to discover relationships between tokens. This enables the computer to see the patterns a human would see were it given the same query.Transformer models work with self-attention mechanisms, which enables the model to learn more quickly than', metadata={'source': 'scraped.txt'}),\n",
230-
" Document(page_content=\"to learn more quickly than traditional models like long short-term memory models. Self-attention is what enables the transformer model to consider different parts of the sequence, or the entire context of a sentence, to generate predictions.Related: Apply transformers to your search applicationsKey components of large language modelsLarge language models are composed of multiple neural network layers. Recurrent layers, feedforward layers, embedding layers, and attention layers work in tandem to process the input text and generate output content.The embedding layer creates embeddings from the input text. This part of the large language model captures the semantic and syntactic meaning of the input, so the model can understand context.The feedforward layer (FFN) of a large language model is made of up multiple fully connected layers that transform the input embeddings. In so doing, these layers enable the model to glean higher-level abstractions — that is, to understand the user's intent with the text\", metadata={'source': 'scraped.txt'}),\n",
231-
" Document(page_content=\"user's intent with the text input.The recurrent layer interprets the words in the input text in sequence. It captures the relationship between words in a sentence.The attention mechanism enables a language model to focus on single parts of the input text that is relevant to the task at hand. This layer allows the model to generate the most accurate outputs.There are three main kinds of large language models:Generic or raw language models predict the next word based on the language in the training data. These language models perform information retrieval tasks.Instruction-tuned language models are trained to predict responses to the instructions given in the input. This allows them to perform sentiment analysis, or to generate text or code.Dialog-tuned language models are trained to have a dialog by predicting the next response. Think of chatbots or conversational AI.What is the difference between large language models and generative AI?Generative AI is an umbrella term that refers to artificial intelligence\", metadata={'source': 'scraped.txt'}),\n",
232-
" Document(page_content='to artificial intelligence models that have the capability to generate content. Generative AI can generate text, code, images, video, and music. Examples of generative AI include Midjourney, DALL-E, and ChatGPT.Large language models are a type of generative AI that are trained on text and produce textual content. ChatGPT is a popular example of generative text AI.All large language models are generative AI1.How do large language models work?A large language model is based on a transformer model and works by receiving an input, encoding it, and then decoding it to produce an output prediction. But before a large language model can receive text input and generate an output prediction, it requires training, so that it can fulfill general functions, and fine-tuning, which enables it to perform specific tasks.Training: Large language models are pre-trained using large textual datasets from sites like Wikipedia, GitHub, or others. These datasets consist of trillions of words, and their quality will affect the', metadata={'source': 'scraped.txt'}),\n",
233-
" Document(page_content='their quality will affect the language model\\'s performance. At this stage, the large language model engages in unsupervised learning, meaning it processes the datasets fed to it without specific instructions. During this process, the LLM\\'s AI algorithm can learn the meaning of words, and of the relationships between words. It also learns to distinguish words based on context. For example, it would learn to understand whether \"right\" means \"correct,\" or the opposite of \"left', metadata={'source': 'scraped.txt'})]"
234-
]
235-
},
236-
"execution_count": 13,
237-
"metadata": {},
238-
"output_type": "execute_result"
239-
}
240-
],
218+
"outputs": [],
241219
"source": [
242220
"chunks"
243221
]
@@ -322,22 +300,9 @@
322300
},
323301
{
324302
"cell_type": "code",
325-
"execution_count": 20,
303+
"execution_count": null,
326304
"metadata": {},
327-
"outputs": [
328-
{
329-
"name": "stdout",
330-
"output_type": "stream",
331-
"text": [
332-
"Human: \n",
333-
"Answer the question based only on the following context:\n",
334-
"[(Document(page_content='Skip to main contentWhat is a large language model (LLM)?Explore popular open-source LLMsLarge language model definitionA large language model (LLM) is a deep learning algorithm that can perform a variety of natural language processing (NLP) tasks. Large language models use transformer models and are trained using massive datasets — hence, large. This enables them to recognize, translate, predict, or generate text or other content.Large language models are also referred to as neural networks (NNs), which are computing systems inspired by the human brain. These neural networks work using a network of nodes that are layered, much like neurons.In addition to teaching human languages to artificial intelligence (AI) applications, large language models can also be trained to perform a variety of tasks like understanding protein structures, writing software code, and more. Like the human brain, large language models must be pre-trained and then fine-tuned so that they can solve text classification, question', metadata={'source': 'scraped.txt'}), 0.8211523777245459), (Document(page_content='text classification, question answering, document summarization, and text generation problems. Their problem-solving capabilities can be applied to fields like healthcare, finance, and entertainment where large language models serve a variety of NLP applications, such as translation, chatbots, AI assistants, and so on.Large language models also have large numbers of parameters, which are akin to memories the model collects as it learns from training. Think of these parameters as the model’s knowledge bank.So, what is a transformer model? A transformer model is the most common architecture of a large language model. It consists of an encoder and a decoder. A transformer model processes data by tokenizing the input, then simultaneously conducting mathematical equations to discover relationships between tokens. This enables the computer to see the patterns a human would see were it given the same query.Transformer models work with self-attention mechanisms, which enables the model to learn more quickly than', metadata={'source': 'scraped.txt'}), 0.7714181820213781), (Document(page_content='to artificial intelligence models that have the capability to generate content. Generative AI can generate text, code, images, video, and music. Examples of generative AI include Midjourney, DALL-E, and ChatGPT.Large language models are a type of generative AI that are trained on text and produce textual content. ChatGPT is a popular example of generative text AI.All large language models are generative AI1.How do large language models work?A large language model is based on a transformer model and works by receiving an input, encoding it, and then decoding it to produce an output prediction. But before a large language model can receive text input and generate an output prediction, it requires training, so that it can fulfill general functions, and fine-tuning, which enables it to perform specific tasks.Training: Large language models are pre-trained using large textual datasets from sites like Wikipedia, GitHub, or others. These datasets consist of trillions of words, and their quality will affect the', metadata={'source': 'scraped.txt'}), 0.7623094323313777), (Document(page_content='their quality will affect the language model\\'s performance. At this stage, the large language model engages in unsupervised learning, meaning it processes the datasets fed to it without specific instructions. During this process, the LLM\\'s AI algorithm can learn the meaning of words, and of the relationships between words. It also learns to distinguish words based on context. For example, it would learn to understand whether \"right\" means \"correct,\" or the opposite of \"left', metadata={'source': 'scraped.txt'}), 0.7468296416864612), (Document(page_content=\"user's intent with the text input.The recurrent layer interprets the words in the input text in sequence. It captures the relationship between words in a sentence.The attention mechanism enables a language model to focus on single parts of the input text that is relevant to the task at hand. This layer allows the model to generate the most accurate outputs.There are three main kinds of large language models:Generic or raw language models predict the next word based on the language in the training data. These language models perform information retrieval tasks.Instruction-tuned language models are trained to predict responses to the instructions given in the input. This allows them to perform sentiment analysis, or to generate text or code.Dialog-tuned language models are trained to have a dialog by predicting the next response. Think of chatbots or conversational AI.What is the difference between large language models and generative AI?Generative AI is an umbrella term that refers to artificial intelligence\", metadata={'source': 'scraped.txt'}), 0.7287668130767889)]\n",
335-
"\n",
336-
"Answer the question based only on the above context: what is Large Language models\n",
337-
"\n"
338-
]
339-
}
340-
],
305+
"outputs": [],
341306
"source": [
342307
"print(prompt)"
343308
]

0 commit comments

Comments
 (0)