Update CM20315_Transformers.ipynb
This commit is contained in:
@@ -175,7 +175,7 @@
|
|||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"source": [
|
"source": [
|
||||||
"# TODO Modify the code below by changeing the number of tokens generated and the initial sentence\n",
|
"# TODO Modify the code below by changing the number of tokens generated and the initial sentence\n",
|
||||||
"# to get a feel for how well this works. Since I didn't reset the seed, it will give a different\n",
|
"# to get a feel for how well this works. Since I didn't reset the seed, it will give a different\n",
|
||||||
"# answer every time that you run it.\n",
|
"# answer every time that you run it.\n",
|
||||||
"\n",
|
"\n",
|
||||||
@@ -253,7 +253,7 @@
|
|||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"source": [
|
"source": [
|
||||||
"# TODO Modify the code below by changeing the number of tokens generated and the initial sentence\n",
|
"# TODO Modify the code below by changing the number of tokens generated and the initial sentence\n",
|
||||||
"# to get a feel for how well this works. \n",
|
"# to get a feel for how well this works. \n",
|
||||||
"\n",
|
"\n",
|
||||||
"# TODO Experiment with changing this line:\n",
|
"# TODO Experiment with changing this line:\n",
|
||||||
@@ -471,7 +471,7 @@
|
|||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"source": [
|
"source": [
|
||||||
"# This routine reutnrs the k'th most likely next token.\n",
|
"# This routine returns the k'th most likely next token.\n",
|
||||||
"# If k =0 then it returns the most likely token, if k=1 it returns the next most likely and so on\n",
|
"# If k =0 then it returns the most likely token, if k=1 it returns the next most likely and so on\n",
|
||||||
"# We will need this for beam search\n",
|
"# We will need this for beam search\n",
|
||||||
"def get_kth_most_likely_token(input_tokens, model, tokenizer, k):\n",
|
"def get_kth_most_likely_token(input_tokens, model, tokenizer, k):\n",
|
||||||
|
|||||||
Reference in New Issue
Block a user