Skip to main content

A minimal home gridworld environment to test how agents use language hints.

Project description

A minimal home grid world environment to evaluate language understanding in interactive agents.

🏠 Getting Started

Play as a human:

$ pip install -e .
$ ./homegrid/manual_control.py

Use as a gym environment:

import gym
import homegrid
env = gym.make("homegrid-task")

See homegrid/__init__.py for the environment configurations used in the paper Learning to Model the World with Language.

📑 Documentation

HomeGrid tests whether agents can learn to use language that provides information about the world. In addition to task instructions, the env provides scripted language hints, simulating knowledge that agents might learn from humans (e.g., in a collaborative setting) or read in text (e.g., on Wikipedia). Agents navigate around a house to find objects and interact with them to perform tasks, while learning how to understand language from experience.

⚡️ Quick Info

  • pixel observations (3x3 partial view of the house)
  • discrete action space (movement + object interaction)
  • 3 rooms, 7 objects (3 trash bins, 4 trash objects)
  • multitask with language instructions + hints
  • randomized object placement and object dynamics

Task Templates (38 total tasks):

  • find the object/bin: the agent will receive a reward of 1 if it is facing the correct object / bin
  • get the object: the agent will receive a reward of 1 if it has the correct object in inventory
  • put the object in the bin: the agent will receive a reward of 1 if the bin contains the object
  • move the object to the room: the agent will receive a reward of 1 if the object is in the room
  • open the bin: the agent will receive a reward of 1 if the bin is in the open state

Language Types and Templates

  • Future Observations: descriptions of what agents might observe in the future, such as "The plates are in the kitchen."
    • "object/bin is in the room": the object or bin is in the indicated room
    • "i moved the object to the room": the object has been moved to the room
    • "there will be object in the room": the object will spawn in the room in five timesteps
  • Dynamics: descriptions of environment dynamics, such as "Pedal to open the compost bin."
    • "action to open the bin": the indicated action is the correct action to open the bin
  • Corrections: interactive, task-specific feedback based on what the agent is currently doing, such as "Turn around."
    • "no, turn around": the agent's distance to the current goal object or bin (given the task) has increased compared to the last timestep

Environment instances are provided for task instruction + each of the types above in homegrid/__init__.py.

Language is streamed one token per timestep by default. Some strings are higher priority than others and may interrupt a string that is currently being read. See homegrid/language_wrappers.py.

💻 Development

New development and extensions to the environment are welcome!

Adding new language utterances

Sentences are pre-embedded and cached into a file for training efficiency. You'll have to append the additional sentences to homegrid/homegrid_sentences.txt and re-generate the cached token and embedding file with the following command:

python scripts/embed_offline.py \
    --infile homegrid/homegrid_sentences.txt \
    --outfile homegrid/homecook_embeds.pkl \
    --model t5

Adding new layouts and objects

HomeGrid currently has one layout and a fixed set of objects that are sampled to populate each episode. Many of the receptacles and containers (e.g. cabinets) are disabled for simplicity.

To add new layouts, create a new class in homegrid/layout.py.

To add new static (non-interactive) objects, add assets to homegrid/assets.py and then specify where they are rendered in the homegrid/layout.py.

To add new interactive objects, additionally specify how they behave in homegrid/homegrid_base.py:step.

Acknowledgments

HomeGrid is based on MiniGrid. The environment assets are thanks to limezu and Mounir Tohami.

Citation

@article{lin2023learning,
         title={Learning to Model the World with Language},
         author={Jessy Lin and Yuqing Du and Olivia Watkins and Danijar Hafner and Pieter Abbeel and Dan Klein and Anca Dragan},
         year={2023},
         eprint={2308.01399},
         archivePrefix={arXiv},
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

homegrid-0.1.1.tar.gz (1.3 MB view details)

Uploaded Source

Built Distribution

homegrid-0.1.1-py3-none-any.whl (1.3 MB view details)

Uploaded Python 3

File details

Details for the file homegrid-0.1.1.tar.gz.

File metadata

  • Download URL: homegrid-0.1.1.tar.gz
  • Upload date:
  • Size: 1.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for homegrid-0.1.1.tar.gz
Algorithm Hash digest
SHA256 41890971dc8868626bbdb26a78ee50679d9d30e744c8f474b095b42c84d3fdab
MD5 32ced49902f8fc6dcbb529376d913b46
BLAKE2b-256 4e2a9dedbcf630a90a1fd32d8e771e42eb2aff70c8c6a2204115e069e7d3aaab

See more details on using hashes here.

File details

Details for the file homegrid-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: homegrid-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 1.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for homegrid-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5a8011038388dced3a8452ab131b051cdf153b258ddfe939edc48f3483d213ea
MD5 5b68ea367892c3268fdb7f17b1582ff9
BLAKE2b-256 f5a3ea5843d80f5d117aded1f1b4ddfa6ee0fbefaa1ffabd60c4b71beb71e2c4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page