Skip to main content

ScienceWorld: An interactive text environment to study AI agents on accomplishing tasks from the standardized elementary science curriculum.

Project description

ScienceWorld

ScienceWorld is a text-based virtual environment centered around accomplishing tasks from the standardized elementary science curriculum. This code accompanies the paper ScienceWorld: Is your Textual Agent Smarter than a 5th grader?.

Examples

Read some of the playthrough transcripts available at: https://sciworld.apps.allenai.org/explore

Citation

@misc{scienceworld2022,
    title={ScienceWorld: Is your Agent Smarter than a 5th Grader?},
    author={Ruoyao Wang and Peter Jansen and Marc-Alexandre C{\^o}t{\'e} and Prithviraj Ammanabrolu},
    year={2022},
    eprint={2203.07540},
    archivePrefix={arXiv},
    primaryClass={cs.CL},
    url={https://arxiv.org/abs/2203.07540}
}

Quickstart

Before running: You will have to have Java 1.8+ installed on your system (shipped with most linux distributions).

Install with pip:

conda create --name scienceworld python=3.8
conda activate scienceworld
pip install scienceworld

Run an example random agent, on task 13 (classification: place a non-living thing in a box), for 5 episodes:

python examples/random_agent.py --task-num=13 --num-episodes=5 --simplifications-preset easy

Run a user console where you can interact with the environment, on task 3 (change of state: melting):

python examples/human.py --task-num=3 --num-episodes=5

Web Server Demo

A web server demo is also available, that allows running a ScienceWorld user console that can be interacted with in a web browser.

To run the web server demo:

conda create --name scienceworld python=3.8
conda activate scienceworld
pip install scienceworld[webserver]

Run the web server:

python examples/scienceworld-web-server-example.py

Point your web browser to: localhost:8080

ScienceWorld Design

ScienceWorld is written in Scala (2.12.9), and compiles using sbt into a JAR file that is run with java. For convenience, a python API is provided, which interfaces using the py4j package.

Ports: ScienceWorld is nominally run as a server, which interfaces to the Python API with py4j through a port. The default port is 25335. The actual port used will be 25335 + the thread number provided when a ScienceWorld class is instantiated.

Threads: ScienceWorld is designed to run many threads simultaneously, if desired. To do so, initialize one ScienceWorldEnv object per thread, and provide a unique threadNum for each thread. Don't forget to close down servers that you instantiate using the env.shutdown() command. If you are spawning many threads (10+) at the same time, you may wish to add a short delay (5-10 seconds) after initialization to wait for all the servers to initialize.

Tasks

The subtasks and their associated subtask indices are listed below. Subtask indices are automatically assigned by sorting task names:

SubTask # Task Name
0 task-1-boil
1 task-1-change-the-state-of-matter-of
2 task-1-freeze
3 task-1-melt
4 task-10-measure-melting-point-(known-substance)
5 task-10-measure-melting-point-(unknown-substance)
6 task-10-use-thermometer
7 task-2-power-component
8 task-2-power-component-(renewable-vs-nonrenewable-energy)
9 task-2a-test-conductivity
10 task-2a-test-conductivity-of-unknown-substances
11 task-3-find-animal
12 task-3-find-living-thing
13 task-3-find-non-living-thing
14 task-3-find-plant
15 task-4-grow-fruit
16 task-4-grow-plant
17 task-5-chemistry-mix
18 task-5-chemistry-mix-paint-(secondary-color)
19 task-5-chemistry-mix-paint-(tertiary-color)
20 task-6-lifespan-(longest-lived)
21 task-6-lifespan-(longest-lived-then-shortest-lived)
22 task-6-lifespan-(shortest-lived)
23 task-7-identify-life-stages-1 (animal)
24 task-7-identify-life-stages-2 (plant)
25 task-8-inclined-plane-determine-angle
26 task-8-inclined-plane-friction-(named-surfaces)
27 task-8-inclined-plane-friction-(unnamed-surfaces)
28 task-9-mendellian-genetics-(known-plant)
29 task-9-mendellian-genetics-(unknown-plant)

Baseline Agents

Coming soon!

Additional Documentation

Coming soon!

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

scienceworld-1.0.2.tar.gz (7.3 MB view details)

Uploaded Source

Built Distribution

scienceworld-1.0.2-py3-none-any.whl (7.3 MB view details)

Uploaded Python 3

File details

Details for the file scienceworld-1.0.2.tar.gz.

File metadata

  • Download URL: scienceworld-1.0.2.tar.gz
  • Upload date:
  • Size: 7.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.7

File hashes

Hashes for scienceworld-1.0.2.tar.gz
Algorithm Hash digest
SHA256 839e5cc369e2d7905749bcf166496af81064be0d7a6f995b17da8e5ef0792f32
MD5 2d5d6e109b326651985dbb3929fce305
BLAKE2b-256 ed780062eb72f306d40102cb8644bda472c165cb08cc5ad4880eedb6c05dc919

See more details on using hashes here.

File details

Details for the file scienceworld-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: scienceworld-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 7.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.7

File hashes

Hashes for scienceworld-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 112d91db0f2f0d60ea80e7ea20f79ae8b78ef7a57f60a37e35abb787682fe695
MD5 b79a0de5cae2a5e392992b74d6af6491
BLAKE2b-256 271f2ee80116cc5d9c4965bbbfec8ffb39d2fee423fa73b7d6773dcea33dd560

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