Skip to content

Commit

Permalink
Minor formatting changes to flan-t5 notebook (huggingface#398)
Browse files Browse the repository at this point in the history
  • Loading branch information
hmellor authored May 24, 2023
1 parent bbb49fe commit 1f13c92
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions notebooks/flan_t5_inference.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@
"[Company]: Amazon, [Founded]: 1994, [Founders]: Jeff Bezos\n",
"\n",
"Apple Inc. is a multinational company that makes personal computers, mobile devices, and software. Apple was started in 1976 by Steve Jobs and Steve Wozniak.\"\"\"\n",
"print(flan_t5(advanced_ner)[0][\"generated_text\"])"
"flan_t5(advanced_ner)[0][\"generated_text\"]"
]
},
{
Expand All @@ -248,9 +248,8 @@
"source": [
"context = 'Super Bowl 50 was an American football game to determine the champion of the National Football League (NFL) for the 2015 season. The American Football Conference (AFC) champion Denver Broncos defeated the National Football Conference (NFC) champion Carolina Panthers 24-10 to earn their third Super Bowl title. The game was played on February 7, 2016, at Levi\\'s Stadium in the San Francisco Bay Area at Santa Clara, California. As this was the 50th Super Bowl, the league emphasized the \"golden anniversary\" with various gold-themed initiatives, as well as temporarily suspending the tradition of naming each Super Bowl game with Roman numerals (under which the game would have been known as \"Super Bowl L\"), so that the logo could prominently feature the Arabic numerals 50.'\n",
"question = \"Which NFL team represented the AFC at Super Bowl 50?\"\n",
"response = flan_t5(f\"{context} {question}\")\n",
"# The correct answer is Denver Broncos\n",
"print(response[0]['generated_text'])\n"
"flan_t5(f\"{context} {question}\")[0]['generated_text']"
]
},
{
Expand All @@ -275,7 +274,7 @@
"\n",
"[Text]: I need all these documents sorted and filed by Monday.\n",
"[Intent]:\"\"\"\n",
"print(flan_t5([intent_classification])[0][\"generated_text\"])"
"flan_t5([intent_classification])[0][\"generated_text\"]"
]
},
{
Expand Down Expand Up @@ -311,7 +310,7 @@
"A 26-year-old man who was arrested and charged appeared at Edinburgh Sheriff Court on Thursday.\n",
"Summary:\n",
"\"\"\"\n",
"print(flan_t5(summarization)[0][\"generated_text\"])"
"flan_t5(summarization)[0][\"generated_text\"]"
]
},
{
Expand Down Expand Up @@ -339,7 +338,7 @@
"\n",
"George Washington was president of the United States from 1789 to 1797.\n",
"topic:\"\"\"\n",
"print(flan_t5(text_classification_1)[0][\"generated_text\"])"
"flan_t5(text_classification_1)[0][\"generated_text\"]"
]
},
{
Expand All @@ -358,7 +357,7 @@
"Paperspace is the platform for AI developers. providing the speed and scale needed to take AI models from concept to production.\n",
"keywords:\"\"\"\n",
"\n",
"print(flan_t5(text_classification_2)[0][\"generated_text\"])"
"flan_t5(text_classification_2)[0][\"generated_text\"]"
]
},
{
Expand Down Expand Up @@ -416,7 +415,6 @@
" def ask(self, question):\n",
" question += \".\" if question[-1] not in [\".\", \"?\", \"!\"] else \"\"\n",
" x = f\"{self.context}\\n{self.user}: {question}\\n{self.persona}: \"\n",
" # print(f\"\\n{x}\\n\")\n",
" y = self.model(x)\n",
" response = y[0][\"generated_text\"]\n",
" self.context = f\"{x}{response}\"\n",
Expand Down

0 comments on commit 1f13c92

Please sign in to comment.