Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Neural MMO
neural-mmo-starter-kit
Commits
b6c6e170
Commit
b6c6e170
authored
Sep 23, 2021
by
Siddhartha Laghuvarapu
Browse files
Add tqdm bar to rollout.py
parent
c766f1b8
Changes
1
Hide whitespace changes
Inline
Side-by-side
evaluator/rollout.py
View file @
b6c6e170
...
...
@@ -13,6 +13,8 @@ from config import LocalEvaluationConfig
import
random
import
copy
from
tqdm
import
tqdm
class
ProxyEnv
(
Env
):
def
step
(
self
,
actions
,
preprocess
=
set
(),
omitDead
=
True
):
...
...
@@ -75,6 +77,7 @@ def assign_agents(player_agent, opponent_agents):
def
run_episode
(
player_index
,
agents
,
N_TIME_STEPS
):
config
=
projekt
.
config
.
CompetitionRound1
()
config
.
RENDER
=
True
env
=
ProxyEnv
(
config
)
n_steps
=
0
neural_agents
=
set
()
...
...
@@ -92,9 +95,9 @@ def run_episode(player_index, agents, N_TIME_STEPS):
for
entid
in
entids
:
actions
[
entid
]
=
agents
[
entid_agent_map
[
entid
]].
register_reset
(
obs
[
entid
])
alive_agents
=
list
(
obs
.
keys
())
pbar
=
tqdm
(
total
=
N_TIME_STEPS
)
while
len
(
obs
.
keys
())
>
0
and
n_steps
<
N_TIME_STEPS
:
pbar
.
update
(
n
=
1
)
for
entid
in
actions
:
if
entid
not
in
neural_agents
:
realm
=
env
.
realm
...
...
@@ -157,7 +160,7 @@ if __name__ == "__main__":
player_agent
,
opponent_agents
=
load_agents
(
LocalEvaluationConfig
)
player_agent
=
player_agent
[
0
]
N_EPISODES
=
2
N_TIME_STEPS
=
10
N_TIME_STEPS
=
10
24
for
episode
in
range
(
N_EPISODES
):
agents
,
player_index
=
assign_agents
(
player_agent
,
opponent_agents
)
statistics
=
run_episode
(
player_index
,
agents
,
N_TIME_STEPS
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment