Skip to content

Commit

Permalink
implementing hugging face few shot inference
Browse files Browse the repository at this point in the history
  • Loading branch information
srsawant34 committed Nov 13, 2023
1 parent fd5fe68 commit 94e033f
Showing 1 changed file with 19 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
]
},
"source": [
"**Description:** This notebook demonstrates how to utilize the <a href=\"https://huggingface.co/docs/inference-endpoints/index\">inference endpoints</a> of hugging face models. Additionally, it demonstrates how to use few shot learning for a specific task in a model."
"**Description:** This notebook demonstrates how to utilize the <a href=\"https://huggingface.co/docs/inference-endpoints/index\">inference endpoints</a> (additional information can be found here: <a href=\"https://huggingface.co/docs/api-inference/index#-hosted-inference-api\">link</a>) of hugging face models. Additionally, it demonstrates how to use few shot learning for a specific task in a model."
]
},
{
Expand Down Expand Up @@ -183,6 +183,14 @@
"source": [
"### Add the Model and API token\n",
"\n",
"#### Steps to get API token\n",
"- Create an account on Hugging Face\n",
"- Log in, and click on profile icon (top right corner)\n",
"- Go to settings\n",
"- Click on Access tokens\n",
"- Now, create a new access token with name: \"gpt-inference\" and role: \"read\"\n",
"- Copy the generated token and paste it below\n",
"\n",
"We will use <a href=\"https://huggingface.co/EleutherAI/gpt-neo-1.3B\">gpt-neo-1.3B</a> model for our demonstration. "
]
},
Expand Down Expand Up @@ -291,7 +299,7 @@
"id": "f0724801-389c-4184-b3a1-a3491573e24e",
"metadata": {},
"source": [
" The model usually takes time to load in the hugging face server. For example, model gpt-neo-1.3B takes approximately 212 seconds"
"><b>The model usually takes time to load in the hugging face server. For example, model gpt-neo-1.3B takes approximately 212 seconds</b>"
]
},
{
Expand All @@ -302,7 +310,9 @@
"tags": []
},
"source": [
"### Zero-shot"
"### Zero-shot\n",
"\n",
"Zero-shot learning means to generate meaningful responses from model for tasks or topics it has never been explicitly trained on, showcasing a capacity to generalize and understand novel concepts without specific examples during training."
]
},
{
Expand Down Expand Up @@ -357,7 +367,9 @@
"tags": []
},
"source": [
"### One-shot"
"### One-shot\n",
"\n",
"One-shot learning refers to the model's ability to understand and generate meaningful responses after being exposed to a single example or prompt during the inference phase, showcasing its capacity to generalize knowledge from limited input."
]
},
{
Expand Down Expand Up @@ -412,7 +424,9 @@
"id": "96831b89-e92f-4ddb-8703-0124c26c8613",
"metadata": {},
"source": [
"### Two-shot"
"### Two-shot\n",
"\n",
"Similar to one-shot, we will have the model exposed to two examples to generalize knowledge and make predictions."
]
},
{
Expand Down

0 comments on commit 94e033f

Please sign in to comment.