SHOW:
|
|
- or go back to the newest paste.
| 1 | # ORIGINAL CODE | |
| 2 | def play_aidungeon_2(): | |
| 3 | ||
| 4 | console_print("AI Dungeon 2 will save and use your actions and game to continually improve AI Dungeon."
| |
| 5 | + " If you would like to disable this enter 'nosaving' for any action. This will also turn off the " | |
| 6 | + "ability to save games.") | |
| 7 | ||
| 8 | upload_story = True | |
| 9 | ||
| 10 | print("\nInitializing AI Dungeon! (This might take a few minutes)\n")
| |
| 11 | generator = GPT2Generator() | |
| 12 | ||
| 13 | # NEW CODE | |
| 14 | def play_aidungeon_2(): | |
| 15 | ||
| 16 | console_print( | |
| 17 | "\nAI Dungeon 2 will save and use your actions and game to continually improve AI Dungeon." | |
| 18 | + " If you would like to disable this enter 'nosaving' for any action. This will also turn off the " | |
| 19 | + "ability to save games.\n" | |
| 20 | ) | |
| 21 | ||
| 22 | upload_story = True | |
| 23 | ||
| 24 | # "temperature" dictates randomness. A low temperature means that the AI is | |
| 25 | # more likely to go with the word that best fits the context, a high | |
| 26 | # temperature makes the AI more random and it may chose surprising less fitting words | |
| 27 | # original 0.4 | |
| 28 | temp = 0.2 | |
| 29 | ||
| 30 | # lower top_k is a hard limit of "how many fitting words should I consider", | |
| 31 | # i.e. lowering this value also limits the AI in creativity | |
| 32 | # original 40 | |
| 33 | top_k = 20 | |
| 34 | ||
| 35 | console_print("\nBefore we start, would you like to change the default temperature (" + str(temp) + ") and top_k (" + str(top_k) + ") value?\n")
| |
| 36 | choice = input("1) Aeeyup!\n-) Press enter to skip\n>")
| |
| 37 | ||
| 38 | if choice == "1": | |
| 39 | temp = float(input("New temperature: "))
| |
| 40 | top_k = int(input("New top_k: "))
| |
| 41 | ||
| 42 | print("\nInitializing AI Dungeon! (This might take a few minutes)\n")
| |
| 43 | generator = GPT2Generator(60, temp, top_k, 0.9) |