Spaces:
Sleeping
Sleeping
Anubad Mahapatra commited on
Commit ·
6103d92
1
Parent(s): 5c86a6f
Finished Analysis Questions
Browse files
Anubad_MIS769_HW9_Text_Generation.ipynb
CHANGED
|
@@ -162,7 +162,7 @@
|
|
| 162 |
{
|
| 163 |
"data": {
|
| 164 |
"application/vnd.jupyter.widget-view+json": {
|
| 165 |
-
"model_id": "
|
| 166 |
"version_major": 2,
|
| 167 |
"version_minor": 0
|
| 168 |
},
|
|
@@ -207,7 +207,7 @@
|
|
| 207 |
"name": "stderr",
|
| 208 |
"output_type": "stream",
|
| 209 |
"text": [
|
| 210 |
-
"Passing `generation_config` together with generation-related arguments=({'
|
| 211 |
"Both `max_new_tokens` (=50) and `max_length`(=50) seem to have been set. `max_new_tokens` will take precedence. Please refer to the documentation for more information. (https://huggingface.co/docs/transformers/main/en/main_classes/text_generation)\n"
|
| 212 |
]
|
| 213 |
},
|
|
@@ -220,9 +220,7 @@
|
|
| 220 |
"Prompt: \"The future of artificial intelligence\"\n",
|
| 221 |
"\n",
|
| 222 |
"Generated:\n",
|
| 223 |
-
"The future of artificial intelligence
|
| 224 |
-
"\n",
|
| 225 |
-
"In a 2014 article in the journal Nature, Stanford professor and MIT professor of computer\n"
|
| 226 |
]
|
| 227 |
}
|
| 228 |
],
|
|
@@ -268,7 +266,7 @@
|
|
| 268 |
"name": "stderr",
|
| 269 |
"output_type": "stream",
|
| 270 |
"text": [
|
| 271 |
-
"Passing `generation_config` together with generation-related arguments=({'
|
| 272 |
"Both `max_new_tokens` (=30) and `max_length`(=50) seem to have been set. `max_new_tokens` will take precedence. Please refer to the documentation for more information. (https://huggingface.co/docs/transformers/main/en/main_classes/text_generation)\n",
|
| 273 |
"Both `max_new_tokens` (=30) and `max_length`(=50) seem to have been set. `max_new_tokens` will take precedence. Please refer to the documentation for more information. (https://huggingface.co/docs/transformers/main/en/main_classes/text_generation)\n"
|
| 274 |
]
|
|
@@ -281,7 +279,7 @@
|
|
| 281 |
"============================================================\n",
|
| 282 |
"\n",
|
| 283 |
"Temperature 0.3:\n",
|
| 284 |
-
" , the world was a place of
|
| 285 |
]
|
| 286 |
},
|
| 287 |
{
|
|
@@ -297,12 +295,12 @@
|
|
| 297 |
"text": [
|
| 298 |
"\n",
|
| 299 |
"Temperature 0.7:\n",
|
| 300 |
-
"
|
| 301 |
"\n",
|
| 302 |
-
"
|
| 303 |
-
" , all was right with humankind. And one day the day would come now.\n",
|
| 304 |
"\n",
|
| 305 |
-
"
|
|
|
|
| 306 |
]
|
| 307 |
}
|
| 308 |
],
|
|
@@ -342,7 +340,7 @@
|
|
| 342 |
"name": "stderr",
|
| 343 |
"output_type": "stream",
|
| 344 |
"text": [
|
| 345 |
-
"Passing `generation_config` together with generation-related arguments=({'
|
| 346 |
"Both `max_new_tokens` (=30) and `max_length`(=50) seem to have been set. `max_new_tokens` will take precedence. Please refer to the documentation for more information. (https://huggingface.co/docs/transformers/main/en/main_classes/text_generation)\n"
|
| 347 |
]
|
| 348 |
},
|
|
@@ -358,7 +356,6 @@
|
|
| 358 |
"name": "stderr",
|
| 359 |
"output_type": "stream",
|
| 360 |
"text": [
|
| 361 |
-
"Both `max_new_tokens` (=30) and `max_length`(=50) seem to have been set. `max_new_tokens` will take precedence. Please refer to the documentation for more information. (https://huggingface.co/docs/transformers/main/en/main_classes/text_generation)\n",
|
| 362 |
"Both `max_new_tokens` (=30) and `max_length`(=50) seem to have been set. `max_new_tokens` will take precedence. Please refer to the documentation for more information. (https://huggingface.co/docs/transformers/main/en/main_classes/text_generation)\n"
|
| 363 |
]
|
| 364 |
},
|
|
@@ -368,10 +365,23 @@
|
|
| 368 |
"text": [
|
| 369 |
"\n",
|
| 370 |
"top_k=10:\n",
|
| 371 |
-
" ,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 372 |
"\n",
|
| 373 |
"top_k=50:\n",
|
| 374 |
-
" , I
|
| 375 |
]
|
| 376 |
},
|
| 377 |
{
|
|
@@ -387,10 +397,10 @@
|
|
| 387 |
"text": [
|
| 388 |
"\n",
|
| 389 |
"top_p=0.9:\n",
|
| 390 |
-
" , the
|
| 391 |
"\n",
|
| 392 |
"top_p=0.5:\n",
|
| 393 |
-
" ,
|
| 394 |
]
|
| 395 |
}
|
| 396 |
],
|
|
@@ -455,7 +465,7 @@
|
|
| 455 |
"name": "stderr",
|
| 456 |
"output_type": "stream",
|
| 457 |
"text": [
|
| 458 |
-
"Passing `generation_config` together with generation-related arguments=({'
|
| 459 |
"Both `max_new_tokens` (=80) and `max_length`(=50) seem to have been set. `max_new_tokens` will take precedence. Please refer to the documentation for more information. (https://huggingface.co/docs/transformers/main/en/main_classes/text_generation)\n"
|
| 460 |
]
|
| 461 |
},
|
|
@@ -480,12 +490,15 @@
|
|
| 480 |
"text": [
|
| 481 |
"\n",
|
| 482 |
"No penalty (repetition_penalty=1.0):\n",
|
| 483 |
-
" it
|
| 484 |
"\n",
|
| 485 |
-
"The
|
| 486 |
"\n",
|
| 487 |
"Penalty 1.3 (repetition_penalty=1.3):\n",
|
| 488 |
-
" it
|
|
|
|
|
|
|
|
|
|
| 489 |
]
|
| 490 |
}
|
| 491 |
],
|
|
@@ -644,7 +657,7 @@
|
|
| 644 |
"output_type": "stream",
|
| 645 |
"text": [
|
| 646 |
"* Running on local URL: http://127.0.0.1:7860\n",
|
| 647 |
-
"* Running on public URL: https://
|
| 648 |
"\n",
|
| 649 |
"This share link expires in 1 week. For free permanent hosting and GPU upgrades, run `gradio deploy` from the terminal in the working directory to deploy to Hugging Face Spaces (https://huggingface.co/spaces)\n"
|
| 650 |
]
|
|
@@ -652,7 +665,7 @@
|
|
| 652 |
{
|
| 653 |
"data": {
|
| 654 |
"text/html": [
|
| 655 |
-
"<div><iframe src=\"https://
|
| 656 |
],
|
| 657 |
"text/plain": [
|
| 658 |
"<IPython.core.display.HTML object>"
|
|
@@ -931,7 +944,7 @@
|
|
| 931 |
"text": [
|
| 932 |
"\n",
|
| 933 |
"Prompt: Write a professional email starting with: Dear hir...\n",
|
| 934 |
-
"Output: I
|
| 935 |
]
|
| 936 |
},
|
| 937 |
{
|
|
@@ -947,10 +960,12 @@
|
|
| 947 |
"text": [
|
| 948 |
"\n",
|
| 949 |
"Prompt: Create a product description for: A smart water bo...\n",
|
| 950 |
-
"Output: can
|
| 951 |
"\n",
|
| 952 |
"Prompt: Generate a tweet about: The benefits of remote wor...\n",
|
| 953 |
-
"Output:
|
|
|
|
|
|
|
| 954 |
]
|
| 955 |
}
|
| 956 |
],
|
|
@@ -996,15 +1011,15 @@
|
|
| 996 |
"\n",
|
| 997 |
"**Q2:** What trade-offs did you make for Spaces deployment?\n",
|
| 998 |
"\n",
|
| 999 |
-
"*
|
| 1000 |
"\n",
|
| 1001 |
"**Q3:** What would you add to make this production-ready?\n",
|
| 1002 |
"\n",
|
| 1003 |
-
"*
|
| 1004 |
"\n",
|
| 1005 |
"**Q4:** Your HuggingFace Spaces URL:\n",
|
| 1006 |
"\n",
|
| 1007 |
-
"*
|
| 1008 |
]
|
| 1009 |
},
|
| 1010 |
{
|
|
|
|
| 162 |
{
|
| 163 |
"data": {
|
| 164 |
"application/vnd.jupyter.widget-view+json": {
|
| 165 |
+
"model_id": "03d186647408438da121033e0d9d98bb",
|
| 166 |
"version_major": 2,
|
| 167 |
"version_minor": 0
|
| 168 |
},
|
|
|
|
| 207 |
"name": "stderr",
|
| 208 |
"output_type": "stream",
|
| 209 |
"text": [
|
| 210 |
+
"Passing `generation_config` together with generation-related arguments=({'pad_token_id', 'max_new_tokens', 'do_sample'}) is deprecated and will be removed in future versions. Please pass either a `generation_config` object OR all generation parameters explicitly, but not both.\n",
|
| 211 |
"Both `max_new_tokens` (=50) and `max_length`(=50) seem to have been set. `max_new_tokens` will take precedence. Please refer to the documentation for more information. (https://huggingface.co/docs/transformers/main/en/main_classes/text_generation)\n"
|
| 212 |
]
|
| 213 |
},
|
|
|
|
| 220 |
"Prompt: \"The future of artificial intelligence\"\n",
|
| 221 |
"\n",
|
| 222 |
"Generated:\n",
|
| 223 |
+
"The future of artificial intelligence and the future of the social contract is yet to be determined. The future of our society may or may not take many forms. We may have a new kind of social contract, our new political contract, our new economic contract, or perhaps even the\n"
|
|
|
|
|
|
|
| 224 |
]
|
| 225 |
}
|
| 226 |
],
|
|
|
|
| 266 |
"name": "stderr",
|
| 267 |
"output_type": "stream",
|
| 268 |
"text": [
|
| 269 |
+
"Passing `generation_config` together with generation-related arguments=({'pad_token_id', 'temperature', 'max_new_tokens', 'do_sample'}) is deprecated and will be removed in future versions. Please pass either a `generation_config` object OR all generation parameters explicitly, but not both.\n",
|
| 270 |
"Both `max_new_tokens` (=30) and `max_length`(=50) seem to have been set. `max_new_tokens` will take precedence. Please refer to the documentation for more information. (https://huggingface.co/docs/transformers/main/en/main_classes/text_generation)\n",
|
| 271 |
"Both `max_new_tokens` (=30) and `max_length`(=50) seem to have been set. `max_new_tokens` will take precedence. Please refer to the documentation for more information. (https://huggingface.co/docs/transformers/main/en/main_classes/text_generation)\n"
|
| 272 |
]
|
|
|
|
| 279 |
"============================================================\n",
|
| 280 |
"\n",
|
| 281 |
"Temperature 0.3:\n",
|
| 282 |
+
" , the world was a place of peace and harmony. But now, the world is a place of w...\n"
|
| 283 |
]
|
| 284 |
},
|
| 285 |
{
|
|
|
|
| 295 |
"text": [
|
| 296 |
"\n",
|
| 297 |
"Temperature 0.7:\n",
|
| 298 |
+
" , it was a small part of his life that would end up coming into fruition.\n",
|
| 299 |
"\n",
|
| 300 |
+
"In th...\n",
|
|
|
|
| 301 |
"\n",
|
| 302 |
+
"Temperature 1.2:\n",
|
| 303 |
+
" he had thought his dreams would turn him, to the true power where his strength ...\n"
|
| 304 |
]
|
| 305 |
}
|
| 306 |
],
|
|
|
|
| 340 |
"name": "stderr",
|
| 341 |
"output_type": "stream",
|
| 342 |
"text": [
|
| 343 |
+
"Passing `generation_config` together with generation-related arguments=({'pad_token_id', 'top_k', 'max_new_tokens', 'do_sample', 'top_p'}) is deprecated and will be removed in future versions. Please pass either a `generation_config` object OR all generation parameters explicitly, but not both.\n",
|
| 344 |
"Both `max_new_tokens` (=30) and `max_length`(=50) seem to have been set. `max_new_tokens` will take precedence. Please refer to the documentation for more information. (https://huggingface.co/docs/transformers/main/en/main_classes/text_generation)\n"
|
| 345 |
]
|
| 346 |
},
|
|
|
|
| 356 |
"name": "stderr",
|
| 357 |
"output_type": "stream",
|
| 358 |
"text": [
|
|
|
|
| 359 |
"Both `max_new_tokens` (=30) and `max_length`(=50) seem to have been set. `max_new_tokens` will take precedence. Please refer to the documentation for more information. (https://huggingface.co/docs/transformers/main/en/main_classes/text_generation)\n"
|
| 360 |
]
|
| 361 |
},
|
|
|
|
| 365 |
"text": [
|
| 366 |
"\n",
|
| 367 |
"top_k=10:\n",
|
| 368 |
+
" , you might have a few friends who are going to get together and play a game tha...\n"
|
| 369 |
+
]
|
| 370 |
+
},
|
| 371 |
+
{
|
| 372 |
+
"name": "stderr",
|
| 373 |
+
"output_type": "stream",
|
| 374 |
+
"text": [
|
| 375 |
+
"Both `max_new_tokens` (=30) and `max_length`(=50) seem to have been set. `max_new_tokens` will take precedence. Please refer to the documentation for more information. (https://huggingface.co/docs/transformers/main/en/main_classes/text_generation)\n"
|
| 376 |
+
]
|
| 377 |
+
},
|
| 378 |
+
{
|
| 379 |
+
"name": "stdout",
|
| 380 |
+
"output_type": "stream",
|
| 381 |
+
"text": [
|
| 382 |
"\n",
|
| 383 |
"top_k=50:\n",
|
| 384 |
+
" , when I was a kid, children would watch the movies on your computer screen and ...\n"
|
| 385 |
]
|
| 386 |
},
|
| 387 |
{
|
|
|
|
| 397 |
"text": [
|
| 398 |
"\n",
|
| 399 |
"top_p=0.9:\n",
|
| 400 |
+
" , the owners of the ships were full of hope and inspiration. They knew that if t...\n",
|
| 401 |
"\n",
|
| 402 |
"top_p=0.5:\n",
|
| 403 |
+
" , I had been in a relationship with a woman who was a virgin. She was very attra...\n"
|
| 404 |
]
|
| 405 |
}
|
| 406 |
],
|
|
|
|
| 465 |
"name": "stderr",
|
| 466 |
"output_type": "stream",
|
| 467 |
"text": [
|
| 468 |
+
"Passing `generation_config` together with generation-related arguments=({'pad_token_id', 'repetition_penalty', 'temperature', 'max_new_tokens', 'do_sample'}) is deprecated and will be removed in future versions. Please pass either a `generation_config` object OR all generation parameters explicitly, but not both.\n",
|
| 469 |
"Both `max_new_tokens` (=80) and `max_length`(=50) seem to have been set. `max_new_tokens` will take precedence. Please refer to the documentation for more information. (https://huggingface.co/docs/transformers/main/en/main_classes/text_generation)\n"
|
| 470 |
]
|
| 471 |
},
|
|
|
|
| 490 |
"text": [
|
| 491 |
"\n",
|
| 492 |
"No penalty (repetition_penalty=1.0):\n",
|
| 493 |
+
" it had sold the $13.9 million stake in the business to an undisclosed buyer.\n",
|
| 494 |
"\n",
|
| 495 |
+
"The company's stock has fallen to $19.55 ...\n",
|
| 496 |
"\n",
|
| 497 |
"Penalty 1.3 (repetition_penalty=1.3):\n",
|
| 498 |
+
" it had acquired the rights to run a high-tech communications service, Voice of America.\n",
|
| 499 |
+
"\n",
|
| 500 |
+
"\n",
|
| 501 |
+
" (Photo: Google) Story Highli...\n"
|
| 502 |
]
|
| 503 |
}
|
| 504 |
],
|
|
|
|
| 657 |
"output_type": "stream",
|
| 658 |
"text": [
|
| 659 |
"* Running on local URL: http://127.0.0.1:7860\n",
|
| 660 |
+
"* Running on public URL: https://286b750b9905015c55.gradio.live\n",
|
| 661 |
"\n",
|
| 662 |
"This share link expires in 1 week. For free permanent hosting and GPU upgrades, run `gradio deploy` from the terminal in the working directory to deploy to Hugging Face Spaces (https://huggingface.co/spaces)\n"
|
| 663 |
]
|
|
|
|
| 665 |
{
|
| 666 |
"data": {
|
| 667 |
"text/html": [
|
| 668 |
+
"<div><iframe src=\"https://286b750b9905015c55.gradio.live\" width=\"100%\" height=\"500\" allow=\"autoplay; camera; microphone; clipboard-read; clipboard-write;\" frameborder=\"0\" allowfullscreen></iframe></div>"
|
| 669 |
],
|
| 670 |
"text/plain": [
|
| 671 |
"<IPython.core.display.HTML object>"
|
|
|
|
| 944 |
"text": [
|
| 945 |
"\n",
|
| 946 |
"Prompt: Write a professional email starting with: Dear hir...\n",
|
| 947 |
+
"Output: I'm looking for a project manager, I'm looking for a project manager who can help me to get started...\n"
|
| 948 |
]
|
| 949 |
},
|
| 950 |
{
|
|
|
|
| 960 |
"text": [
|
| 961 |
"\n",
|
| 962 |
"Prompt: Create a product description for: A smart water bo...\n",
|
| 963 |
+
"Output: you can use to test your drink. You can add or remove liquids, fill, or even make an empty bottle. ...\n",
|
| 964 |
"\n",
|
| 965 |
"Prompt: Generate a tweet about: The benefits of remote wor...\n",
|
| 966 |
+
"Output: , and the barriers to getting a job when you're not.\n",
|
| 967 |
+
"\n",
|
| 968 |
+
"The benefits of remote work, and the barriers ...\n"
|
| 969 |
]
|
| 970 |
}
|
| 971 |
],
|
|
|
|
| 1011 |
"\n",
|
| 1012 |
"**Q2:** What trade-offs did you make for Spaces deployment?\n",
|
| 1013 |
"\n",
|
| 1014 |
+
"**A2:** Since I am using the free tier of HuggingFace Spaces, I had to use the small version of GPT-2 instead of something like GPT-4 or Llama-3. High-memory GPUs as needed by those models are not available on the free tier. I also needed to stick with Gradio as the SDK for HuggingFace since it creates an interactive UI quickly, for quick deployment to Spaces.\n",
|
| 1015 |
"\n",
|
| 1016 |
"**Q3:** What would you add to make this production-ready?\n",
|
| 1017 |
"\n",
|
| 1018 |
+
"**A3:** A production-ready version of this would probably use a moderation feature to prevent both user input and model output from being accepted. Additionally, the main issue with this model is accuracy. Even the simplest input will produce nonsensical output. Deployment would necessitate a change in the underlying model or further tuning.\n",
|
| 1019 |
"\n",
|
| 1020 |
"**Q4:** Your HuggingFace Spaces URL:\n",
|
| 1021 |
"\n",
|
| 1022 |
+
"**A4:** https://huggingface.co/spaces/AMahapatra1/Example_Text_Generation"
|
| 1023 |
]
|
| 1024 |
},
|
| 1025 |
{
|