pip module for RL agents in SLM Lab

Wah Loon Keng
Sep 5, 2018 · 1 min read

As part of the usability improvement in SLM Lab v2.0.0, we have also made it possible to just use the agents outside of the SLM framework, just like any installed pip module. It is now possible to just do a pip import slm_lab (or as one of the readers pointed out, python setup.py install without pip) and initialize its agents for use.

This is especially crucial for those who want to use these algorithms in an industrial application. Often the app is part of a massive industrial system, and it is difficult or impossible to wrap that inside the lab. The agent must be made into an importable module to be used inside the app, either for training or for inferencing in deployment.

For demonstration, we have created a standalone script to show how to do this. The solution is very lightweight. The proper spec format will initialize the agent as usual, and as long as the proper agent APIs are called, all agent functionalities will work. Of course, to make use of the lab’s full potential such as distributed training, parameter search, data analysis, you would still need to use the Lab.

The implementation below is in fact uses a simplified form of the lab’s original Session class. This shows that the main control loop and API methods are already generic.

Wah Loon Keng

Written by

Deep Reinforcement Learning. Semantics. Rock Climbing. https://github.com/kengz