{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "view-in-github"
},
"source": [
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "-zE1h0uQV7uT"
},
"source": [
"# Install Packages and Setup Variables\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "QPJzr-I9XQ7l",
"outputId": "5d48c88b-a0a9-49ff-d788-e076d1cb4ead"
},
"outputs": [],
"source": [
"!pip install -q llama-index==0.10.57 openai==1.37.0 cohere==5.6.2 tiktoken==0.7.0 chromadb==0.5.5 html2text sentence_transformers pydantic llama-index-vector-stores-chroma==0.1.10 kaleido==0.2.1 llama-index-llms-gemini==0.1.11"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {
"id": "riuXwpSPcvWC"
},
"outputs": [],
"source": [
"import os\n",
"\n",
"# Set the following API Keys in the Python environment. Will be used later.\n",
"os.environ[\"OPENAI_API_KEY\"] = \"\"\n",
"os.environ[\"GOOGLE_API_KEY\"] = \"\""
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {
"id": "jIEeZzqLbz0J"
},
"outputs": [],
"source": [
"# Allows running asyncio in environments with an existing event loop, like Jupyter notebooks.\n",
"import nest_asyncio\n",
"\n",
"nest_asyncio.apply()"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "Bkgi2OrYzF7q"
},
"source": [
"# Load a Model\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "9oGT6crooSSj"
},
"outputs": [],
"source": [
"from llama_index.llms.gemini import Gemini\n",
"\n",
"llm = Gemini(model=\"models/gemini-1.5-flash\", temperature=1, max_tokens=512)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "0BwVuJXlzHVL"
},
"source": [
"# Create a VectoreStore\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "SQP87lHczHKc"
},
"outputs": [],
"source": [
"import chromadb\n",
"\n",
"# create client and a new collection\n",
"# chromadb.EphemeralClient saves data in-memory.\n",
"chroma_client = chromadb.PersistentClient(path=\"./mini-llama-articles\")\n",
"chroma_collection = chroma_client.create_collection(\"mini-llama-articles\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "zAaGcYMJzHAN"
},
"outputs": [],
"source": [
"from llama_index.vector_stores.chroma import ChromaVectorStore\n",
"\n",
"# Define a storage context object using the created vector database.\n",
"vector_store = ChromaVectorStore(chroma_collection=chroma_collection)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "I9JbAzFcjkpn"
},
"source": [
"# Load the Dataset (CSV)\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "ceveDuYdWCYk"
},
"source": [
"## Download\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "eZwf6pv7WFmD"
},
"source": [
"The dataset includes several articles from the TowardsAI blog, which provide an in-depth explanation of the LLaMA2 model. Read the dataset as a long string.\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "wl_pbPvMlv1h",
"outputId": "a453b612-20a8-4396-d22b-b19d2bc47816"
},
"outputs": [],
"source": [
"!curl -o ./mini-llama-articles.csv https://raw.githubusercontent.com/AlaFalaki/tutorial_notebooks/main/data/mini-llama-articles.csv"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "VWBLtDbUWJfA"
},
"source": [
"## Read File\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "0Q9sxuW0g3Gd",
"outputId": "49b27d8a-1f96-4e8d-fa0f-27afbf2c395c"
},
"outputs": [],
"source": [
"import csv\n",
"\n",
"rows = []\n",
"\n",
"# Load the file as a JSON\n",
"with open(\"./mini-llama-articles.csv\", mode=\"r\", encoding=\"utf-8\") as file:\n",
" csv_reader = csv.reader(file)\n",
"\n",
" for idx, row in enumerate(csv_reader):\n",
" if idx == 0:\n",
" continue\n",
" # Skip header row\n",
" rows.append(row)\n",
"\n",
"# The number of characters in the dataset.\n",
"len(rows)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "S17g2RYOjmf2"
},
"source": [
"# Convert to Document obj\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "YizvmXPejkJE"
},
"outputs": [],
"source": [
"from llama_index.core import Document\n",
"\n",
"# Convert the chunks to Document objects so the LlamaIndex framework can process them.\n",
"documents = [\n",
" Document(\n",
" text=row[1], metadata={\"title\": row[0], \"url\": row[2], \"source_name\": row[3]}\n",
" )\n",
" for row in rows\n",
"]\n",
"print(documents[0])"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "qjuLbmFuWsyl"
},
"source": [
"# Transforming\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "9z3t70DGWsjO"
},
"outputs": [],
"source": [
"from llama_index.core.text_splitter import TokenTextSplitter\n",
"\n",
"text_splitter = TokenTextSplitter(separator=\" \", chunk_size=512, chunk_overlap=128)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 331,
"referenced_widgets": [
"3fbabd8a8660461ba5e7bc08ef39139a",
"df2365556ae242a2ab1a119f9a31a561",
"5f4b9d32df8f446e858e4c289dc282f9",
"5b588f83a15d42d9aca888e06bbd95ff",
"ad073bca655540809e39f26538d2ec0d",
"13b9c5395bca4c3ba21265240cb936cf",
"47a4586384274577a726c57605e7f8d9",
"96a3bdece738481db57e811ccb74a974",
"5c7973afd79349ed997a69120d0629b2",
"af9b6ae927dd4764b9692507791bc67e",
"134210510d49476e959dd7d032bbdbdc",
"5f9bb065c2b74d2e8ded32e1306a7807",
"73a06bc546a64f7f99a9e4a135319dcd",
"ce48deaf4d8c49cdae92bfdbb3a78df0",
"4a172e8c6aa44e41a42fc1d9cf714fd0",
"0245f2604e4d49c8bd0210302746c47b",
"e956dfab55084a9cbe33c8e331b511e7",
"cb394578badd43a89850873ad2526542",
"193aef33d9184055bb9223f56d456de6",
"abfc9aa911ce4a5ea81c7c451f08295f",
"e7937a1bc68441a080374911a6563376",
"e532ed7bfef34f67b5fcacd9534eb789"
]
},
"id": "P9LDJ7o-Wsc-",
"outputId": "01070c1f-dffa-4ab7-ad71-b07b76b12e03"
},
"outputs": [],
"source": [
"from llama_index.core.extractors import (\n",
" SummaryExtractor,\n",
" QuestionsAnsweredExtractor,\n",
" KeywordExtractor,\n",
")\n",
"from llama_index.embeddings.openai import OpenAIEmbedding\n",
"from llama_index.core.ingestion import IngestionPipeline\n",
"\n",
"pipeline = IngestionPipeline(\n",
" transformations=[\n",
" text_splitter,\n",
" QuestionsAnsweredExtractor(questions=3, llm=llm),\n",
" SummaryExtractor(summaries=[\"prev\", \"self\"], llm=llm),\n",
" KeywordExtractor(keywords=10, llm=llm),\n",
" OpenAIEmbedding(model=\"text-embedding-3-small\", mode=\"text_search\"),\n",
" ],\n",
" vector_store=vector_store,\n",
")\n",
"\n",
"nodes = pipeline.run(documents=documents, show_progress=True)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "mPGa85hM2P3P",
"outputId": "c106c463-2459-4b11-bbae-5bd5e2246011"
},
"outputs": [],
"source": [
"len(nodes)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "23x20bL3_jRb"
},
"outputs": [],
"source": [
"!zip -r vectorstore.zip mini-llama-articles"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "OWaT6rL7ksp8"
},
"source": [
"# Load Indexes\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "SodY2Xpf_kxg",
"outputId": "9f8b7153-ea58-4824-8363-c47e922612a8"
},
"outputs": [],
"source": [
"# !unzip vectorstore.zip"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"id": "mXi56KTXk2sp"
},
"outputs": [],
"source": [
"import chromadb\n",
"from llama_index.vector_stores.chroma import ChromaVectorStore\n",
"\n",
"# Create your index\n",
"db = chromadb.PersistentClient(path=\"./mini-llama-articles\")\n",
"chroma_collection = db.get_or_create_collection(\"mini-llama-articles\")\n",
"vector_store = ChromaVectorStore(chroma_collection=chroma_collection)"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"id": "jKXURvLtkuTS"
},
"outputs": [],
"source": [
"# Create your index\n",
"from llama_index.core import VectorStoreIndex\n",
"\n",
"vector_index = VectorStoreIndex.from_vector_store(vector_store)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"from llama_index.embeddings.openai import OpenAIEmbedding\n",
"\n",
"llama_query_engine = vector_index.as_query_engine(\n",
" llm=llm,\n",
" similarity_top_k=3,\n",
" embed_model=OpenAIEmbedding(model=\"text-embedding-3-small\", mode=\"text_search\"),\n",
")"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"res = llama_query_engine.query(\"What is the LLama model?\")"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'The Llama model is an open-source language model developed by Meta that is designed for commercial use. It comes in different sizes ranging from 7 billion to 70 billion parameters and is known for its efficiency and potential in the market. The model incorporates features like Ghost Attention, which enhances conversational continuity, and a groundbreaking temporal capability that organizes information based on time relevance for more contextually accurate responses.'"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"res.response"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Node ID\t 5c465508-45c6-4ae0-ae61-9d8c1e38e35c\n",
"Title\t Meta's Llama 2: Revolutionizing Open Source Language Models for Commercial Use\n",
"Text\t with their larger size, outperform Llama 2, this is expected due to their capacity for handling complex language tasks. Llama 2's impressive ability to compete with larger models highlights its efficiency and potential in the market. However, Llama 2 does face challenges in coding and math problems, where models like Chat GPT 4 excel, given their significantly larger size. Chat GPT 4 performed significantly better than Llama 2 for coding (HumanEval benchmark)and math problem tasks (GSM8k benchmark). Open-source AI technologies, like Llama 2, continue to advance, offering strong competition to closed-source models. V. Ghost Attention: Enhancing Conversational Continuity One unique feature in Llama 2 is Ghost Attention, which ensures continuity in conversations. This means that even after multiple interactions, the model remembers its initial instructions, ensuring more coherent and consistent responses throughout the conversation. This feature significantly enhances the user experience and makes Llama 2 a more reliable language model for interactive applications. In the example below, on the left, it forgets to use an emoji after a few conversations. On the right, with Ghost Attention, even after having many conversations, it will remember the context and continue to use emojis in its response. VI. Temporal Capability: A Leap in Information Organization Meta reported a groundbreaking temporal capability, where the model organizes information based on time relevance. Each question posed to the model is associated with a date, and it responds accordingly by considering the event date before which the question becomes irrelevant. For example, if you ask the question, \"How long ago did Barack Obama become president?\", its only relevant after 2008. This temporal awareness allows Llama 2 to deliver more contextually accurate responses, enriching the user experience further. VII. Open Questions and Future Outlook Meta's open-sourcing of Llama 2 represents a seismic shift, now offering developers and researchers commercial access to a leading language model. With Llama 2 outperforming MosaicML's current MPT models, all eyes are on how Databricks will respond. Can MosaicML's next MPT iteration beat Llama 2? Is it worthwhile to compete\n",
"Score\t 0.38925315073161093\n",
"Metadata\t {'title': \"Meta's Llama 2: Revolutionizing Open Source Language Models for Commercial Use\", 'url': 'https://pub.towardsai.net/metas-llama-2-revolutionizing-open-source-language-models-for-commercial-use-1492bec112b#148f', 'source_name': 'towards_ai', 'questions_this_excerpt_can_answer': \"1. How does Llama 2's Ghost Attention feature enhance conversational continuity in language models, and how does it compare to other models in terms of maintaining context throughout interactions?\\n2. In what specific areas do larger language models like Chat GPT 4 outperform Llama 2, and how does Llama 2's efficiency and potential in the market compare to these larger models?\\n3. How does Llama 2's groundbreaking temporal capability, which organizes information based on time relevance, contribute to delivering more contextually accurate responses and enriching the user experience in interactive applications?\", 'prev_section_summary': \"The section discusses Meta's Llama 2 model, highlighting its exceptional performance in safety benchmarks compared to ChatGPT. It addresses the challenges of balancing helpfulness and safety in optimizing language models and the importance of finding the right equilibrium. The model employs two reward models for helpfulness and safety to optimize responses. Llama 2 outperforms competitors in most categories, including Chat GPT 3.5, despite facing challenges in coding and math problems compared to larger models like Chat GPT 4. The section emphasizes the efficiency and potential of Llama 2 in the market.\", 'section_summary': \"The section discusses Meta's Llama 2, an open-source language model that is revolutionizing commercial use. It compares Llama 2 to larger models like Chat GPT 4, highlighting Llama 2's efficiency and potential in the market. The Ghost Attention feature in Llama 2 enhances conversational continuity, while its groundbreaking temporal capability organizes information based on time relevance for more contextually accurate responses. The section also mentions Meta's open-sourcing of Llama 2 and the competition with MosaicML's MPT models.\", 'excerpt_keywords': 'Meta, Llama 2, language model, commercial use, Ghost Attention, conversational continuity, temporal capability, open-source, MosaicML, Databricks'}\n",
"-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_\n",
"Node ID\t 591cd83e-904d-4d43-80e7-7ee0da879e17\n",
"Title\t Meta's Llama 2: Revolutionizing Open Source Language Models for Commercial Use\n",
"Text\t I. Llama 2: Revolutionizing Commercial Use Unlike its predecessor Llama 1, which was limited to research use, Llama 2 represents a major advancement as an open-source commercial model. Businesses can now integrate Llama 2 into products to create AI-powered applications. Availability on Azure and AWS facilitates fine-tuning and adoption. However, restrictions apply to prevent exploitation. Companies with over 700 million active daily users cannot use Llama 2. Additionally, its output cannot be used to improve other language models. II. Llama 2 Model Flavors Llama 2 is available in four different model sizes: 7 billion, 13 billion, 34 billion, and 70 billion parameters. While 7B, 13B, and 70B have already been released, the 34B model is still awaited. The pretrained variant, trained on a whopping 2 trillion tokens, boasts a context window of 4096 tokens, twice the size of its predecessor Llama 1. Meta also released a Llama 2 fine-tuned model for chat applications that was trained on over 1 million human annotations. Such extensive training comes at a cost, with the 70B model taking a staggering 1720320 GPU hours to train. The context window's length determines the amount of content the model can process at once, making Llama 2 a powerful language model in terms of scale and efficiency. III. Safety Considerations: A Top Priority for Meta Meta's commitment to safety and alignment shines through in Llama 2's design. The model demonstrates exceptionally low AI safety violation percentages, surpassing even ChatGPT in safety benchmarks. Finding the right balance between helpfulness and safety when optimizing a model poses significant challenges. While a highly helpful model may be capable of answering any question, including sensitive ones like \"How do I build a bomb?\", it also raises concerns about potential misuse. Thus, striking the perfect equilibrium between providing useful information and ensuring safety is paramount. However, prioritizing safety to an extreme extent can lead to a model that struggles to effectively address a diverse range of questions. This limitation could hinder the model's practical applicability and user experience. Thus, achieving\n",
"Score\t 0.379941233087065\n",
"Metadata\t {'title': \"Meta's Llama 2: Revolutionizing Open Source Language Models for Commercial Use\", 'url': 'https://pub.towardsai.net/metas-llama-2-revolutionizing-open-source-language-models-for-commercial-use-1492bec112b#148f', 'source_name': 'towards_ai', 'questions_this_excerpt_can_answer': '1. What are the different model sizes available for Llama 2 and how do they differ in terms of parameters and training time?\\n2. How does Meta prioritize safety considerations in the design of Llama 2, and how does it compare to other language models like ChatGPT in terms of AI safety violation percentages?\\n3. What restrictions apply to the commercial use of Llama 2, and why are companies with over 700 million active daily users prohibited from using it?', 'prev_section_summary': \"The section discusses Meta AI's Code Llama and its performance on coding benchmarks like HumanEval and MBPP. Code Llama outperformed other open-source code-centric Large Language Models and even its predecessor, Llama 2. Code Llama 34B achieved impressive scores on both benchmarks, positioning it as a significant player in the code LLM space. The results highlight Code Llama's potential to contribute to the advancement of open-source foundation models in various domains.\", 'section_summary': \"The section discusses Meta's Llama 2, an open-source commercial language model that allows businesses to integrate AI-powered applications. It mentions the different model sizes available (7B, 13B, 34B, and 70B parameters) and their training times. Safety considerations in the design of Llama 2 are highlighted, with a focus on AI safety violation percentages compared to other models like ChatGPT. Restrictions on commercial use, such as companies with over 700 million daily users being prohibited, are also mentioned.\", 'excerpt_keywords': 'Meta, Llama 2, open-source, commercial, language model, AI safety, model sizes, training time, restrictions, safety considerations'}\n",
"-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_\n",
"Node ID\t 75696ac1-a024-48d1-9ecb-56fb617c4d27\n",
"Title\t Beyond GPT-4: What's New?\n",
"Text\t LLM Variants and Meta's Open Source Before shedding light on four major trends, I'd share the latest Meta's Llama 2 and Code Llama. Meta's Llama 2 represents a sophisticated evolution in LLMs. This suite spans models pretrained and fine-tuned across a parameter spectrum of 7 billion to 70 billion. A specialized derivative, Llama 2-Chat, has been engineered explicitly for dialogue-centric applications. Benchmarking revealed Llama 2's superior performance over most extant open-source chat models. Human-centric evaluations, focusing on safety and utility metrics, positioned Llama 2-Chat as a potential contender against proprietary, closed-source counterparts. The development trajectory of Llama 2 emphasized rigorous fine-tuning methodologies. Meta's transparent delineation of these processes aims to catalyze community-driven advancements in LLMs, underscoring a commitment to collaborative and responsible AI development. Code Llama is built on top of Llama 2 and is available in three models: Code Llama, the foundational code model;Codel Llama - Python specialized for Python;and Code Llama - Instruct, which is fine-tuned for understanding natural language instructions. Based on its benchmark testing, Code Llama outperformed state-of-the-art publicly available LLMs (except GPT-4) on code tasks. Llama 2, Llama 2-Chat, and Code Llama are key steps in LLM development but still have a way to go compared to GPT-4. Meta's open access and commitment to improving these models promise transparent and faster LLM progress in the future. Please refer to the LLM and Llama variants below: From LLMs to Multimodal LLMs, like OpenAI's ChatGPT (GPT-3.5), primarily focus on understanding and generating human language. They've been instrumental in tasks like text generation, translation, and even creative writing. However, their scope is limited to text. Enter multimodal models like GPT-4. These are a new breed of AI models that can understand and generate not just text, but also images, sounds, and potentially other types of data. The term \"multimodal\" refers to their ability to process multiple modes or\n",
"Score\t 0.37789586760841654\n",
"Metadata\t {'title': \"Beyond GPT-4: What's New?\", 'url': 'https://pub.towardsai.net/beyond-gpt-4-whats-new-cbd61a448eb9#dda8', 'source_name': 'towards_ai', 'questions_this_excerpt_can_answer': \"1. How does Meta's Llama 2 compare to other open-source chat models in terms of performance and utility metrics?\\n2. What are the different models available in Code Llama and how do they outperform other publicly available LLMs on code tasks?\\n3. How do multimodal LLMs like GPT-4 differ from traditional LLMs in terms of their ability to process various types of data beyond text?\", 'section_summary': \"The section discusses Meta's Llama 2 and Code Llama, which are advanced language models that outperform other open-source chat models and LLMs on code tasks. It highlights the performance and utility metrics of Llama 2-Chat and Code Llama, emphasizing their potential in dialogue-centric applications and natural language instruction understanding. The section also introduces multimodal LLMs like GPT-4, which can process various types of data beyond text, such as images and sounds. It mentions Meta's commitment to transparent and collaborative AI development, aiming to accelerate progress in LLMs.\", 'excerpt_keywords': 'Meta, Llama 2, Code Llama, language models, open-source, chat models, GPT-4, multimodal, AI development, natural language understanding'}\n",
"-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_\n"
]
}
],
"source": [
"for src in res.source_nodes:\n",
" print(\"Node ID\\t\", src.node_id)\n",
" print(\"Title\\t\", src.metadata[\"title\"])\n",
" print(\"Text\\t\", src.text)\n",
" print(\"Score\\t\", src.score)\n",
" print(\"Metadata\\t\", src.metadata)\n",
" print(\"-_\" * 20)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Router\n",
"\n",
"Routers are modules that take in a user query and a set of “choices” (defined by metadata), and returns one or more selected choices.\n",
"\n",
"They can be used for the following use cases and more:\n",
"\n",
"- Selecting the right data source among a diverse range of data sources\n",
"\n",
"- Deciding whether to do summarization (e.g. using summary index query engine) or semantic search (e.g. using vector index query engine)\n",
"\n",
"- Deciding whether to “try” out a bunch of choices at once and combine the results (using multi-routing capabilities).\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Lets create a different query engine with Mistral AI information\n"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
"from pathlib import Path\n",
"import requests\n",
"\n",
"wiki_titles = [\n",
" \"Mistral AI\",\n",
"]\n",
"\n",
"data_path = Path(\"data_wiki\")\n",
"\n",
"for title in wiki_titles:\n",
" response = requests.get(\n",
" \"https://en.wikipedia.org/w/api.php\",\n",
" params={\n",
" \"action\": \"query\",\n",
" \"format\": \"json\",\n",
" \"titles\": title,\n",
" \"prop\": \"extracts\",\n",
" \"explaintext\": True,\n",
" },\n",
" ).json()\n",
" page = next(iter(response[\"query\"][\"pages\"].values()))\n",
" wiki_text = page[\"extract\"]\n",
"\n",
" if not data_path.exists():\n",
" Path.mkdir(data_path)\n",
"\n",
" with open(data_path / f\"mistral_ai.txt\", \"w\") as fp:\n",
" fp.write(wiki_text)"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [],
"source": [
"from llama_index.core import VectorStoreIndex, SimpleDirectoryReader\n",
"\n",
"documents = SimpleDirectoryReader(\"data_wiki\").load_data()"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [],
"source": [
"from llama_index.core.text_splitter import TokenTextSplitter\n",
"\n",
"text_splitter = TokenTextSplitter(separator=\" \", chunk_size=512, chunk_overlap=128)"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"100%|██████████| 3/3 [00:02<00:00, 1.12it/s]\n",
"100%|██████████| 3/3 [00:03<00:00, 1.01s/it]\n",
"100%|██████████| 3/3 [00:01<00:00, 2.72it/s]\n"
]
}
],
"source": [
"from llama_index.core.extractors import (\n",
" SummaryExtractor,\n",
" QuestionsAnsweredExtractor,\n",
" KeywordExtractor,\n",
")\n",
"from llama_index.embeddings.openai import OpenAIEmbedding\n",
"from llama_index.core.ingestion import IngestionPipeline\n",
"\n",
"transformations = [\n",
" text_splitter,\n",
" QuestionsAnsweredExtractor(questions=3, llm=llm),\n",
" SummaryExtractor(summaries=[\"prev\", \"self\"], llm=llm),\n",
" KeywordExtractor(keywords=10, llm=llm),\n",
" OpenAIEmbedding(model=\"text-embedding-3-small\", mode=\"text_search\"),\n",
"]\n",
"\n",
"mistral_index = VectorStoreIndex.from_documents(\n",
" documents=documents, llm=llm, transformations=transformations\n",
")"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [],
"source": [
"mistral_query = mistral_index.as_query_engine(\n",
" llm=llm,\n",
" similarity_top_k=2,\n",
" embed_model=OpenAIEmbedding(model=\"text-embedding-3-small\", mode=\"text_search\"),\n",
")"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Response(response='The Llama model is an open-source language model developed by Meta that is designed for commercial use. It comes in different sizes with varying parameters, such as 7 billion, 13 billion, 34 billion, and 70 billion parameters. The model is known for its efficiency and potential in the market, as well as its unique features like Ghost Attention for enhancing conversational continuity and a groundbreaking temporal capability for organizing information based on time relevance. The model prioritizes safety considerations in its design and aims to strike a balance between providing useful information and ensuring safety in its responses.', source_nodes=[NodeWithScore(node=TextNode(id_='5c465508-45c6-4ae0-ae61-9d8c1e38e35c', embedding=None, metadata={'title': \"Meta's Llama 2: Revolutionizing Open Source Language Models for Commercial Use\", 'url': 'https://pub.towardsai.net/metas-llama-2-revolutionizing-open-source-language-models-for-commercial-use-1492bec112b#148f', 'source_name': 'towards_ai', 'questions_this_excerpt_can_answer': \"1. How does Llama 2's Ghost Attention feature enhance conversational continuity in language models, and how does it compare to other models in terms of maintaining context throughout interactions?\\n2. In what specific areas do larger language models like Chat GPT 4 outperform Llama 2, and how does Llama 2's efficiency and potential in the market compare to these larger models?\\n3. How does Llama 2's groundbreaking temporal capability, which organizes information based on time relevance, contribute to delivering more contextually accurate responses and enriching the user experience in interactive applications?\", 'prev_section_summary': \"The section discusses Meta's Llama 2 model, highlighting its exceptional performance in safety benchmarks compared to ChatGPT. It addresses the challenges of balancing helpfulness and safety in optimizing language models and the importance of finding the right equilibrium. The model employs two reward models for helpfulness and safety to optimize responses. Llama 2 outperforms competitors in most categories, including Chat GPT 3.5, despite facing challenges in coding and math problems compared to larger models like Chat GPT 4. The section emphasizes the efficiency and potential of Llama 2 in the market.\", 'section_summary': \"The section discusses Meta's Llama 2, an open-source language model that is revolutionizing commercial use. It compares Llama 2 to larger models like Chat GPT 4, highlighting Llama 2's efficiency and potential in the market. The Ghost Attention feature in Llama 2 enhances conversational continuity, while its groundbreaking temporal capability organizes information based on time relevance for more contextually accurate responses. The section also mentions Meta's open-sourcing of Llama 2 and the competition with MosaicML's MPT models.\", 'excerpt_keywords': 'Meta, Llama 2, language model, commercial use, Ghost Attention, conversational continuity, temporal capability, open-source, MosaicML, Databricks'}, excluded_embed_metadata_keys=[], excluded_llm_metadata_keys=[], relationships={: RelatedNodeInfo(node_id='9415c7fb-980e-4b05-8a01-598fdb670d51', node_type=, metadata={'title': \"Meta's Llama 2: Revolutionizing Open Source Language Models for Commercial Use\", 'url': 'https://pub.towardsai.net/metas-llama-2-revolutionizing-open-source-language-models-for-commercial-use-1492bec112b#148f', 'source_name': 'towards_ai'}, hash='e6ccf4a15b6004889bce6ebb32f629bb1cc23e749e19e42315b4fbef80d6f7f7'), : RelatedNodeInfo(node_id='48993d8b-597f-4f3c-95f9-88aa9ac4937a', node_type=, metadata={'title': \"Meta's Llama 2: Revolutionizing Open Source Language Models for Commercial Use\", 'url': 'https://pub.towardsai.net/metas-llama-2-revolutionizing-open-source-language-models-for-commercial-use-1492bec112b#148f', 'source_name': 'towards_ai'}, hash='21016e46f48473e7eb78a251049f3b0d50ad4386c11afc44ca52f78e51f6b63b'), : RelatedNodeInfo(node_id='a5463b16-54d8-44fc-8eab-d68c000d801d', node_type=, metadata={}, hash='4983f7ecac4388385d62632d85de3372e3e01072fb3a76c8494d08e00ea131d4')}, text='with their larger size, outperform Llama 2, this is expected due to their capacity for handling complex language tasks. Llama 2\\'s impressive ability to compete with larger models highlights its efficiency and potential in the market. However, Llama 2 does face challenges in coding and math problems, where models like Chat GPT 4 excel, given their significantly larger size. Chat GPT 4 performed significantly better than Llama 2 for coding (HumanEval benchmark)and math problem tasks (GSM8k benchmark). Open-source AI technologies, like Llama 2, continue to advance, offering strong competition to closed-source models. V. Ghost Attention: Enhancing Conversational Continuity One unique feature in Llama 2 is Ghost Attention, which ensures continuity in conversations. This means that even after multiple interactions, the model remembers its initial instructions, ensuring more coherent and consistent responses throughout the conversation. This feature significantly enhances the user experience and makes Llama 2 a more reliable language model for interactive applications. In the example below, on the left, it forgets to use an emoji after a few conversations. On the right, with Ghost Attention, even after having many conversations, it will remember the context and continue to use emojis in its response. VI. Temporal Capability: A Leap in Information Organization Meta reported a groundbreaking temporal capability, where the model organizes information based on time relevance. Each question posed to the model is associated with a date, and it responds accordingly by considering the event date before which the question becomes irrelevant. For example, if you ask the question, \"How long ago did Barack Obama become president?\", its only relevant after 2008. This temporal awareness allows Llama 2 to deliver more contextually accurate responses, enriching the user experience further. VII. Open Questions and Future Outlook Meta\\'s open-sourcing of Llama 2 represents a seismic shift, now offering developers and researchers commercial access to a leading language model. With Llama 2 outperforming MosaicML\\'s current MPT models, all eyes are on how Databricks will respond. Can MosaicML\\'s next MPT iteration beat Llama 2? Is it worthwhile to compete', start_char_idx=3098, end_char_idx=5365, text_template='[Excerpt from document]\\n{metadata_str}\\nExcerpt:\\n-----\\n{content}\\n-----\\n', metadata_template='{key}: {value}', metadata_seperator='\\n'), score=0.38935121175730436), NodeWithScore(node=TextNode(id_='591cd83e-904d-4d43-80e7-7ee0da879e17', embedding=None, metadata={'title': \"Meta's Llama 2: Revolutionizing Open Source Language Models for Commercial Use\", 'url': 'https://pub.towardsai.net/metas-llama-2-revolutionizing-open-source-language-models-for-commercial-use-1492bec112b#148f', 'source_name': 'towards_ai', 'questions_this_excerpt_can_answer': '1. What are the different model sizes available for Llama 2 and how do they differ in terms of parameters and training time?\\n2. How does Meta prioritize safety considerations in the design of Llama 2, and how does it compare to other language models like ChatGPT in terms of AI safety violation percentages?\\n3. What restrictions apply to the commercial use of Llama 2, and why are companies with over 700 million active daily users prohibited from using it?', 'prev_section_summary': \"The section discusses Meta AI's Code Llama and its performance on coding benchmarks like HumanEval and MBPP. Code Llama outperformed other open-source code-centric Large Language Models and even its predecessor, Llama 2. Code Llama 34B achieved impressive scores on both benchmarks, positioning it as a significant player in the code LLM space. The results highlight Code Llama's potential to contribute to the advancement of open-source foundation models in various domains.\", 'section_summary': \"The section discusses Meta's Llama 2, an open-source commercial language model that allows businesses to integrate AI-powered applications. It mentions the different model sizes available (7B, 13B, 34B, and 70B parameters) and their training times. Safety considerations in the design of Llama 2 are highlighted, with a focus on AI safety violation percentages compared to other models like ChatGPT. Restrictions on commercial use, such as companies with over 700 million daily users being prohibited, are also mentioned.\", 'excerpt_keywords': 'Meta, Llama 2, open-source, commercial, language model, AI safety, model sizes, training time, restrictions, safety considerations'}, excluded_embed_metadata_keys=[], excluded_llm_metadata_keys=[], relationships={: RelatedNodeInfo(node_id='9415c7fb-980e-4b05-8a01-598fdb670d51', node_type=, metadata={'title': \"Meta's Llama 2: Revolutionizing Open Source Language Models for Commercial Use\", 'url': 'https://pub.towardsai.net/metas-llama-2-revolutionizing-open-source-language-models-for-commercial-use-1492bec112b#148f', 'source_name': 'towards_ai'}, hash='e6ccf4a15b6004889bce6ebb32f629bb1cc23e749e19e42315b4fbef80d6f7f7'), : RelatedNodeInfo(node_id='e24ae919-6841-4d2a-9de8-fa1f21fccdb0', node_type=, metadata={'title': \"Inside Code Llama: Meta AI's Entrance in the Code LLM Space\", 'url': 'https://pub.towardsai.net/inside-code-llama-meta-ais-entrance-in-the-code-llm-space-9f286d13a48d#c9e0', 'source_name': 'towards_ai'}, hash='c917e7c1d461cfd5a352ef113b861068a94ecfb5e8bbafa87ba18a62ddac78fc'), : RelatedNodeInfo(node_id='48993d8b-597f-4f3c-95f9-88aa9ac4937a', node_type=, metadata={}, hash='b2de317911947f177025ac692d38505bcd2e21efce0c47b8aba035a118592329')}, text='I. Llama 2: Revolutionizing Commercial Use Unlike its predecessor Llama 1, which was limited to research use, Llama 2 represents a major advancement as an open-source commercial model. Businesses can now integrate Llama 2 into products to create AI-powered applications. Availability on Azure and AWS facilitates fine-tuning and adoption. However, restrictions apply to prevent exploitation. Companies with over 700 million active daily users cannot use Llama 2. Additionally, its output cannot be used to improve other language models. II. Llama 2 Model Flavors Llama 2 is available in four different model sizes: 7 billion, 13 billion, 34 billion, and 70 billion parameters. While 7B, 13B, and 70B have already been released, the 34B model is still awaited. The pretrained variant, trained on a whopping 2 trillion tokens, boasts a context window of 4096 tokens, twice the size of its predecessor Llama 1. Meta also released a Llama 2 fine-tuned model for chat applications that was trained on over 1 million human annotations. Such extensive training comes at a cost, with the 70B model taking a staggering 1720320 GPU hours to train. The context window\\'s length determines the amount of content the model can process at once, making Llama 2 a powerful language model in terms of scale and efficiency. III. Safety Considerations: A Top Priority for Meta Meta\\'s commitment to safety and alignment shines through in Llama 2\\'s design. The model demonstrates exceptionally low AI safety violation percentages, surpassing even ChatGPT in safety benchmarks. Finding the right balance between helpfulness and safety when optimizing a model poses significant challenges. While a highly helpful model may be capable of answering any question, including sensitive ones like \"How do I build a bomb?\", it also raises concerns about potential misuse. Thus, striking the perfect equilibrium between providing useful information and ensuring safety is paramount. However, prioritizing safety to an extreme extent can lead to a model that struggles to effectively address a diverse range of questions. This limitation could hinder the model\\'s practical applicability and user experience. Thus, achieving', start_char_idx=0, end_char_idx=2192, text_template='[Excerpt from document]\\n{metadata_str}\\nExcerpt:\\n-----\\n{content}\\n-----\\n', metadata_template='{key}: {value}', metadata_seperator='\\n'), score=0.3847929535269605), NodeWithScore(node=TextNode(id_='48993d8b-597f-4f3c-95f9-88aa9ac4937a', embedding=None, metadata={'title': \"Meta's Llama 2: Revolutionizing Open Source Language Models for Commercial Use\", 'url': 'https://pub.towardsai.net/metas-llama-2-revolutionizing-open-source-language-models-for-commercial-use-1492bec112b#148f', 'source_name': 'towards_ai', 'questions_this_excerpt_can_answer': \"1. How does Meta's Llama 2 model compare to other open-source language models in terms of safety benchmarks and helpfulness optimization?\\n2. What challenges does Meta's Llama 2 face in coding and math problem tasks compared to larger models like Chat GPT 4?\\n3. How does Meta strike a balance between providing useful information and ensuring safety in the optimization of their language model responses?\", 'prev_section_summary': \"The section discusses Meta's Llama 2, an open-source commercial language model that allows businesses to integrate AI-powered applications. It mentions the different model sizes available (7B, 13B, 34B, and 70B parameters) and their training times. Safety considerations in the design of Llama 2 are highlighted, with a focus on AI safety violation percentages compared to other models like ChatGPT. Restrictions on commercial use, such as companies with over 700 million daily users being prohibited, are also mentioned.\", 'section_summary': \"The section discusses Meta's Llama 2 model, highlighting its exceptional performance in safety benchmarks compared to ChatGPT. It addresses the challenges of balancing helpfulness and safety in optimizing language models and the importance of finding the right equilibrium. The model employs two reward models for helpfulness and safety to optimize responses. Llama 2 outperforms competitors in most categories, including Chat GPT 3.5, despite facing challenges in coding and math problems compared to larger models like Chat GPT 4. The section emphasizes the efficiency and potential of Llama 2 in the market.\", 'excerpt_keywords': \"Meta's Llama 2, open-source, language model, safety benchmarks, helpfulness optimization, AI safety, balance, reward models, commercial use, efficiency, market potential\"}, excluded_embed_metadata_keys=[], excluded_llm_metadata_keys=[], relationships={: RelatedNodeInfo(node_id='9415c7fb-980e-4b05-8a01-598fdb670d51', node_type=, metadata={'title': \"Meta's Llama 2: Revolutionizing Open Source Language Models for Commercial Use\", 'url': 'https://pub.towardsai.net/metas-llama-2-revolutionizing-open-source-language-models-for-commercial-use-1492bec112b#148f', 'source_name': 'towards_ai'}, hash='e6ccf4a15b6004889bce6ebb32f629bb1cc23e749e19e42315b4fbef80d6f7f7'), : RelatedNodeInfo(node_id='591cd83e-904d-4d43-80e7-7ee0da879e17', node_type=, metadata={'title': \"Meta's Llama 2: Revolutionizing Open Source Language Models for Commercial Use\", 'url': 'https://pub.towardsai.net/metas-llama-2-revolutionizing-open-source-language-models-for-commercial-use-1492bec112b#148f', 'source_name': 'towards_ai'}, hash='ef6b0c87b8bf3ddbefecf4435183fab26cf29d639026c121ad7c0583174d9fd1'), : RelatedNodeInfo(node_id='5c465508-45c6-4ae0-ae61-9d8c1e38e35c', node_type=, metadata={}, hash='627450b75c4c166114c350eced1d49c353c30395937e58874f9a9d685075d79b')}, text='The model demonstrates exceptionally low AI safety violation percentages, surpassing even ChatGPT in safety benchmarks. Finding the right balance between helpfulness and safety when optimizing a model poses significant challenges. While a highly helpful model may be capable of answering any question, including sensitive ones like \"How do I build a bomb?\", it also raises concerns about potential misuse. Thus, striking the perfect equilibrium between providing useful information and ensuring safety is paramount. However, prioritizing safety to an extreme extent can lead to a model that struggles to effectively address a diverse range of questions. This limitation could hinder the model\\'s practical applicability and user experience. Thus, achieving an optimum balance that allows the model to be both helpful and safe is of utmost importance. To strike the right balance between helpfulness and safety, Meta employed two reward models - one for helpfulness and another for safety - to optimize the model\\'s responses. The 34B parameter model has reported higher safety violations than other variants, possibly contributing to the delay in its release. IV. Helpfulness Comparison: Llama 2 Outperforms Competitors Llama 2 emerges as a strong contender in the open-source language model arena, outperforming its competitors in most categories. The 70B parameter model outperforms all other open-source models, while the 7B and 34B models outshine Falcon in all categories and MPT in all categories except coding. Despite being smaller, Llam a2\\'s performance rivals that of Chat GPT 3.5, a significantly larger closed-source model. While GPT 4 and PalM-2-L, with their larger size, outperform Llama 2, this is expected due to their capacity for handling complex language tasks. Llama 2\\'s impressive ability to compete with larger models highlights its efficiency and potential in the market. However, Llama 2 does face challenges in coding and math problems, where models like Chat GPT 4 excel, given their significantly larger size. Chat GPT 4 performed significantly better than Llama 2 for coding (HumanEval benchmark)and math problem tasks (GSM8k benchmark). Open-source AI technologies, like Llama 2, continue to advance, offering', start_char_idx=1437, end_char_idx=3675, text_template='[Excerpt from document]\\n{metadata_str}\\nExcerpt:\\n-----\\n{content}\\n-----\\n', metadata_template='{key}: {value}', metadata_seperator='\\n'), score=0.3793881839893325)], metadata={'5c465508-45c6-4ae0-ae61-9d8c1e38e35c': {'title': \"Meta's Llama 2: Revolutionizing Open Source Language Models for Commercial Use\", 'url': 'https://pub.towardsai.net/metas-llama-2-revolutionizing-open-source-language-models-for-commercial-use-1492bec112b#148f', 'source_name': 'towards_ai', 'questions_this_excerpt_can_answer': \"1. How does Llama 2's Ghost Attention feature enhance conversational continuity in language models, and how does it compare to other models in terms of maintaining context throughout interactions?\\n2. In what specific areas do larger language models like Chat GPT 4 outperform Llama 2, and how does Llama 2's efficiency and potential in the market compare to these larger models?\\n3. How does Llama 2's groundbreaking temporal capability, which organizes information based on time relevance, contribute to delivering more contextually accurate responses and enriching the user experience in interactive applications?\", 'prev_section_summary': \"The section discusses Meta's Llama 2 model, highlighting its exceptional performance in safety benchmarks compared to ChatGPT. It addresses the challenges of balancing helpfulness and safety in optimizing language models and the importance of finding the right equilibrium. The model employs two reward models for helpfulness and safety to optimize responses. Llama 2 outperforms competitors in most categories, including Chat GPT 3.5, despite facing challenges in coding and math problems compared to larger models like Chat GPT 4. The section emphasizes the efficiency and potential of Llama 2 in the market.\", 'section_summary': \"The section discusses Meta's Llama 2, an open-source language model that is revolutionizing commercial use. It compares Llama 2 to larger models like Chat GPT 4, highlighting Llama 2's efficiency and potential in the market. The Ghost Attention feature in Llama 2 enhances conversational continuity, while its groundbreaking temporal capability organizes information based on time relevance for more contextually accurate responses. The section also mentions Meta's open-sourcing of Llama 2 and the competition with MosaicML's MPT models.\", 'excerpt_keywords': 'Meta, Llama 2, language model, commercial use, Ghost Attention, conversational continuity, temporal capability, open-source, MosaicML, Databricks'}, '591cd83e-904d-4d43-80e7-7ee0da879e17': {'title': \"Meta's Llama 2: Revolutionizing Open Source Language Models for Commercial Use\", 'url': 'https://pub.towardsai.net/metas-llama-2-revolutionizing-open-source-language-models-for-commercial-use-1492bec112b#148f', 'source_name': 'towards_ai', 'questions_this_excerpt_can_answer': '1. What are the different model sizes available for Llama 2 and how do they differ in terms of parameters and training time?\\n2. How does Meta prioritize safety considerations in the design of Llama 2, and how does it compare to other language models like ChatGPT in terms of AI safety violation percentages?\\n3. What restrictions apply to the commercial use of Llama 2, and why are companies with over 700 million active daily users prohibited from using it?', 'prev_section_summary': \"The section discusses Meta AI's Code Llama and its performance on coding benchmarks like HumanEval and MBPP. Code Llama outperformed other open-source code-centric Large Language Models and even its predecessor, Llama 2. Code Llama 34B achieved impressive scores on both benchmarks, positioning it as a significant player in the code LLM space. The results highlight Code Llama's potential to contribute to the advancement of open-source foundation models in various domains.\", 'section_summary': \"The section discusses Meta's Llama 2, an open-source commercial language model that allows businesses to integrate AI-powered applications. It mentions the different model sizes available (7B, 13B, 34B, and 70B parameters) and their training times. Safety considerations in the design of Llama 2 are highlighted, with a focus on AI safety violation percentages compared to other models like ChatGPT. Restrictions on commercial use, such as companies with over 700 million daily users being prohibited, are also mentioned.\", 'excerpt_keywords': 'Meta, Llama 2, open-source, commercial, language model, AI safety, model sizes, training time, restrictions, safety considerations'}, '48993d8b-597f-4f3c-95f9-88aa9ac4937a': {'title': \"Meta's Llama 2: Revolutionizing Open Source Language Models for Commercial Use\", 'url': 'https://pub.towardsai.net/metas-llama-2-revolutionizing-open-source-language-models-for-commercial-use-1492bec112b#148f', 'source_name': 'towards_ai', 'questions_this_excerpt_can_answer': \"1. How does Meta's Llama 2 model compare to other open-source language models in terms of safety benchmarks and helpfulness optimization?\\n2. What challenges does Meta's Llama 2 face in coding and math problem tasks compared to larger models like Chat GPT 4?\\n3. How does Meta strike a balance between providing useful information and ensuring safety in the optimization of their language model responses?\", 'prev_section_summary': \"The section discusses Meta's Llama 2, an open-source commercial language model that allows businesses to integrate AI-powered applications. It mentions the different model sizes available (7B, 13B, 34B, and 70B parameters) and their training times. Safety considerations in the design of Llama 2 are highlighted, with a focus on AI safety violation percentages compared to other models like ChatGPT. Restrictions on commercial use, such as companies with over 700 million daily users being prohibited, are also mentioned.\", 'section_summary': \"The section discusses Meta's Llama 2 model, highlighting its exceptional performance in safety benchmarks compared to ChatGPT. It addresses the challenges of balancing helpfulness and safety in optimizing language models and the importance of finding the right equilibrium. The model employs two reward models for helpfulness and safety to optimize responses. Llama 2 outperforms competitors in most categories, including Chat GPT 3.5, despite facing challenges in coding and math problems compared to larger models like Chat GPT 4. The section emphasizes the efficiency and potential of Llama 2 in the market.\", 'excerpt_keywords': \"Meta's Llama 2, open-source, language model, safety benchmarks, helpfulness optimization, AI safety, balance, reward models, commercial use, efficiency, market potential\"}, 'selector_result': MultiSelection(selections=[SingleSelection(index=0, reason='The LLama LLM is specifically mentioned in choice (1), indicating its relevance to questions about the LLama model.')])})"
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from llama_index.core.query_engine import RouterQueryEngine\n",
"from llama_index.core.selectors import PydanticSingleSelector\n",
"from llama_index.core.tools import QueryEngineTool\n",
"from llama_index.core import VectorStoreIndex, SummaryIndex\n",
"\n",
"# initialize tools\n",
"llama_tool = QueryEngineTool.from_defaults(\n",
" query_engine=llama_query_engine,\n",
" description=\"Useful for questions about the LLama LLM create by Meta\",\n",
")\n",
"mistral_tool = QueryEngineTool.from_defaults(\n",
" query_engine=mistral_query,\n",
" description=\"Useful for questions about the Mistral LLM create by Mistral AI\",\n",
")\n",
"\n",
"# initialize router query engine (single selection, pydantic)\n",
"query_engine = RouterQueryEngine(\n",
" selector=PydanticSingleSelector.from_defaults(),\n",
" query_engine_tools=[\n",
" llama_tool,\n",
" mistral_tool,\n",
" ],\n",
")"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'The LLama model is an open-source language model developed by Meta that is designed for commercial use. It comes in different model sizes, ranging from 7 billion to 70 billion parameters, each with varying training times. The model prioritizes safety considerations in its design, aiming to strike a balance between providing helpful information and ensuring safety in responses. LLama 2 features unique capabilities such as Ghost Attention, which enhances conversational continuity, and a groundbreaking temporal capability that organizes information based on time relevance for more contextually accurate responses.'"
]
},
"execution_count": 19,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"res = query_engine.query(\n",
" \"what is the LLama model?\",\n",
")\n",
"res.response"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Node ID\t 5c465508-45c6-4ae0-ae61-9d8c1e38e35c\n",
"Title\t Meta's Llama 2: Revolutionizing Open Source Language Models for Commercial Use\n",
"Text\t with their larger size, outperform Llama 2, this is expected due to their capacity for handling complex language tasks. Llama 2's impressive ability to compete with larger models highlights its efficiency and potential in the market. However, Llama 2 does face challenges in coding and math problems, where models like Chat GPT 4 excel, given their significantly larger size. Chat GPT 4 performed significantly better than Llama 2 for coding (HumanEval benchmark)and math problem tasks (GSM8k benchmark). Open-source AI technologies, like Llama 2, continue to advance, offering strong competition to closed-source models. V. Ghost Attention: Enhancing Conversational Continuity One unique feature in Llama 2 is Ghost Attention, which ensures continuity in conversations. This means that even after multiple interactions, the model remembers its initial instructions, ensuring more coherent and consistent responses throughout the conversation. This feature significantly enhances the user experience and makes Llama 2 a more reliable language model for interactive applications. In the example below, on the left, it forgets to use an emoji after a few conversations. On the right, with Ghost Attention, even after having many conversations, it will remember the context and continue to use emojis in its response. VI. Temporal Capability: A Leap in Information Organization Meta reported a groundbreaking temporal capability, where the model organizes information based on time relevance. Each question posed to the model is associated with a date, and it responds accordingly by considering the event date before which the question becomes irrelevant. For example, if you ask the question, \"How long ago did Barack Obama become president?\", its only relevant after 2008. This temporal awareness allows Llama 2 to deliver more contextually accurate responses, enriching the user experience further. VII. Open Questions and Future Outlook Meta's open-sourcing of Llama 2 represents a seismic shift, now offering developers and researchers commercial access to a leading language model. With Llama 2 outperforming MosaicML's current MPT models, all eyes are on how Databricks will respond. Can MosaicML's next MPT iteration beat Llama 2? Is it worthwhile to compete\n",
"Score\t 0.3892941031727631\n",
"Metadata\t {'title': \"Meta's Llama 2: Revolutionizing Open Source Language Models for Commercial Use\", 'url': 'https://pub.towardsai.net/metas-llama-2-revolutionizing-open-source-language-models-for-commercial-use-1492bec112b#148f', 'source_name': 'towards_ai', 'questions_this_excerpt_can_answer': \"1. How does Llama 2's Ghost Attention feature enhance conversational continuity in language models, and how does it compare to other models in terms of maintaining context throughout interactions?\\n2. In what specific areas do larger language models like Chat GPT 4 outperform Llama 2, and how does Llama 2's efficiency and potential in the market compare to these larger models?\\n3. How does Llama 2's groundbreaking temporal capability, which organizes information based on time relevance, contribute to delivering more contextually accurate responses and enriching the user experience in interactive applications?\", 'prev_section_summary': \"The section discusses Meta's Llama 2 model, highlighting its exceptional performance in safety benchmarks compared to ChatGPT. It addresses the challenges of balancing helpfulness and safety in optimizing language models and the importance of finding the right equilibrium. The model employs two reward models for helpfulness and safety to optimize responses. Llama 2 outperforms competitors in most categories, including Chat GPT 3.5, despite facing challenges in coding and math problems compared to larger models like Chat GPT 4. The section emphasizes the efficiency and potential of Llama 2 in the market.\", 'section_summary': \"The section discusses Meta's Llama 2, an open-source language model that is revolutionizing commercial use. It compares Llama 2 to larger models like Chat GPT 4, highlighting Llama 2's efficiency and potential in the market. The Ghost Attention feature in Llama 2 enhances conversational continuity, while its groundbreaking temporal capability organizes information based on time relevance for more contextually accurate responses. The section also mentions Meta's open-sourcing of Llama 2 and the competition with MosaicML's MPT models.\", 'excerpt_keywords': 'Meta, Llama 2, language model, commercial use, Ghost Attention, conversational continuity, temporal capability, open-source, MosaicML, Databricks'}\n",
"-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_\n",
"Node ID\t 591cd83e-904d-4d43-80e7-7ee0da879e17\n",
"Title\t Meta's Llama 2: Revolutionizing Open Source Language Models for Commercial Use\n",
"Text\t I. Llama 2: Revolutionizing Commercial Use Unlike its predecessor Llama 1, which was limited to research use, Llama 2 represents a major advancement as an open-source commercial model. Businesses can now integrate Llama 2 into products to create AI-powered applications. Availability on Azure and AWS facilitates fine-tuning and adoption. However, restrictions apply to prevent exploitation. Companies with over 700 million active daily users cannot use Llama 2. Additionally, its output cannot be used to improve other language models. II. Llama 2 Model Flavors Llama 2 is available in four different model sizes: 7 billion, 13 billion, 34 billion, and 70 billion parameters. While 7B, 13B, and 70B have already been released, the 34B model is still awaited. The pretrained variant, trained on a whopping 2 trillion tokens, boasts a context window of 4096 tokens, twice the size of its predecessor Llama 1. Meta also released a Llama 2 fine-tuned model for chat applications that was trained on over 1 million human annotations. Such extensive training comes at a cost, with the 70B model taking a staggering 1720320 GPU hours to train. The context window's length determines the amount of content the model can process at once, making Llama 2 a powerful language model in terms of scale and efficiency. III. Safety Considerations: A Top Priority for Meta Meta's commitment to safety and alignment shines through in Llama 2's design. The model demonstrates exceptionally low AI safety violation percentages, surpassing even ChatGPT in safety benchmarks. Finding the right balance between helpfulness and safety when optimizing a model poses significant challenges. While a highly helpful model may be capable of answering any question, including sensitive ones like \"How do I build a bomb?\", it also raises concerns about potential misuse. Thus, striking the perfect equilibrium between providing useful information and ensuring safety is paramount. However, prioritizing safety to an extreme extent can lead to a model that struggles to effectively address a diverse range of questions. This limitation could hinder the model's practical applicability and user experience. Thus, achieving\n",
"Score\t 0.3847429804325645\n",
"Metadata\t {'title': \"Meta's Llama 2: Revolutionizing Open Source Language Models for Commercial Use\", 'url': 'https://pub.towardsai.net/metas-llama-2-revolutionizing-open-source-language-models-for-commercial-use-1492bec112b#148f', 'source_name': 'towards_ai', 'questions_this_excerpt_can_answer': '1. What are the different model sizes available for Llama 2 and how do they differ in terms of parameters and training time?\\n2. How does Meta prioritize safety considerations in the design of Llama 2, and how does it compare to other language models like ChatGPT in terms of AI safety violation percentages?\\n3. What restrictions apply to the commercial use of Llama 2, and why are companies with over 700 million active daily users prohibited from using it?', 'prev_section_summary': \"The section discusses Meta AI's Code Llama and its performance on coding benchmarks like HumanEval and MBPP. Code Llama outperformed other open-source code-centric Large Language Models and even its predecessor, Llama 2. Code Llama 34B achieved impressive scores on both benchmarks, positioning it as a significant player in the code LLM space. The results highlight Code Llama's potential to contribute to the advancement of open-source foundation models in various domains.\", 'section_summary': \"The section discusses Meta's Llama 2, an open-source commercial language model that allows businesses to integrate AI-powered applications. It mentions the different model sizes available (7B, 13B, 34B, and 70B parameters) and their training times. Safety considerations in the design of Llama 2 are highlighted, with a focus on AI safety violation percentages compared to other models like ChatGPT. Restrictions on commercial use, such as companies with over 700 million daily users being prohibited, are also mentioned.\", 'excerpt_keywords': 'Meta, Llama 2, open-source, commercial, language model, AI safety, model sizes, training time, restrictions, safety considerations'}\n",
"-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_\n",
"Node ID\t 48993d8b-597f-4f3c-95f9-88aa9ac4937a\n",
"Title\t Meta's Llama 2: Revolutionizing Open Source Language Models for Commercial Use\n",
"Text\t The model demonstrates exceptionally low AI safety violation percentages, surpassing even ChatGPT in safety benchmarks. Finding the right balance between helpfulness and safety when optimizing a model poses significant challenges. While a highly helpful model may be capable of answering any question, including sensitive ones like \"How do I build a bomb?\", it also raises concerns about potential misuse. Thus, striking the perfect equilibrium between providing useful information and ensuring safety is paramount. However, prioritizing safety to an extreme extent can lead to a model that struggles to effectively address a diverse range of questions. This limitation could hinder the model's practical applicability and user experience. Thus, achieving an optimum balance that allows the model to be both helpful and safe is of utmost importance. To strike the right balance between helpfulness and safety, Meta employed two reward models - one for helpfulness and another for safety - to optimize the model's responses. The 34B parameter model has reported higher safety violations than other variants, possibly contributing to the delay in its release. IV. Helpfulness Comparison: Llama 2 Outperforms Competitors Llama 2 emerges as a strong contender in the open-source language model arena, outperforming its competitors in most categories. The 70B parameter model outperforms all other open-source models, while the 7B and 34B models outshine Falcon in all categories and MPT in all categories except coding. Despite being smaller, Llam a2's performance rivals that of Chat GPT 3.5, a significantly larger closed-source model. While GPT 4 and PalM-2-L, with their larger size, outperform Llama 2, this is expected due to their capacity for handling complex language tasks. Llama 2's impressive ability to compete with larger models highlights its efficiency and potential in the market. However, Llama 2 does face challenges in coding and math problems, where models like Chat GPT 4 excel, given their significantly larger size. Chat GPT 4 performed significantly better than Llama 2 for coding (HumanEval benchmark)and math problem tasks (GSM8k benchmark). Open-source AI technologies, like Llama 2, continue to advance, offering\n",
"Score\t 0.3793493137215412\n",
"Metadata\t {'title': \"Meta's Llama 2: Revolutionizing Open Source Language Models for Commercial Use\", 'url': 'https://pub.towardsai.net/metas-llama-2-revolutionizing-open-source-language-models-for-commercial-use-1492bec112b#148f', 'source_name': 'towards_ai', 'questions_this_excerpt_can_answer': \"1. How does Meta's Llama 2 model compare to other open-source language models in terms of safety benchmarks and helpfulness optimization?\\n2. What challenges does Meta's Llama 2 face in coding and math problem tasks compared to larger models like Chat GPT 4?\\n3. How does Meta strike a balance between providing useful information and ensuring safety in the optimization of their language model responses?\", 'prev_section_summary': \"The section discusses Meta's Llama 2, an open-source commercial language model that allows businesses to integrate AI-powered applications. It mentions the different model sizes available (7B, 13B, 34B, and 70B parameters) and their training times. Safety considerations in the design of Llama 2 are highlighted, with a focus on AI safety violation percentages compared to other models like ChatGPT. Restrictions on commercial use, such as companies with over 700 million daily users being prohibited, are also mentioned.\", 'section_summary': \"The section discusses Meta's Llama 2 model, highlighting its exceptional performance in safety benchmarks compared to ChatGPT. It addresses the challenges of balancing helpfulness and safety in optimizing language models and the importance of finding the right equilibrium. The model employs two reward models for helpfulness and safety to optimize responses. Llama 2 outperforms competitors in most categories, including Chat GPT 3.5, despite facing challenges in coding and math problems compared to larger models like Chat GPT 4. The section emphasizes the efficiency and potential of Llama 2 in the market.\", 'excerpt_keywords': \"Meta's Llama 2, open-source, language model, safety benchmarks, helpfulness optimization, AI safety, balance, reward models, commercial use, efficiency, market potential\"}\n",
"-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_\n"
]
}
],
"source": [
"for src in res.source_nodes:\n",
" print(\"Node ID\\t\", src.node_id)\n",
" print(\"Title\\t\", src.metadata[\"title\"])\n",
" print(\"Text\\t\", src.text)\n",
" print(\"Score\\t\", src.score)\n",
" print(\"Metadata\\t\", src.metadata)\n",
" print(\"-_\" * 20)"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'The Mistral model is a 7.3B parameter language model that was officially released on September 27, 2023. It uses the transformers architecture and was made available under the Apache 2.0 license. The model outperforms LLaMA 2 13B on various benchmarks and is on par with LLaMA 34B on many benchmarks. Mistral 7B incorporates Grouped-query attention (GQA) for faster inference and Sliding Window Attention (SWA) to handle longer sequences efficiently.'"
]
},
"execution_count": 21,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"res = query_engine.query(\"what is the Mistral model?\")\n",
"res.response"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Node ID\t db3ce17d-a8db-45d7-89f8-c83a346e743a\n",
"Text\t Mistral AI is a French company in artificial intelligence. It was founded in April 2023 by researchers previously employed by Meta and Google DeepMind: Arthur Mensch, Timothée Lacroix and Guillaume Lample. It has raised 385 million euros, or about $415 million in October 2023. In December 2023, it attained a valuation of more than $2 billion.It produces open large language models, citing the foundational importance of open-source software, and as a response to proprietary models.As of December 2023, two models have been published, and are available as weights. Another prototype \"Mistral Medium\" is available via API only.\n",
"\n",
"\n",
"== History ==\n",
"Mistral AI was co-founded in April 2023 by Arthur Mensch, Guillaume Lample and Timothée Lacroix.\n",
"Prior to co-founding Mistral AI, Arthur Mensch worked at DeepMind, Google's artificial intelligence laboratory, while Guillaume Lample and Timothée Lacroix worked at Meta.In June 2023, the start-up carried out a first fundraising of 105 million euros (117 million US$) with investors including the American fund Lightspeed Venture Partners, Eric Schmidt, Xavier Niel and JCDecaux. The valuation is then estimated by the Financial Times at 240 million € (267 million US$).\n",
"On September 27, 2023, the company made its language processing model “Mistral 7B” available under the free Apache 2.0 license. This model has 7 billion parameters, a small size compared to its competitors.\n",
"On December 10, 2023, Mistral AI announced that it had raised 385 million € (428 million US$) as part of its second fundraising. This round of financing notably involves the Californian fund Andreessen Horowitz, BNP Paribas and the software publisher Salesforce.On December 11, 2023, the company released the “Mixtral 8x7B” model with 46.7 billion parameters but using only 12.9 billion per token thanks to the mixture of experts architecture. The model masters 5 languages (French, Spanish, Italian, English and German) and outperforms, according to its developers' tests, the \"LLama 2 70B\" model from Meta. A version trained to follow instructions and called “Mixtral 8x7B Instruct” is also\n",
"Score\t 0.5715999678606966\n",
"-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_\n",
"Node ID\t 4d3b2e97-0ee4-43f9-befd-ab0a9b2233b1\n",
"Text\t Horowitz, BNP Paribas and the software publisher Salesforce.On December 11, 2023, the company released the “Mixtral 8x7B” model with 46.7 billion parameters but using only 12.9 billion per token thanks to the mixture of experts architecture. The model masters 5 languages (French, Spanish, Italian, English and German) and outperforms, according to its developers' tests, the \"LLama 2 70B\" model from Meta. A version trained to follow instructions and called “Mixtral 8x7B Instruct” is also offered.On February 26, 2024, Microsoft announced a new partnership with the company to expand its presence in the rapidly evolving artificial intelligence industry. Under the agreement, Mistral's rich language models will be available on Microsoft's Azure cloud, while the multilingual conversational assistant \"Le Chat\" will be launched in the style of ChatGPT.\n",
"\n",
"\n",
"== Models ==\n",
"\n",
"\n",
"=== Mistral 7B ===\n",
"Mistral 7B is a 7.3B parameter language model using the transformers architecture. Officially released on September 27, 2023 via a BitTorrent magnet link, and Hugging Face. The model was released under the Apache 2.0 license. The release blog post claimed the model outperforms LLaMA 2 13B on all benchmarks tested, and is on par with LLaMA 34B on many benchmarks tested.Mistral 7B uses a similar architecture to LLaMA, but with some changes to the attention mechanism. In particular it uses Grouped-query attention (GQA) intended for faster inference and Sliding Window Attention (SWA) intended to handle longer sequences.\n",
"Sliding Window Attention (SWA) reduces the computational cost and memory requirement for longer sequences. In sliding window attention, each token can only attend to a fixed number of tokens from the previous layer in a \"sliding window\" of 4096 tokens, with a total context length of 32768 tokens. At inference time, this reduces the cache availability, leading to higher latency and smaller throughput. To alleviate this issue, Mistral 7B uses a rolling buffer cache.\n",
"Mistral 7B uses grouped-query attention (GQA), which is a variant of the standard attention mechanism. Instead of computing attention over all the hidden states, it computes attention over groups of hidden\n",
"Score\t 0.5634399155685704\n",
"-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_\n"
]
}
],
"source": [
"for src in res.source_nodes:\n",
" print(\"Node ID\\t\", src.node_id)\n",
" print(\"Text\\t\", src.text)\n",
" print(\"Score\\t\", src.score)\n",
" print(\"-_\" * 20)"
]
}
],
"metadata": {
"colab": {
"authorship_tag": "ABX9TyMcBonOXFUEEHJsKREchiOp",
"include_colab_link": true,
"provenance": []
},
"kernelspec": {
"display_name": "Python 3",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.4"
},
"widgets": {
"application/vnd.jupyter.widget-state+json": {
"0245f2604e4d49c8bd0210302746c47b": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.2.0",
"model_name": "LayoutModel",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"134210510d49476e959dd7d032bbdbdc": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "DescriptionStyleModel",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
},
"13b9c5395bca4c3ba21265240cb936cf": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.2.0",
"model_name": "LayoutModel",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"193aef33d9184055bb9223f56d456de6": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.2.0",
"model_name": "LayoutModel",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"3fbabd8a8660461ba5e7bc08ef39139a": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "HBoxModel",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HBoxModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HBoxView",
"box_style": "",
"children": [
"IPY_MODEL_df2365556ae242a2ab1a119f9a31a561",
"IPY_MODEL_5f4b9d32df8f446e858e4c289dc282f9",
"IPY_MODEL_5b588f83a15d42d9aca888e06bbd95ff"
],
"layout": "IPY_MODEL_ad073bca655540809e39f26538d2ec0d"
}
},
"47a4586384274577a726c57605e7f8d9": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "DescriptionStyleModel",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
},
"4a172e8c6aa44e41a42fc1d9cf714fd0": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "HTMLModel",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HTMLModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HTMLView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_e7937a1bc68441a080374911a6563376",
"placeholder": "",
"style": "IPY_MODEL_e532ed7bfef34f67b5fcacd9534eb789",
"value": " 108/108 [00:03<00:00, 33.70it/s]"
}
},
"5b588f83a15d42d9aca888e06bbd95ff": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "HTMLModel",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HTMLModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HTMLView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_af9b6ae927dd4764b9692507791bc67e",
"placeholder": "",
"style": "IPY_MODEL_134210510d49476e959dd7d032bbdbdc",
"value": " 14/14 [00:00<00:00, 21.41it/s]"
}
},
"5c7973afd79349ed997a69120d0629b2": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "ProgressStyleModel",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "ProgressStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"bar_color": null,
"description_width": ""
}
},
"5f4b9d32df8f446e858e4c289dc282f9": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "FloatProgressModel",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "FloatProgressModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "ProgressView",
"bar_style": "success",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_96a3bdece738481db57e811ccb74a974",
"max": 14,
"min": 0,
"orientation": "horizontal",
"style": "IPY_MODEL_5c7973afd79349ed997a69120d0629b2",
"value": 14
}
},
"5f9bb065c2b74d2e8ded32e1306a7807": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "HBoxModel",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HBoxModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HBoxView",
"box_style": "",
"children": [
"IPY_MODEL_73a06bc546a64f7f99a9e4a135319dcd",
"IPY_MODEL_ce48deaf4d8c49cdae92bfdbb3a78df0",
"IPY_MODEL_4a172e8c6aa44e41a42fc1d9cf714fd0"
],
"layout": "IPY_MODEL_0245f2604e4d49c8bd0210302746c47b"
}
},
"73a06bc546a64f7f99a9e4a135319dcd": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "HTMLModel",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HTMLModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HTMLView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_e956dfab55084a9cbe33c8e331b511e7",
"placeholder": "",
"style": "IPY_MODEL_cb394578badd43a89850873ad2526542",
"value": "Generating embeddings: 100%"
}
},
"96a3bdece738481db57e811ccb74a974": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.2.0",
"model_name": "LayoutModel",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"abfc9aa911ce4a5ea81c7c451f08295f": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "ProgressStyleModel",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "ProgressStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"bar_color": null,
"description_width": ""
}
},
"ad073bca655540809e39f26538d2ec0d": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.2.0",
"model_name": "LayoutModel",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"af9b6ae927dd4764b9692507791bc67e": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.2.0",
"model_name": "LayoutModel",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"cb394578badd43a89850873ad2526542": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "DescriptionStyleModel",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
},
"ce48deaf4d8c49cdae92bfdbb3a78df0": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "FloatProgressModel",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "FloatProgressModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "ProgressView",
"bar_style": "success",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_193aef33d9184055bb9223f56d456de6",
"max": 108,
"min": 0,
"orientation": "horizontal",
"style": "IPY_MODEL_abfc9aa911ce4a5ea81c7c451f08295f",
"value": 108
}
},
"df2365556ae242a2ab1a119f9a31a561": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "HTMLModel",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HTMLModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HTMLView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_13b9c5395bca4c3ba21265240cb936cf",
"placeholder": "",
"style": "IPY_MODEL_47a4586384274577a726c57605e7f8d9",
"value": "Parsing nodes: 100%"
}
},
"e532ed7bfef34f67b5fcacd9534eb789": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "DescriptionStyleModel",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
},
"e7937a1bc68441a080374911a6563376": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.2.0",
"model_name": "LayoutModel",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"e956dfab55084a9cbe33c8e331b511e7": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.2.0",
"model_name": "LayoutModel",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
}
}
}
},
"nbformat": 4,
"nbformat_minor": 0
}