Skip to content
This repository was archived by the owner on May 21, 2022. It is now read-only.

Conversation

@JobJob
Copy link
Member

@JobJob JobJob commented Sep 14, 2018

Fairly minimal set of changes to get this running on 1.0, and still maintain compatibility with 0.6 for now.

Required for JuliaML/OpenAIGym.jl#10 to work.

.travis.yml Outdated
- julia -e 'Pkg.clone(pwd()); Pkg.build("Reinforce"); Pkg.test("Reinforce"; coverage=false)'
# script:
# - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi
# - julia -e 'Pkg.clone(pwd()); Pkg.build("Reinforce"); Pkg.test("Reinforce"; coverage=false)'
Copy link
Member

Choose a reason for hiding this comment

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

It's fine to just removing the script section.


function test_ep_iteration()
info("interface::iteration::maxsteps")
@info "interface::iteration::maxsteps"
Copy link
Member

Choose a reason for hiding this comment

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

I think this @info will break the 0.6 support.
(But I'm fine about just dropping 0.6 support.)
Which will you vote fro? dropping or not dropping?

Copy link
Member Author

@JobJob JobJob Sep 17, 2018

Choose a reason for hiding this comment

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

I actually added using Compat: @info here in runtests.jl, so that 0.6 tests pass, but anyway, I think we should drop 0.6 for future changes. I doubt many people, if anyone, are relying on this to work for 0.6.

Copy link
Member

Choose a reason for hiding this comment

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

I doubt many people, if anyone, are relying on this to work for 0.6.

There is a tagged stable release for 0.6. So it's okay to drop 0.6 support now.

Copy link
Member Author

Choose a reason for hiding this comment

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

My OpenAIGym PRs also work on 0.6 btw

Copy link
Member

Choose a reason for hiding this comment

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

oh okay

Copy link
Member Author

@JobJob JobJob Sep 17, 2018

Choose a reason for hiding this comment

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

Oh actually, just checked and JuliaML/OpenAIGym.jl/pull/10 works, but the others don't on 0.6

Copy link
Member

Choose a reason for hiding this comment

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

So, you mean all the PRs are based on 1.0, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, but it's prob a minor change to get them working for 0.6, OTOH 0.6 is old news 😄

Copy link
Member

Choose a reason for hiding this comment

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

well, I will vote for dropping it.

- linux
julia:
- 0.6
- 1.0
Copy link
Member

Choose a reason for hiding this comment

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

and add 0.7?

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok

Copy link
Member Author

Choose a reason for hiding this comment

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

I guess if it works on 1.0 it'll work on 0.7 though?

Copy link
Member

Choose a reason for hiding this comment

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

yeah

@JobJob
Copy link
Member Author

JobJob commented Sep 17, 2018

So what's the verdict you want me to do anything more here?

@iblislin
Copy link
Member

I need some time to test it manually

@iblislin
Copy link
Member

Got this on 0.7

┌ Warning: Deprecated syntax `multiple line breaks between doc string and object` at /home/iblis/.julia/dev/Reinforce/src/Reinforce.jl:74.
│ Use `at most one line break` instead.
└ @ ~/.julia/dev/Reinforce/src/Reinforce.jl:74

patch:

diff --git a/src/Reinforce.jl b/src/Reinforce.jl
index 9ac3681..91a47ad 100644
--- a/src/Reinforce.jl
+++ b/src/Reinforce.jl
@@ -1,6 +1,3 @@
-
-__precompile__(true)
-
 module Reinforce
 
 using Reexport
@@ -70,7 +67,6 @@ finished(env::AbstractEnvironment, s′) = false
 
 Return a list/set/description of valid actions from state `s′`.
 """
-# actions(env::AbstractEnvironment) = actions(env, state(env))
 function actions end
 
 # note for developers: you don't need to implement these if you have state/reward fields

@iblislin
Copy link
Member

WARNING: Base.srand is deprecated: it has been moved to the standard library package `Random`.
Add `using Random` to your imports.                                       
  likely near /home/iblis/.julia/dev/Reinforce/test/env/mountain_car.jl:3                     

patch:

diff --git a/src/envs/mountain_car.jl b/src/envs/mountain_car.jl
index 030fece..803b121 100644
--- a/src/envs/mountain_car.jl
+++ b/src/envs/mountain_car.jl
@@ -6,6 +6,7 @@ module MountainCarEnv

 using Reinforce: AbstractEnvironment
 using LearnBase: DiscreteSet
+using Random: srand
 using RecipesBase
 using Distributions

@iblislin
Copy link
Member

miner change:

diff --git a/src/episodes/iterators.jl b/src/episodes/iterators.jl
index fd906e7..7d8b194 100644
--- a/src/episodes/iterators.jl
+++ b/src/episodes/iterators.jl
@@ -56,8 +56,7 @@ end


 @static if VERSION >= v"0.7"
-  Base.iterate(ep::Episode)    = _next(ep::Episode, _start(ep))
-  Base.iterate(ep::Episode, i) = _next(ep::Episode, i)
+  Base.iterate(ep::Episode, i::Integer = _start(ep)) = _next(ep::Episode, i)
 else
   Base.start(ep::Episode)   = _start(ep)
   Base.next(ep::Episode, i) = _next(ep, i)

@iblislin
Copy link
Member

travis stuffs

diff --git a/.travis.yml b/.travis.yml
index cebc7d0..7270a8e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -4,10 +4,7 @@ os:
   - linux
 julia:
   - 0.6
+  - 0.7
   - 1.0
-  - nightly
-matrix:
-  allow_failures:
-    - julia: nightly
 notifications:
   email: false

@iblislin
Copy link
Member

ah, Base.srand is renamed to Random.seed!
My previous patch is wrong.

I want to drop 0.6 support and just write this

diff --git a/src/envs/mountain_car.jl b/src/envs/mountain_car.jl
index 030fece..0f1f88e 100644
--- a/src/envs/mountain_car.jl
+++ b/src/envs/mountain_car.jl
@@ -6,6 +6,7 @@ module MountainCarEnv
 
 using Reinforce: AbstractEnvironment
 using LearnBase: DiscreteSet
+using Random: seed!
 using RecipesBase
 using Distributions
 
@@ -45,7 +46,7 @@ MountainCar(seed=-1) = MountainCar(MountainCarState(0.0, 0.0), 0.0, seed)
 
 function reset!(env::MountainCar)
   if env.seed >= 0
-    srand(env.seed)
+    seed!(env.seed)
     env.seed = -1
   end
 

else
seed! = srand
end

Copy link
Member

@iblislin iblislin Sep 18, 2018

Choose a reason for hiding this comment

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

Both 0.7 and 1.0 are Random.seed!.
Invoking Random.srand in 0.7 will pop the deprecation warning up.

Copy link
Member Author

Choose a reason for hiding this comment

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

oh, you're right, i don't know how I got the impression that it wasn't.

Copy link
Member

@iblislin iblislin left a comment

Choose a reason for hiding this comment

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

Thanks for your contributions!

@iblislin iblislin merged commit 77e2b17 into JuliaML:master Sep 18, 2018
@JobJob
Copy link
Member Author

JobJob commented Sep 18, 2018

Thank you for taking the time to review!

@JobJob JobJob deleted the fixes-for-1.0 branch September 18, 2018 15:12
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants