Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -36,7 +36,7 @@ model.load_state_dict(state_dict)
|
|
| 36 |
model.to(device)
|
| 37 |
model = torch.compile(model)
|
| 38 |
|
| 39 |
-
def generateText(inputText
|
| 40 |
start_tokens = enc.encode(inputText)
|
| 41 |
# print(start_tokens, len(start_tokens))
|
| 42 |
start_tokens = torch.tensor(start_tokens)
|
|
@@ -67,19 +67,13 @@ def generateText(inputText="JULIET\n", num_tokens=500):
|
|
| 67 |
decoded = enc.decode(tokens)
|
| 68 |
return decoded
|
| 69 |
|
| 70 |
-
title = "GPT from Scratch
|
| 71 |
-
description = "GPT
|
| 72 |
examples = [["ROMEO:\nWith love's light wings did I o'er-perch these walls;\nFor stony limits cannot hold love out,\nAnd what love can do that dares love attempt;\nTherefore thy kinsmen are no let to me.\n", 500],
|
| 73 |
-
["ROMEO:\n", 500],
|
| 74 |
-
["JULIET:\n", 500],
|
| 75 |
["CAPULET:\nWhy, how now, kinsman! wherefore storm you so?\n", 500],
|
| 76 |
["KING RICHARD II:\nAy, hand from hand, my love, and heart from heart.\nAnd", 500],
|
| 77 |
-
["KING RICHARD II:\n", 500],
|
| 78 |
-
["CAPULET:\n", 500],
|
| 79 |
["QUEEN:\nBanish us both and send the king with me.\nAnd", 500],
|
| 80 |
-
["
|
| 81 |
-
["CORIOLANUS:\n", 500],
|
| 82 |
-
["MENENIUS:\n", 500]
|
| 83 |
]
|
| 84 |
|
| 85 |
demo = gr.Interface(
|
|
|
|
| 36 |
model.to(device)
|
| 37 |
model = torch.compile(model)
|
| 38 |
|
| 39 |
+
def generateText(inputText, num_tokens=500):
|
| 40 |
start_tokens = enc.encode(inputText)
|
| 41 |
# print(start_tokens, len(start_tokens))
|
| 42 |
start_tokens = torch.tensor(start_tokens)
|
|
|
|
| 67 |
decoded = enc.decode(tokens)
|
| 68 |
return decoded
|
| 69 |
|
| 70 |
+
title = "GPT-2 Trained from Scratch"
|
| 71 |
+
description = "GPT-2 trained on scratch on TinyShakespeare dataset"
|
| 72 |
examples = [["ROMEO:\nWith love's light wings did I o'er-perch these walls;\nFor stony limits cannot hold love out,\nAnd what love can do that dares love attempt;\nTherefore thy kinsmen are no let to me.\n", 500],
|
|
|
|
|
|
|
| 73 |
["CAPULET:\nWhy, how now, kinsman! wherefore storm you so?\n", 500],
|
| 74 |
["KING RICHARD II:\nAy, hand from hand, my love, and heart from heart.\nAnd", 500],
|
|
|
|
|
|
|
| 75 |
["QUEEN:\nBanish us both and send the king with me.\nAnd", 500],
|
| 76 |
+
["CORIOLANUS:\n", 500]
|
|
|
|
|
|
|
| 77 |
]
|
| 78 |
|
| 79 |
demo = gr.Interface(
|