Last active
May 25, 2022 13:08
-
-
Save mlabonne/a09be8ee9fc4c59d30520df311610cd9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| obs = env_script.reset() | |
| done = False | |
| # 1. Get wood with the CNN | |
| for i in tqdm(range(3000)): | |
| obs = torch.from_numpy(obs['pov'].transpose(2, 0, 1)[None].astype(np.float32) / 255).cuda() | |
| probabilities = torch.softmax(model(obs), dim=1)[0].detach().cpu().numpy() | |
| action = np.random.choice(action_list, p=probabilities) | |
| obs, reward, done, _ = env_script.step(action) | |
| # 2. Craft stone pickaxe with scripted actions | |
| for action in tqdm(script): | |
| obs, reward, done, _ = env_cnn.step(str_to_act(env_cnn, action)) | |
| env_cnn.release() | |
| env_cnn.play() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment