zuoxingdong / lagom

lagom: A PyTorch infrastructure for rapid prototyping of reinforcement learning algorithms.
MIT License
373 stars 30 forks source link

make baselines part of lagom #196

Closed CarloLucibello closed 5 years ago

CarloLucibello commented 5 years ago

How am I supposed to run the baselines scripts? For the time being, I'm using sys adding baselines to the import path:

import sys
sys.path.insert(0, '../')
from baselines.vpg.agent import Agent
from baselines.vpg.engine import Engine

Have you considered making baselines part of lagom so that one would simply do

from lagom.baselines.vpg.agent import Agent
from lagom.baselines.vpg.engine import Engine

?

zuoxingdong commented 5 years ago

Hi @CarloLucibello , thanks for the comment ! The current way to run the script is as described in the README.md, i.e.

zuoxingdong commented 5 years ago

I am not sure if it's a good idea to put baselines into lagom, because lagom is a more generic codebase for quick RL research prototyping, that is more general. And baselines is a separated codebase that makes use of lagom to provide high quality standard RL algorithms.

zuoxingdong commented 5 years ago

The general idea of baselines is to treat each algorithm independently but using convenient API designs and training pipeline from lagom.

So I would say the current best & quick way to use it is to enter the folder of the algorithm that you want to build upon with, modify the code as you want, and iterate ideas quickly within that folder.

CarloLucibello commented 5 years ago

Hi @CarloLucibello , thanks for the comment ! The current way to run the script is as described in the README.md, i.e.

  • Enter an algorithm folder, say cd baselines/vpg
  • Run python experiment The problem is that I installed lagom with pip install --user -e . and the baselines module is not detected unless I manually add it to the system path:
    
    [carlo@europa lagom]$ cd baselines/vpg/
    [carlo@europa vpg]$ python experiment.py 
    Unable to init server: Could not connect: Connection refused
    Unable to init server: Could not connect: Connection refused

(experiment.py:108933): Gdk-CRITICAL **: 08:29:08.624: gdk_cursor_new_for_display: assertion 'GDK_IS_DISPLAY (display)' failed Traceback (most recent call last): File "experiment.py", line 25, in from baselines.vpg.agent import Agent ModuleNotFoundError: No module named 'baselines.vpg'



btw: the Gdk error is probably due to the fact that i'm running the script on a remote machine without graphic server
zuoxingdong commented 5 years ago

This looks weird, because I am also using the remote server via ssh connection.

A quick question, have you installed lagom library ? i.e. pip install -e . under lagom root directory

CarloLucibello commented 5 years ago

A quick question, have you installed lagom library ? i.e. pip install -e . under lagom root directory

yes

CarloLucibello commented 5 years ago

On a fresh install and with pip install -e . I didn't run into the problem again, let's close this