-
Couldn't load subscription status.
- Fork 191
Open
Labels
bugSomething isn't workingSomething isn't working
Description
I've noticed that when randomly sampling actions in real text games (e.g. ZMachine games not generated by TextWorld), the game inevitably freezes/segfaults at some point (It seems like Jericho has the same issue). Since TextWorld is a RL environment for text games, can we make it more robust to these problems? For example, having a timeout failure or game crashed failure?
Here's a code snippet that consistently freezes on my machine:
# !mkdir -p games
# !wget -q http://www.ifarchive.org/if-archive/games/zcode/Balances.z5 -O games/Balances.z5
import textworld
import itertools
import tqdm
import numpy as np
np.random.seed(0)
episodes = 50
episode_len = 500
scores = []
for episode in range(episodes):
print('episode {}'.format(episode))
env = textworld.start('./games/Balances.z5')
env.reset()
env.seed(0)
verbs = [w.word for w in env._jericho.get_dictionary() if w.is_verb]
nouns = [w.word for w in env._jericho.get_dictionary() if w.is_noun]
actions = [' '.join(tup) for tup in list(itertools.product(verbs, nouns))]
for step in tqdm.trange(episode_len):
act = np.random.choice(actions)
print(step, act)
game_state, score, done = env.step(act)
if done:
break
scores.append(score)
print(scores)Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working