This repository has been archived by the owner on May 21, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
Please add / document how to access observation and action spaces #41
Comments
function show_box_space(s)
shape = s.shape
dtype = pystr(s.dtype)
target_type = occursin("int", dtype) ? Int : Float
high = map(target_type, Array(s.high))
low = map(target_type, Array(s.low))
println("Box$shape")
@show dtype
@show high[1]
@show low[1]
return Dict("kind"=>"Box", "shape"=>shape, "dtype"=>dtype, "high"=>high, "low"=>low)
end
function show_discrete_space(s)
n = s.n
println("Discrete($n)")
return Dict("kind"=>"Discrete", "n"=>n)
end
function show_space(s)
space_repr = pystr(s)
if occursin("Discrete", space_repr)
return show_discrete_space(s)
elseif occursin("Box", space_repr)
return show_box_space(s)
else
print("WARNING: $space_repr unsupported!!!!1")
end
end
function show_spaces(env_name)
env = GymEnv(env_name)
@show env_name
println()
println("Observation Space:")
observation_space_dict = show_space(env.pyenv.observation_space)
println()
println("Action Space:")
action_space_dict = show_space(env.pyenv.action_space)
println()
close(env)
env_dict = Dict("name"=>env_name, "observation_space"=>observation_space_dict, "action_space"=>action_space_dict)
return env_dict
end
env_names = ["procgen:procgen-$stub-v0" for stub in ["bigfish","bossfight","caveflyer","chaser","climber","coinrun","dodgeball","fruitbot",
"heist","jumper","leaper","maze","miner","ninja","plunder","starpilot"]]
[show_spaces(env_name) for env_name in env_names] ^^^ I just wrote this. MIT License |
Here is the result for all of the ProcGen envs:
|
Hi @bionicles, |
sorry, i'm not working in julia right now, but you're welcome to reuse the code |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
For architecture search across a variety of environments, it's crucial to access the parameters of the observation and action spaces.
How do you do that with this library?
The text was updated successfully, but these errors were encountered: