Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update gym.jl #1009

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

SimonHashtag
Copy link

Make gym.jl compatible with current version of Gymnasium - truncation and termination info instead of done

PR Checklist

  • Update NEWS.md?
  • Unit tests for all structs / functions? (RLBase.test_runnable! only tests is_terminated function, not is_truncated)
  • Integration and correctness tests using a simple env?
  • PR Review?
  • Add or update documentation?
  • Write docstrings for new methods?

Make gym.jl compatible with current version of Gymnasium - truncation and termination info instead of done
@jeremiahpslewis
Copy link
Member

┌ Warning: Error requiring `PyCall` from `ReinforcementLearningEnvironments`
│   exception =
│    LoadError: UndefVarError: `is_truncated` not defined
│    Stacktrace:
│      [1] getproperty(x::Module, f::Symbol)
│        @ Base ./Base.jl:31
│      [2] top-level scope
│        @ 

Copy link
Member

@jeremiahpslewis jeremiahpslewis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, one question…

Postpone on how to handle is_truncated/is_terminated to later PR. If isterminated or istruncated return true for function is_terminated
@jeremiahpslewis jeremiahpslewis enabled auto-merge (squash) March 1, 2024 17:59
@jeremiahpslewis
Copy link
Member

CI is now more or less stable, the only remaining error seems related to your changes:

gym envs: Error During Test at /home/runner/work/ReinforcementLearning.jl/ReinforcementLearning.jl/src/ReinforcementLearningEnvironments/test/environments/3rd_party/gym.jl:1
  Got exception outside of a @test
  MethodError: no method matching split(::PyObject, ::Char)
  
  Closest candidates are:
    split(::T, ::Any; limit, keepempty) where T<:AbstractString
     @ Base strings/util.jl:626
  
  Stacktrace:
    [1] (::ReinforcementLearningEnvironments.var"#161#163"{Vector{String}})(x::PyObject)
      @ ReinforcementLearningEnvironments ./none:0
    [2] iterate(::Base.Iterators.Filter{ReinforcementLearningEnvironments.var"#161#163"{Vector{String}}, Base.ValueIterator{Dict{Any, Any}}})
      @ Base.Iterators ./iterators.jl:518
    [3] iterate
      @ ./generator.jl:44 [inlined]
    [4] grow_to!(dest::Vector{Any}, itr::Base.Generator{Base.Iterators.Filter{ReinforcementLearningEnvironments.var"#161#163"{Vector{String}}, Base.ValueIterator{Dict{Any, Any}}}, ReinforcementLearningEnvironments.var"#160#162"})
      @ Base ./array.jl:907
    [5] collect(itr::Base.Generator{Base.Iterators.Filter{ReinforcementLearningEnvironments.var"#161#163"{Vector{String}}, Base.ValueIterator{Dict{Any, Any}}}, ReinforcementLearningEnvironments.var"#160#162"})
      @ Base ./array.jl:831
    [6] list_gym_env_names(; modules::Vector{String})
      @ ReinforcementLearningEnvironments ~/work/ReinforcementLearning.jl/ReinforcementLearning.jl/src/ReinforcementLearningEnvironments/src/environments/3rd_party/gym.jl:161
    [7] list_gym_env_names
      @ ~/work/ReinforcementLearning.jl/ReinforcementLearning.jl/src/ReinforcementLearningEnvironments/src/environments/3rd_party/gym.jl:134 [inlined]
    [8] macro expansion
      @ ~/work/ReinforcementLearning.jl/ReinforcementLearning.jl/src/ReinforcementLearningEnvironments/test/environments/3rd_party/gym.jl:2 [inlined]
    [9] macro expansion
      @ /opt/hostedtoolcache/julia/1.10.2/x64/share/julia/stdlib/v1.10/Test/src/Test.jl:1577 [inlined]
   [10] top-level scope
      @ ~/work/ReinforcementLearning.jl/ReinforcementLearning.jl/src/ReinforcementLearningEnvironments/test/environments/3rd_party/gym.jl:2
   [11] include
      @ ./client.jl:489 [inlined]
   [12] macro expansion
      @ ~/work/ReinforcementLearning.jl/ReinforcementLearning.jl/src/ReinforcementLearningEnvironments/test/environments/3rd_party/3rd_party.jl:5 [inlined]
   [13] macro expansion
      @ /opt/hostedtoolcache/julia/1.10.2/x64/share/julia/stdlib/v1.10/Test/src/Test.jl:1577 [inlined]
   [14] top-level scope
      @ ~/work/ReinforcementLearning.jl/ReinforcementLearning.jl/src/ReinforcementLearningEnvironments/test/environments/3rd_party/3rd_party.jl:3
   [15] include(fname::String)
      @ Base.MainInclude ./client.jl:489
   [16] top-level scope
      @ ~/work/ReinforcementLearning.jl/ReinforcementLearning.jl/src/ReinforcementLearningEnvironments/test/environments/environments.jl:2
   [17] include(fname::String)
      @ Base.MainInclude ./client.jl:489
   [18] macro expansion
      @ ~/work/ReinforcementLearning.jl/ReinforcementLearning.jl/src/ReinforcementLearningEnvironments/test/runtests.jl:20 [inlined]
   [19] macro expansion
      @ /opt/hostedtoolcache/julia/1.10.2/x64/share/julia/stdlib/v1.10/Test/src/Test.jl:1577 [inlined]
   [20] top-level scope
      @ ~/work/ReinforcementLearning.jl/ReinforcementLearning.jl/src/ReinforcementLearningEnvironments/test/runtests.jl:20
   [21] include(fname::String)
      @ Base.MainInclude ./client.jl:489
   [22] top-level scope
      @ none:6
   [23] eval
      @ ./boot.jl:385 [inlined]
   [24] exec_options(opts::Base.JLOptions)
      @ Base ./client.jl:291
   [25] _start()
      @ Base ./client.jl:552

@jeremiahpslewis
Copy link
Member

@SimonHashtag Are you still working on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants