Package: silg
SILGThis repository contains source code for the Situated Interactive Language Grounding (SILG) benchmark.
If you find this work helpful, please consider citing this work:@inproceedings{ zhong2021silg,
  title={ {SILG}: The Multi-environment Symbolic InteractiveLanguage Grounding Benchmark },
  author={ Victor Zhong and Austin W. Hanjie and Karthik Narasimhan and Luke Zettlemoyer },
  booktitle={ NeurIPS },
  year={ 2021 }
}Please also consider citing the individual tasks included in SILG.
They areRTFM,Messenger,NetHack Learning Environment,AlfWorld, andTouchdown.RTFMMessengerSILGNethackALFWorldSILGSymTouchdownHow to installYou have to install the individual environments in order for SILG to work.
The GitHub repository for each environment are found atRTFMMessengerNetHackAlfworldSym and VisTouchdown are included in this repositoryOur dockerfile also provides an example of how to install the environments in Ubuntu.
You can also try using ourinstall_envs.sh, which has only been tested in Ubuntu and MacOS.bash install_envs.shOnce you have installed the individual environments, install SILG as followspip install -r requirements.txt
pip install -e .Some environments have (potentially a large quantity of) data files. Please download these viabash download_env_data.sh  # if you do not want to use VisTouchdown, feel free to comment out its very large feature fileAs a part of this download, we will symlink a./cachedirectory from./mycache.
SILG environments will pull data files from this directory.
If you are on NFS, you might want to movemycacheto local disk and then relink thecachedirectory to avoid hitting NFS.DockerWe provide a Docker container for this project.
You can build the Docker image viadocker build -t vzhong/silg . -f docker/Dockerfile.
Alternatively you can pull my build fromdocker pull vzhong/silg.
This contains the environments as well as SILG, but doesn't contain the large data download.
You will still have to download the environment data and then mount the cache folder to the container.
You may need to specify--platform linux/amd64to Docker if you are running a M1 Mac.Because some of the environments require that you install them first before downloading their data files, you want to download using the Docker container as well.
You can dodocker run --rm --user "$(id -u):$(id -g)" -v $PWD/download_env_data.sh:/opt/silg/download_env_data.sh -v $PWD/mycache:/opt/silg/cache vzhong/silg bash download_env_data.shOnce you have downloaded the environment data, you can use the container by doing something likedocker run --rm --user "$(id -u):$(id -g)" -it -v $PWD/mycache:/opt/silg/cache vzhong/silg /bin/bashVisualizing environmentsWe provide a script to play SILG environments in the terminal.
You can access it viasilg_play --env silg:rtfm_train_s1-v0  # use -h to see options

# docker variant
docker run --rm -it -v $PWD/mycache:/opt/silg/cache vzhong/silg silg_play --env silg:rtfm_train_s1-v0These recordings are shown at the start of this document and are created usingasciinema.How to run experimentsThe entrypoint to experiments isrun_exp.py.
We provide a slurm script to run experiments inlaunch.py.
These scripts can also run jobs locally (e.g. without slurm).
For example, to run RTFM:python launch.py --local --envs rtfmYou can also log to WanDB with the--wandboption.
For more, use the-hflag.How to add a new environmentFirst, create a wrapper class insilg/envs/<your env>.py.
This wrapper will wrap the real environment and provide APIs used by the baseline models and the training script.silg/envs/rtfm.pycontains an example of how to do this for RTFM.
Once you have made the wrapper, don't forget to include its file insilg/envs/__init__.py.The wrapper class must subclasssilg.envs.base.SILGEnvand implement:# return the list of text fields in the observation space
def get_text_fields(self):
    ...

# return max number of actions
def get_max_actions(self):
    ...

# return observation space
def get_observation_space(self):
    ...

# resets the environment
def my_reset(self):
    ...

# take a step in the environment
def my_step(self, action):
    ...Additionally, you may want to implemnt rendering functions such asrender_grid,parse_user_action, andget_user_actionsso that it can be played withsilg_play.NoteThere is an implementation detail right now in that the Torchbeast code considers a "win" to be equivalent to the environment returning a reward>0.8. We hope to change this in the future (likely by adding another tensor field denoting win state) but please keep this in mind when implementing your environment. You likely want to keep the reward between -1 and +1, which high rewards >0.8 reserved for winning if you would like to use the training code as-is.ChangelogVersion 1.0Initial release.