Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resolved typos, awaiting for approval #133

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 24 additions & 11 deletions example/extract/extract_pdf.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -220,27 +220,34 @@
"metadata": {},
"outputs": [],
"source": [
"instruction=\"\"\"Generate one question and its corresponding answer based on the last context in the last \\\n",
"example. Follow the format of the examples below to include context, question, and answer in the response\"\"\"\n",
"context=\"\"\"In 1948, Claude E. Shannon published A Mathematical Theory of\\nCommunication (Shannon, 1948) establishing the theory of\\ninformation. In his article, Shannon introduced the concept of\\ninformation entropy for the first time. We will begin our journey here.\"\"\"\n",
"question=\"\"\"Who published A Mathematical Theory of Communication in 1948?\"\"\"\n",
"answer=\"\"\"Claude E. Shannon.\"\"\"\n",
"\n",
"guided_prompt = PromptTemplate(\n",
" instruction=\"\"\"Generate one question and its corresponding answer based on the last context in the last\n",
" example. Follow the format of the examples below to include context, question, and answer in the response\"\"\",\n",
" instruction=instruction,\n",
" few_shot_prompt=[Context(\n",
" context=\"In 1948, Claude E. Shannon published A Mathematical Theory of\\nCommunication (Shannon, 1948) establishing the theory of\\ninformation. In his article, Shannon introduced the concept of\\ninformation entropy for the first time. We will begin our journey here.\"\"\",\n",
" question=\"Who published A Mathematical Theory of Communication in 1948?\"\"\",\n",
" answer=\"Claude E. Shannon.\"\"\"\n",
" context=context,\n",
" question=question,\n",
" answer=answer\n",
" )]\n",
")\n",
"\n",
"input_data = [\n",
" Context(\n",
" context=p[:1000],\n",
" question=\"\",\n",
" answer=\"\",\n",
" )\n",
" for p in contexts\n",
" Context(\n",
" context=p[:1000],\n",
" question=\"\"\"\"\"\",\n",
" answer=\"\"\"\"\"\",\n",
" )\n",
" for p in contexts\n",
"]\n"
]
},
{
"cell_type": "markdown",
"id": "8f7be007",
"metadata": {},
"source": [
"### Run the model\n",
Expand Down Expand Up @@ -540,6 +547,12 @@
" <img src=\"../image/cambioml_logo_large.png\" style=\"height: 100px; display: block; margin-left: auto; margin-right: auto;\"/>\n",
"</a>"
]
},
{
"cell_type": "markdown",
"id": "9d0ada9b",
"metadata": {},
"source": []
}
],
"metadata": {
Expand Down
2 changes: 1 addition & 1 deletion example/llm/sagemaker_deploy_mistral.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,7 @@
"\n",
"<a href=\"https://www.cambioml.com/\" title=\"Title\">\n",
" <img src=\"../image/cambioml_logo_large.png\" style=\"height: 100px; display: block; margin-left: auto; margin-right: auto;\"/>\n",
"</a>\n"
"</a>"
]
}
],
Expand Down
16 changes: 11 additions & 5 deletions example/pipeline/pipeline_pdf.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,19 @@
"metadata": {},
"outputs": [],
"source": [
"instruction=\"\"\"Generate one question and its corresponding answer based on the last context in the last \\\n",
"example. Follow the format of the examples below to include context, question, and answer in the response\"\"\"\n",
"\n",
"context=\"\"\"In 1948, Claude E. Shannon published A Mathematical Theory of\\nCommunication (Shannon, 1948) establishing the theory of\\ninformation. In his article, Shannon introduced the concept of\\ninformation entropy for the first time. We will begin our journey here.\"\"\"\n",
"question=\"\"\"Who published A Mathematical Theory of Communication in 1948?\"\"\"\n",
"answer=\"\"\"Claude E. Shannon.\"\"\"\n",
"\n",
"guided_prompt = PromptTemplate(\n",
" instruction=\"\"\"Generate one question and its corresponding answer based on the last context in the last\n",
" example. Follow the format of the examples below to include context, question, and answer in the response\"\"\",\n",
" instruction=instruction,\n",
" few_shot_prompt=[Context(\n",
" context=\"In 1948, Claude E. Shannon published A Mathematical Theory of\\nCommunication (Shannon, 1948) establishing the theory of\\ninformation. In his article, Shannon introduced the concept of\\ninformation entropy for the first time. We will begin our journey here.\"\"\",\n",
" question=\"Who published A Mathematical Theory of Communication in 1948?\"\"\",\n",
" answer=\"Claude E. Shannon.\"\"\"\n",
" context=context,\n",
" question=question,\n",
" answer=answer\n",
" )]\n",
")\n"
]
Expand Down
16 changes: 11 additions & 5 deletions example/pipeline/pipeline_pdf_extract_transform.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,20 @@
"metadata": {},
"outputs": [],
"source": [
"instruction=\"\"\"Generate one question and its corresponding answer based on the last context in the last \\\n",
"example. Follow the format of the examples below to include context, question, and answer in the response\"\"\"\n",
"\n",
"context=\"\"\"In 1948, Claude E. Shannon published A Mathematical Theory of\\nCommunication (Shannon, 1948) establishing the theory of\\ninformation. In his article, Shannon introduced the concept of\\ninformation entropy for the first time. We will begin our journey here.\"\"\"\n",
"question=\"\"\"Who published A Mathematical Theory of Communication in 1948?\"\"\"\n",
"answer=\"\"\"Claude E. Shannon.\"\"\"\n",
"\n",
"guided_prompt = PromptTemplate(\n",
" instruction=\"\"\"Generate one question and its corresponding answer based on the last context in the last\n",
" example. Follow the format of the examples below to include context, question, and answer in the response\"\"\",\n",
" instruction=instruction,\n",
" few_shot_prompt=[\n",
" Context(\n",
" context=\"In 1948, Claude E. Shannon published A Mathematical Theory of\\nCommunication (Shannon, 1948) establishing the theory of\\ninformation. In his article, Shannon introduced the concept of\\ninformation entropy for the first time. We will begin our journey here.\",\n",
" question=\"Who published A Mathematical Theory of Communication in 1948?\",\n",
" answer=\"Claude E. Shannon.\",\n",
" context=context,\n",
" question=question,\n",
" answer=answer,\n",
" ),\n",
" \n",
"])"
Expand Down
18 changes: 9 additions & 9 deletions example/rater/bedrock_classification.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,15 @@
"outputs": [],
"source": [
"raw_input = [\n",
" (\"The Pacific Ocean is the largest and deepest of Earth's oceanic divisions. It extends from the Arctic Ocean in the north to the Southern Ocean in the south.\",\n",
" \"What is the largest ocean on Earth?\",\n",
" \"The largest ocean on Earth is the Pacific Ocean.\"), # correct\n",
" (\"Shakespeare, a renowned English playwright and poet, wrote 39 plays during his lifetime. His works include famous plays like 'Hamlet' and 'Romeo and Juliet'.\",\n",
" \"How many plays did Shakespeare write?\",\n",
" \"Shakespeare wrote 39 plays.\"), # correct\n",
" (\"The human brain is an intricate organ responsible for intelligence, memory, and emotions. It is made up of approximately 86 billion neurons.\",\n",
" \"What is the human brain responsible for?\",\n",
" \"The human brain is responsible for physical movement.\"), # incorrect\n",
" (\"\"\"The Pacific Ocean is the largest and deepest of Earth's oceanic divisions. It extends from the Arctic Ocean in the north to the Southern Ocean in the south.\"\"\",\n",
" \"\"\"What is the largest ocean on Earth?\"\"\",\n",
" \"\"\"The largest ocean on Earth is the Pacific Ocean.\"\"\"), # correct\n",
" (\"\"\"Shakespeare, a renowned English playwright and poet, wrote 39 plays during his lifetime. His works include famous plays like 'Hamlet' and 'Romeo and Juliet'.\"\"\",\n",
" \"\"\"How many plays did Shakespeare write?\"\"\",\n",
" \"\"\"Shakespeare wrote 39 plays.\"\"\"), # correct\n",
" (\"\"\"The human brain is an intricate organ responsible for intelligence, memory, and emotions. It is made up of approximately 86 billion neurons.\"\"\",\n",
" \"\"\"What is the human brain responsible for?\"\"\",\n",
" \"\"\"The human brain is responsible for physical movement.\"\"\"), # incorrect\n",
"]"
]
},
Expand Down
18 changes: 9 additions & 9 deletions example/rater/classification.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,15 @@
"outputs": [],
"source": [
"raw_input = [\n",
" (\"The Pacific Ocean is the largest and deepest of Earth's oceanic divisions. It extends from the Arctic Ocean in the north to the Southern Ocean in the south.\",\n",
" \"What is the largest ocean on Earth?\",\n",
" \"The largest ocean on Earth is the Pacific Ocean.\"), # correct\n",
" (\"Shakespeare, a renowned English playwright and poet, wrote 39 plays during his lifetime. His works include famous plays like 'Hamlet' and 'Romeo and Juliet'.\",\n",
" \"How many plays did Shakespeare write?\",\n",
" \"Shakespeare wrote 31 plays.\"), # incorrect\n",
" (\"The human brain is an intricate organ responsible for intelligence, memory, and emotions. It is made up of approximately 86 billion neurons.\",\n",
" \"What is the human brain responsible for?\",\n",
" \"The human brain is responsible for physical movement.\"), # incorrect\n",
" (\"\"\"The Pacific Ocean is the largest and deepest of Earth's oceanic divisions. It extends from the Arctic Ocean in the north to the Southern Ocean in the south.\"\"\",\n",
" \"\"\"What is the largest ocean on Earth?\"\"\",\n",
" \"\"\"The largest ocean on Earth is the Pacific Ocean.\"\"\"), # correct\n",
" (\"\"\"Shakespeare, a renowned English playwright and poet, wrote 39 plays during his lifetime. His works include famous plays like 'Hamlet' and 'Romeo and Juliet'.\"\"\",\n",
" \"\"\"How many plays did Shakespeare write?\"\"\",\n",
" \"\"\"Shakespeare wrote 31 plays.\"\"\"), # incorrect\n",
" (\"\"\"The human brain is an intricate organ responsible for intelligence, memory, and emotions. It is made up of approximately 86 billion neurons.\"\"\",\n",
" \"\"\"What is the human brain responsible for?\"\"\",\n",
" \"\"\"The human brain is responsible for physical movement.\"\"\"), # incorrect\n",
"]\n",
"\n",
"data = [\n",
Expand Down
24 changes: 12 additions & 12 deletions example/rater/generated_answer.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -90,18 +90,18 @@
"outputs": [],
"source": [
"raw_input = [\n",
" (\"Reddit is an American social news aggregation, content rating, and discussion website. Registered users submit content to the site such as links, text posts, images, and videos, which are then voted up or down by other members.\",\n",
" \"What type of content can users submit on Reddit?\",\n",
" \"Users can only post text on Reddit.\",\n",
" \"Users on Reddit can submit various types of content including links, text posts, images, and videos.\"), # Better\n",
" (\"League of Legends (LoL), commonly referred to as League, is a 2009 multiplayer online battle arena video game developed and published by Riot Games. \",\n",
" \"When was League of Legends released?\",\n",
" \"League of Legends was released in 2009.\",\n",
" \"League of Legends was released in the early 2000s.\"), # Worse\n",
" (\"Vitamin C (also known as ascorbic acid and ascorbate) is a water-soluble vitamin found in citrus and other fruits, berries and vegetables, also sold as a dietary supplement and as a topical serum ingredient to treat melasma (dark pigment spots) and wrinkles on the face.\",\n",
" \"Is Vitamin C water-soluble?\",\n",
" \"Yes, Vitamin C is a very water-soluble vitamin.\",\n",
" \"Yes, Vitamin C can be dissolved in water well.\"), # Equally good\n",
" (\"\"\"Reddit is an American social news aggregation, content rating, and discussion website. Registered users submit content to the site such as links, text posts, images, and videos, which are then voted up or down by other members.\"\"\",\n",
" \"\"\"What type of content can users submit on Reddit?\"\"\",\n",
" \"\"\"Users can only post text on Reddit.\"\"\",\n",
" \"\"\"Users on Reddit can submit various types of content including links, text posts, images, and videos.\"\"\"), # Better\n",
" (\"\"\"League of Legends (LoL), commonly referred to as League, is a 2009 multiplayer online battle arena video game developed and published by Riot Games. \"\"\",\n",
" \"\"\"When was League of Legends released?\"\"\",\n",
" \"\"\"League of Legends was released in 2009.\"\"\",\n",
" \"\"\"League of Legends was released in the early 2000s.\"\"\"), # Worse\n",
" (\"\"\"Vitamin C (also known as ascorbic acid and ascorbate) is a water-soluble vitamin found in citrus and other fruits, berries and vegetables, also sold as a dietary supplement and as a topical serum ingredient to treat melasma (dark pigment spots) and wrinkles on the face.\"\"\",\n",
" \"\"\"Is Vitamin C water-soluble?\"\"\",\n",
" \"\"\"Yes, Vitamin C is a very water-soluble vitamin.\"\"\",\n",
" \"\"\"Yes, Vitamin C can be dissolved in water well.\"\"\"), # Equally good\n",
"]\n",
"\n",
"data = [\n",
Expand Down
2 changes: 1 addition & 1 deletion example/rater/huggingface_classification.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@
"source": [
"config = RaterForClassificationHuggingfaceConfig(\n",
" model_config=HuggingfaceModelConfig(\n",
" response_start_key=\"explanation\", \n",
" response_start_key=\"explanation\",\n",
" response_format={\"type\": \"json_object\"},\n",
" batch_size=2\n",
" )\n",
Expand Down
12 changes: 6 additions & 6 deletions example/transform/huggingface_model.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -156,14 +156,14 @@
"\n",
"sample_examples = [\n",
" Context(\n",
" context=\"The quick brown fox jumps over the lazy dog.\",\n",
" question=\"What is the color of the fox?\",\n",
" answer=\"brown.\"\n",
" context=\"\"\"The quick brown fox jumps over the lazy dog.\"\"\",\n",
" question=\"\"\"What is the color of the fox?\"\"\",\n",
" answer=\"\"\"brown.\"\"\"\n",
" ),\n",
" Context(\n",
" context=\"The quick brown fox jumps over the lazy black dog.\",\n",
" question=\"What is the color of the dog?\",\n",
" answer=\"black.\"\n",
" context=\"\"\"The quick brown fox jumps over the lazy black dog.\"\"\",\n",
" question=\"\"\"What is the color of the dog?\"\"\",\n",
" answer=\"\"\"black.\"\"\"\n",
" )]\n",
"\n",
"guided_prompt = PromptTemplate(\n",
Expand Down
1 change: 0 additions & 1 deletion example/transform/huggingface_model_5QAs.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,6 @@
}
],
"source": [
"\n",
"input_data = [\n",
" Context(context=data)\n",
" for data in raw_context_input_400\n",
Expand Down
13 changes: 6 additions & 7 deletions example/transform/huggingface_model_neuron.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,14 @@
"\n",
"sample_examples = [\n",
" Context(\n",
" context=\"The quick brown fox jumps over the lazy dog.\",\n",
" question=\"What is the color of the fox?\",\n",
" answer=\"brown.\"\n",
" context=\"\"\"The quick brown fox jumps over the lazy dog.\"\"\",\n",
" question=\"\"\"What is the color of the fox?\"\"\",\n",
" answer=\"\"\"brown.\"\"\"\n",
" ),\n",
" Context(\n",
" context=\"The quick brown fox jumps over the lazy black dog.\",\n",
" question=\"What is the color of the dog?\",\n",
" answer=\"black.\"\n",
" context=\"\"\"The quick brown fox jumps over the lazy black dog.\"\"\",\n",
" question=\"\"\"What is the color of the dog?\"\"\",\n",
" answer=\"\"\"black.\"\"\"\n",
" )]\n",
"\n",
"guided_prompt = PromptTemplate(\n",
Expand Down Expand Up @@ -243,7 +243,6 @@
}
],
"source": [
"\n",
"input_data = [\n",
" Context(context=data)\n",
" for data in raw_context_input_400\n",
Expand Down
8 changes: 4 additions & 4 deletions example/transform/lmqg_model.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -271,10 +271,10 @@
"outputs": [],
"source": [
"raw_context_input = [\n",
" \"\"\"William Turner was an English painter who specialised in watercolour landscapes. He is often known\n",
" \"as William Turner of Oxford or just Turner of Oxford to distinguish him from his contemporary,\n",
" \"J. M. W. Turner. Many of Turner's paintings depicted the countryside around Oxford. One of his\n",
" \"best known pictures is a view of the city of Oxford from Hinksey Hill.\"\"\",\n",
" \"\"\"William Turner was an English painter who specialised in watercolour landscapes. He is often known \\\n",
"as William Turner of Oxford or just Turner of Oxford to distinguish him from his contemporary, \\\n",
"J. M. W. Turner. Many of Turner's paintings depicted the countryside around Oxford. One of his \\\n",
"best known pictures is a view of the city of Oxford from Hinksey Hill.\"\"\",\n",
" \"\"\"My name is bobby and I am a talent software engineer working on AI/ML.\"\"\"\n",
"]"
]
Expand Down
4 changes: 2 additions & 2 deletions example/transform/model.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@
"outputs": [],
"source": [
"raw_context_input = [\n",
" \"It was a sunny day and the sky color is blue.\",\n",
" \"My name is Bobby and I am a talent software engineer working on AI/ML\",\n",
" \"\"\"It was a sunny day and the sky color is blue.\"\"\",\n",
" \"\"\"My name is Bobby and I am a talent software engineer working on AI/ML\"\"\",\n",
"]"
]
},
Expand Down
18 changes: 9 additions & 9 deletions example/transform/openai_json_model.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -114,22 +114,22 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"guided_prompt = PromptTemplate(\n",
" instruction=\"Generate one question and its corresponding answer based on the context. Follow the format of the examples below to include context, question, and answer in the response in json\",\n",
" few_shot_prompt=[\n",
" Context(\n",
" context=\"The quick brown fox jumps over the lazy black dog.\",\n",
" question=\"What is the color of the fox?\",\n",
" answer=\"brown.\",\n",
" context=\"\"\"The quick brown fox jumps over the lazy black dog.\"\"\",\n",
" question=\"\"\"What is the color of the fox?\"\"\",\n",
" answer=\"\"\"brown.\"\"\"\n",
" ),\n",
" Context(\n",
" context=\"The quick brown fox jumps over the lazy black dog.\",\n",
" question=\"What is the color of the dog?\",\n",
" answer=\"black.\",\n",
" context=\"\"\"The quick brown fox jumps over the lazy black dog.\"\"\",\n",
" question=\"\"\"What is the color of the dog?\"\"\",\n",
" answer=\"\"\"black.\"\"\"\n",
" ),\n",
" ],\n",
")"
Expand All @@ -149,8 +149,8 @@
"outputs": [],
"source": [
"raw_context_input = [\n",
" \"It was a sunny day and the sky color is blue.\",\n",
" \"My name is bobby and I am a talent software engineer working on AI/ML.\",\n",
" \"\"\"It was a sunny day and the sky color is blue.\"\"\",\n",
" \"\"\"My name is bobby and I am a talent software engineer working on AI/ML.\"\"\"\n",
"]"
]
},
Expand Down
Loading