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
pfrl_pdddqn
minerl_pdddqn_baseline
Commits
9fe23e97
Commit
9fe23e97
authored
Jul 27, 2020
by
avinash_ummadisingu
Browse files
Initial commit to submit random agent
parent
6cc0b457
Changes
1
Hide whitespace changes
Inline
Side-by-side
train.py
View file @
9fe23e97
...
...
@@ -48,31 +48,33 @@ def main():
# Sample code for illustration, add your training code below
env
=
gym
.
make
(
MINERL_GYM_ENV
)
#
actions = [env.action_space.sample() for _ in range(10)] # Just doing 10 samples in this example
#
xposes = []
#
for _ in range(1):
#
obs = env.reset()
#
done = False
#
netr = 0
actions
=
[
env
.
action_space
.
sample
()
for
_
in
range
(
10
)]
# Just doing 10 samples in this example
xposes
=
[]
for
_
in
range
(
1
):
obs
=
env
.
reset
()
done
=
False
netr
=
0
# # Limiting our code to 1024 steps in this example, you can do "while not done" to run till end
# while not done:
# Limiting our code to 1024 steps in this example, you can do "while not done" to run till end
t
=
0
while
not
done
:
# To get better view in your training phase, it is suggested
# to register progress continuously, example when 54% completed
# aicrowd_helper.register_progress(0.54)
# To fetch latest information from instance manager, you can run below when you want to know the state
#>> parser.update_information()
#>> print(parser.payload)
#
>> parser.update_information()
#
>> print(parser.payload)
# .payload: provide AIcrowd generated json
# Example: {'state': 'RUNNING', 'score': {'score': 0.0, 'score_secondary': 0.0}, 'instances': {'1': {'totalNumberSteps': 2001, 'totalNumberEpisodes': 0, 'currentEnvironment': 'MineRLObtainDiamond-v0', 'state': 'IN_PROGRESS', 'episodes': [{'numTicks': 2001, 'environment': 'MineRLObtainDiamond-v0', 'rewards': 0.0, 'state': 'IN_PROGRESS'}], 'score': {'score': 0.0, 'score_secondary': 0.0}}}}
# .current_state: provide indepth state information avaiable as dictionary (key: instance id)
env
.
act
(
actions
[
t
])
t
+=
1
# Save trained model to train/ directory
# Training 100% Completed
aicrowd_helper
.
register_progress
(
1
)
#
env.close()
env
.
close
()
if
__name__
==
"__main__"
:
...
...
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