mirror of
https://github.com/wassname/ray.git
synced 2026-06-29 23:25:24 +08:00
5bc2ba38fd
Co-authored-by: simon-mo <simon.mo@hey.com> Co-authored-by: Richard Liaw <rliaw@berkeley.edu> Co-authored-by: Alex Wu <itswu.alex@gmail.com>
26 lines
493 B
Python
26 lines
493 B
Python
#!/usr/bin/env python
|
|
|
|
import sys
|
|
|
|
import ray
|
|
from ray.tune import register_trainable, run_experiments
|
|
|
|
|
|
def f(config, reporter):
|
|
reporter(timesteps_total=1)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
ray.init(num_cpus=2)
|
|
|
|
register_trainable("my_class", f)
|
|
run_experiments({
|
|
"test": {
|
|
"run": "my_class",
|
|
"stop": {
|
|
"training_iteration": 1
|
|
}
|
|
}
|
|
})
|
|
assert "ray.rllib" not in sys.modules, "RLlib should not be imported"
|