Skip to content

I used to drink coffee a lot. But oolong has become my favorite recently. Hope you like it too.πŸ«–

License

Notifications You must be signed in to change notification settings

oolong-dev/Oolong.jl.bak

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Jun 30, 2021
388855f Β· Jun 30, 2021

History

3 Commits
Jun 10, 2021
Jun 30, 2021
Jun 30, 2021
Jun 10, 2021
Jun 10, 2021
Jun 30, 2021
Jun 30, 2021

Repository files navigation

Oolong.jl

An actor framework for ReinforcementLearning.jl

β€œζ˜―ιžζˆθ΄₯转倴空” β€”β€” γ€ŠδΈ΄ζ±Ÿδ»™γ€‹ ζ¨ζ…Ž

"Success or failure, right or wrong, all turn out vain." - The Immortals by the River, Yang Shen

(Translated by Xu Yuanchong)

Roadmap

  • Figure out a set of simple primitives for running distributed applications.
  • Apply this package to some typical RL algorithms:
    • Parameter server
    • Batch serving
      • Add macro to expose a http endpoint
    • A3C
    • D4PG
    • AlphaZero
    • Deep CFR
    • NFSP
    • Evolution algorithms
  • Resource management across nodes
  • State persistence and fault tolerance
  • Configurable logging and dashboard

Get Started

⚠ This package is still under rapid development and is not registered yet.

First install this package:

pkg> activate --temp

pkg> add https://github.com/JuliaReinforcementLearning/Oolong.jl

Oolong.jl adopts the actor model to parallelize your existing code. One of the core APIs defined in this package is the @actor macro.

using Oolong

A = @actor () -> @info "Hello World"

By putting the @actor macro before arbitrary callable object, we defined an actor. And we can call it as usual:

A();

You'll see something like this on your screen:

Info:[2021-06-30 22:59:51](@/user/#1)Hello World

Next, let's make sure anonymous functions with positional and keyword arguments can also work as expected:

A = @actor (msg;suffix="!") -> @info "Hello " * msg * suffix
A("World";suffix="!!!")
# Info:[2021-06-30 23:00:38](@/user/#5)Hello World!!!

For some functions, we are more interested in the returned value.

A = @actor msg -> "Hello " * msg
res = A("World")

Well, different from the general function call, a result similar to Future is returned instead of the real value. We can then fetch the result with the following syntax:

res[]
# "Hello World"

To maintain the internal states across different calls, we can also apply @actor to a customized structure:

Base.@kwdef mutable struct Counter
    n::Int = 0
end

(c::Counter)() = c.n += 1

A = @actor Counter()

for _ in 1:10
    A()
end

n = A.n

n[]
# 10

Note that similar to function call, the return of A.n is also a Future like object.

Tips

  • Be careful with self()

Acknowledgement

This package is mainly inspired by the following packages:

About

I used to drink coffee a lot. But oolong has become my favorite recently. Hope you like it too.πŸ«–

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages