Code Monkey home page Code Monkey logo

avalon's Introduction

Avalon

Watch the video

What is Avalon?

Avalon is a 3D video game environment and benchmark designed from scratch for reinforcement learning research. In Avalon, an embodied agent (human or computer) explores a procedurally generated 3D environment, attempting to solve tasks that involve navigating terrain, hunting or gathering food, and avoiding hazards.

Avalon is unique among existing RL benchmarks in that the reward function, world dynamics, and action space are the same for every task, with tasks differentiated solely by altering the environment: its 20 tasks, ranging in complexity from eat and throw to hunt and navigate, each creates worlds in which the agent must perform specific skills to survive. This setup enables investigations of generalization within tasks, between tasks, and compositional tasks that require combining skills learned from previous tasks.

Avalon includes a highly efficient game engine, a library of baselines, and a benchmark with scoring metrics evaluated against hundreds of hours of human performance, all of which are open-source and publicly available. In addition, we find that standard RL baselines progress on most tasks but are still far from human performance, suggesting Avalon is challenging enough to advance the quest for generalizable RL.

Check out our research paper for a deeper explanation of why we built Avalon.

Quickstart

Use Avalon like any other gym environment.

from avalon.agent.godot.godot_gym import GodotEnvironmentParams
from avalon.agent.godot.godot_gym import TrainingProtocolChoice
from avalon.agent.godot.godot_gym import AvalonEnv
from avalon.common.log_utils import configure_local_logger
from avalon.datagen.env_helper import display_video

configure_local_logger()

env_params = GodotEnvironmentParams(
    resolution=256,
    training_protocol=TrainingProtocolChoice.SINGLE_TASK_FIGHT,
    initial_difficulty=1,
)
env = AvalonEnv(env_params)
env.reset()

def random_env_step():
    action = env.action_space.sample()
    obs, reward, done, info = env.step(action)
    if done:
        env.reset()
    return obs

observations = [random_env_step() for _ in range(50)]
display_video(observations, fps=10)

notebook output

For a complete example of creating random worlds, taking actions as an agent, and displaying the resulting observations, see gym_interface_example.

Installing

Since we designed Avalon as a high-performance RL environment, we tailored Avalon to run in the cloud on headless Linux servers with NVIDIA GPUs. However, it should also work on macOS.

Avalon relies on a custom Godot binary optimized for headless rendering and performance. If you intend to inspect, debug or build custom levels, you'll also want the accompanying editor:

pip install avalon-rl==1.0.0

# needed to run environments
python -m avalon.install_godot_binary

Note: the binary will be installed in the package under avalon/bin/godot by default to avoid cluttering your system. Pure-pip binary packaging is a work in progress.

Ubuntu

Avalon requires NVIDIA GPU on Linux, as we set up the Linux builds for headless GPU rendering. It requires pytorch>=1.12.0 with CUDA to be installed.

sudo apt install --no-install-recommends libegl-dev libglew-dev libglfw3-dev libnvidia-gl libopengl-dev libosmesa6 mesa-utils-extra
pip install avalon-rl
python -m avalon.install_godot_binary
python -m avalon.common.check_install

If you're looking to use our RL code, you'll additionally need the avalon-rl[train] extras package: pip install avalon-rl[train]

Mac

On Mac, we do not require an NVIDIA GPU, but the environment rendering is not headless - you'll see a godot window pop up for each environment you have open.

brew install coreutils
pip install avalon-rl
python -m avalon.install_godot_binary
python -m avalon.common.check_install

Docker

We also have Docker images to run Avalon and train our RL baselines. They require an NVIDIA GPU on the host.

Training image

docker build -f ./docker/Dockerfile . --target train --tag=avalon/train

# start the container with an interactive bash terminal
# to enable wandb, add `-e WANDB_API_KEY=<your wandb key>`
docker run -it --gpus 'all,"capabilities=compute,utility,graphics"' avalon/train bash

# in the container, try running
python -m avalon.common.check_install

# or launch, e.g., a PPO training run with
python -m avalon.agent.train_ppo_avalon

Dev image

You can use the dev image to explore the bundled notebooks or to build on top of Avalon

docker build -f ./docker/Dockerfile . --target dev --tag=avalon/dev

# The default dev image command starts a Jupyter Notebook and exposes it on port 8888.
# A typical dev setup is to expose that notebook and map the local repo to the project repo as a volume:
docker run -it -p 8888:8888 -v $(pwd):/opt/projects/avalon --gpus 'all,"capabilities=compute,utility,graphics"' avalon/dev 

Tutorials

Using Avalon in your own RL code:

Using our RL library:

Building on Avalon or creating new tasks:

Resources

We can find the final baseline model weights in the results notebook.

Citing Avalon

@inproceedings{avalon,
    title={Avalon: A Benchmark for {RL} Generalization Using Procedurally Generated Worlds},
    author={Joshua Albrecht and Abraham J Fetterman and Bryden Fogelman and Ellie Kitanidis and Bartosz Wr{\'o}blewski and Nicole Seo and Michael Rosenthal and Maksis Knutins and Zachary Polizzi and James B Simon and Kanjun Qiu},
    booktitle={Thirty-sixth Conference on Neural Information Processing Systems Datasets and Benchmarks Track},
    year={2022},
    url={https://openreview.net/forum?id=TzNuIdrHoU}
}

License

  • Human rollout dataset: CC-BY-SA 4.0
  • Modifications to the Godot engine: MIT
  • All code in this repository and all other associated resources (model checkpoints, etc.): GPLv3

About Generally Intelligent

Avalon was developed by Generally Intelligent, an independent research company developing general-purpose AI agents with human-like intelligence that we can safely deploy in the real world. Check out our about page to learn more, or our careers page if you're interested in working with us!

avalon's People

Contributors

abefetterman avatar bai-generally-intelligent avatar bawr avatar brydenfogelman avatar elijas avatar joshalbrecht avatar lloydchang avatar lucky-bai avatar micimize avatar mx781 avatar timokau avatar tleyden avatar zplizzi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

avalon's Issues

Dockerfile plus instructions for running container hide install

Apologies if I got the intent wrong...please clarify if so...
here's the issue:

The Dockerfile copies the repo for avalon to /opt/projects/

COPY . /opt/projects/avalon
RUN pip install -e /opt/projects/avalon

Then, godot is installed in /opt/projects/avalon as follows:

RUN python -m avalon.install_godot_binary

Then, workspace is set to /opt/projects/avalon and, per instructions from the readme, maps $pwd to /opt/projects/avalon:

WORKDIR /opt/projects/avalon
docker run -it -p 8888:8888 -v $(pwd):/opt/projects/avalon --gpus 'all,"capabilities=compute,utility,graphics"' avalon/dev 

The effect of this is to mount the current working directory as /opt/projects/avalon, thereby hiding the install by overlaying $pwd as /opt/projects/avalon

Evaluation on Test Worlds

Hi!

Thank you for the great codebase!
I ran into some errors when evaluating on the testworlds mentioned in the paper.
I trained an agent using your codebase and want to evaluate it on the testworlds as used in the paper.
Training went seamlessly on an A100.
Then I followed the step-by-step guide in the README, but I am getting a shader-related error:

2023-01-09 18:19:07.696 | ERROR | avalon.datagen.godot_env.interactive_godot_process:_raise_godot_error:108 - Godot error: Cannot open file 'res://Shaders/BasicColor.material'.

I attached the full stack trace here: stacktrace.log
Are there maybe some resource files missing in order to evaluate on the test worlds?

configure_local_logger() call missing from gym_interface_example.sync.ipynb

The first tutorial in the main README.md points to gym_interface_example.sync.ipynb
Running this code will complain about computronium

This is because the call to configure_local_logger() after the imports is missing. inserting that call fixes the issue.

As a side note, it seems that all the dot ipynb files' first cells type is not 'code' and hence need to be set on first open.

Installation failure due to weak specification of trimesh version

Loosely specified "trimesh[easy] >= 3.15.5" fails with default pip solver. Had to install trimesh[easy]==3.15.5. Please consider pinning the version. Error is:

ERROR: Could not find a version that satisfies the requirement embreex; extra == "easy" (from trimesh[easy]>=3.15.5->avalon-rl) (from versions: none)
ERROR: No matching distribution found for embreex; extra == "easy" (from trimesh[easy]>=3.15.5->avalon-rl)

This is inside a fresh docker with base nvcr.io/nvidia/cuda:11.7.1-runtime-ubuntu20.04

Missing dm-tree package in docker install

Running the docker image creation with the following from the README.md, results in a trace due to missing dm-tree install

docker build -f ./docker/Dockerfile . --target dev --tag=avalon/dev
...
Step 14/18 : RUN python -m avalon.install_godot_binary
 ---> Running in 972ac7f2e8d9
Traceback (most recent call last):
  File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/opt/projects/avalon/avalon/install_godot_binary.py", line 16, in <module>
    from avalon.datagen.godot_env.interactive_godot_process import GODOT_BINARY_PATH
  File "/opt/projects/avalon/avalon/datagen/godot_env/interactive_godot_process.py", line 32, in <module>
    from avalon.datagen.world_creation.world_generator import GenerateAvalonWorldParams
  File "/opt/projects/avalon/avalon/datagen/world_creation/world_generator.py", line 30, in <module>
    from avalon.agent.common.util import setup_new_process
  File "/opt/projects/avalon/avalon/agent/common/util.py", line 20, in <module>
    from tree import map_structure
ModuleNotFoundError: No module named 'tree'

Inserting pip install dm-tree corrects the issue:

COPY . /opt/projects/avalon
RUN pip install -e /opt/projects/avalon
+RUN pip install dm-tree
RUN python -m avalon.install_godot_binary

Can it run multiple agents?

Hi, this is an amazing piece of work, we study reinforcement learning is often highly constrained from the environment, I wonder if it supports multi-agent collaboration? It would be perfect if it could!

Evaluation World IDs

The world id's that are being downloaded in your evaluation script

human_scores = json.loads(s3_client.load(human_scores_key))

do not match the world id's you provide for your downloadable worlds here:

https://github.com/Avalon-Benchmark/avalon/blob/main/docs/avalon_baselines.md#reproducing-our-paper-results

They substantially differ, e.g. the the id's from your evaluation script are 6 digits ('542584') vs 12 digits for the downloaded worlds ('201108062007').
Further the downloadable set contains 1024 worlds, but there are only 1000 worlds listed in the scores downloaded by the evaluation script.

It seems that either the id's have changed at some point, or the downloadable set of worlds is not equal to the ones used for your evaluation.
Maybe I am missing something here?

License

Hi,

thank you for your work on this, it looks great at first glance! I'm wondering what the license for the simulator and the baseline agents is. Could you clarify and maybe add a LICENSE file?

Check_install fails for Mac

I am following the installation instructions for Mac and command python -m avalon.common.check_install gives the following output/error:

2023-09-18 16:05:41.150 | INFO     | __main__:fetch_binary:92 - Downloading 3.4.4.avalon.0.9.3/macos-editor.zip into /Users/enis/miniconda3/envs/avalon/lib/python3.10/site-packages/avalon/bin/godot_editor
2023-09-18 16:05:43.707 | INFO     | __main__:install_available_binaries_for_current_platform:144 - Note: No headless runner currently available for macos. Symlinking editor build in it's place.
(avalon) enis@Elenis-MacBook-Pro GrowAI_envs % python -m avalon.common.check_install
/Users/enis/miniconda3/envs/avalon/lib/python3.10/site-packages/nptyping/typing_.py:51: DeprecationWarning: `np.bool8` is a deprecated alias for `np.bool_`.  (Deprecated NumPy 1.24)
  Bool8 = np.bool8
/Users/enis/miniconda3/envs/avalon/lib/python3.10/site-packages/nptyping/typing_.py:54: DeprecationWarning: `np.object0` is a deprecated alias for ``np.object0` is a deprecated alias for `np.object_`. `object` can be used instead.  (Deprecated NumPy 1.24)`.  (Deprecated NumPy 1.24)
  Object0 = np.object0
/Users/enis/miniconda3/envs/avalon/lib/python3.10/site-packages/nptyping/typing_.py:66: DeprecationWarning: `np.int0` is a deprecated alias for `np.intp`.  (Deprecated NumPy 1.24)
  Int0 = np.int0
/Users/enis/miniconda3/envs/avalon/lib/python3.10/site-packages/nptyping/typing_.py:80: DeprecationWarning: `np.uint0` is a deprecated alias for `np.uintp`.  (Deprecated NumPy 1.24)
  UInt0 = np.uint0
/Users/enis/miniconda3/envs/avalon/lib/python3.10/site-packages/nptyping/typing_.py:107: DeprecationWarning: `np.void0` is a deprecated alias for `np.void`.  (Deprecated NumPy 1.24)
  Void0 = np.void0
/Users/enis/miniconda3/envs/avalon/lib/python3.10/site-packages/nptyping/typing_.py:112: DeprecationWarning: `np.bytes0` is a deprecated alias for `np.bytes_`.  (Deprecated NumPy 1.24)
  Bytes0 = np.bytes0
/Users/enis/miniconda3/envs/avalon/lib/python3.10/site-packages/nptyping/typing_.py:114: DeprecationWarning: `np.str0` is a deprecated alias for `np.str_`.  (Deprecated NumPy 1.24)
  Str0 = np.str0
Worker (PID=39940):  process group: /Users/enis/miniconda3/envs/avalon/lib/python3.10/site-packages/avalon/datagen/godot/datagen.sh --thread_count=4 -U --input_pipe_path=/var/folders/9v/m9sfgs4x2wq8b_j6xpzf9cjr0000gn/T/science/tmp/6b3a896f-4f85-4ee8-9335-8211332a192d/godot.log.actions --output_pipe_path=/var/folders/9v/m9sfgs4x2wq8b_j6xpzf9cjr0000gn/T/science/tmp/6b3a896f-4f85-4ee8-9335-8211332a192d/godot.log.observations --resolution=96x96 --cuda-gpu-id=0 /var/folders/9v/m9sfgs4x2wq8b_j6xpzf9cjr0000gn/T/science/data/0ce60126-7d82-4d44-9af8-0905f94b8e34/132c706c-ecb7-4e4e-be83-b3336492d040/config.json' &>> /var/folders/9v/m9sfgs4x2wq8b_j6xpzf9cjr0000gn/T/science/tmp/6b3a896f-4f85-4ee8-9335-8211332a192d/godot.log
Worker (PID=39940):  TO DEBUG RUN: /Users/enis/miniconda3/envs/avalon/lib/python3.10/site-packages/avalon/datagen/godot/datagen.sh --thread_count=4 -U --input_pipe_path=/var/folders/9v/m9sfgs4x2wq8b_j6xpzf9cjr0000gn/T/science/data/0ce60126-7d82-4d44-9af8-0905f94b8e34/132c706c-ecb7-4e4e-be83-b3336492d040/actions.out --output_pipe_path=/tmp/debug_output --resolution=96x96 --cuda-gpu-id=0 /var/folders/9v/m9sfgs4x2wq8b_j6xpzf9cjr0000gn/T/science/data/0ce60126-7d82-4d44-9af8-0905f94b8e34/132c706c-ecb7-4e4e-be83-b3336492d040/config.json
Godot error: returncode=SIGHUP(1)
Log: /var/folders/9v/m9sfgs4x2wq8b_j6xpzf9cjr0000gn/T/science/tmp/6b3a896f-4f85-4ee8-9335-8211332a192d/godot.log
Artifacts: /var/folders/9v/m9sfgs4x2wq8b_j6xpzf9cjr0000gn/T/science/godot/godot_env_artifacts__358a993b-4da2-4c9b-9afe-0a0d945ce2d2.tar.gz
Attempting to dump log file here...
realpath: illegal option -- e
usage: realpath [-q] [path ...]

Attempting to log error to sentry...
Godot error: returncode=SIGHUP(1)
Log: /var/folders/9v/m9sfgs4x2wq8b_j6xpzf9cjr0000gn/T/science/tmp/6b3a896f-4f85-4ee8-9335-8211332a192d/godot.log
Artifacts: /var/folders/9v/m9sfgs4x2wq8b_j6xpzf9cjr0000gn/T/science/godot/godot_env_artifacts__358a993b-4da2-4c9b-9afe-0a0d945ce2d2.tar.gz
Attempting to dump log file here... 

I am running on an Mac M1 and my conda environment has the following packages:

appdirs                   1.4.4                    pypi_0    pypi
appnope                   0.1.3                    pypi_0    pypi
arch                      5.3.0                    pypi_0    pypi
asttokens                 2.4.0                    pypi_0    pypi
attrs                     23.1.0                   pypi_0    pypi
avalon-rl                 1.0.0                    pypi_0    pypi
backcall                  0.2.0                    pypi_0    pypi
boto3                     1.28.49                  pypi_0    pypi
botocore                  1.31.49                  pypi_0    pypi
bzip2                     1.0.8                h620ffc9_4
ca-certificates           2023.08.22           hca03da5_0
certifi                   2023.7.22                pypi_0    pypi
chardet                   5.2.0                    pypi_0    pypi
charset-normalizer        3.2.0                    pypi_0    pypi
click                     8.1.7                    pypi_0    pypi
cloudpickle               2.2.1                    pypi_0    pypi
colorlog                  6.7.0                    pypi_0    pypi
contourpy                 1.1.1                    pypi_0    pypi
cycler                    0.11.0                   pypi_0    pypi
decorator                 4.4.2                    pypi_0    pypi
dill                      0.3.7                    pypi_0    pypi
docker-pycreds            0.4.0                    pypi_0    pypi
einops                    0.6.1                    pypi_0    pypi
exceptiongroup            1.1.3                    pypi_0    pypi
executing                 1.2.0                    pypi_0    pypi
filelock                  3.12.4                   pypi_0    pypi
fire                      0.5.0                    pypi_0    pypi
fonttools                 4.42.1                   pypi_0    pypi
gitdb                     4.0.10                   pypi_0    pypi
gitpython                 3.1.36                   pypi_0    pypi
godot-parser              0.1.6                    pypi_0    pypi
gym                       0.25.2                   pypi_0    pypi
gym-notices               0.0.8                    pypi_0    pypi
idna                      3.4                      pypi_0    pypi
imageio                   2.31.3                   pypi_0    pypi
imageio-ffmpeg            0.4.9                    pypi_0    pypi
ipython                   8.15.0                   pypi_0    pypi
jedi                      0.19.0                   pypi_0    pypi
jinja2                    3.1.2                    pypi_0    pypi
jmespath                  1.0.1                    pypi_0    pypi
jsonschema                4.19.0                   pypi_0    pypi
jsonschema-specifications 2023.7.1                 pypi_0    pypi
kiwisolver                1.4.5                    pypi_0    pypi
lazy-loader               0.3                      pypi_0    pypi
libffi                    3.4.4                hca03da5_0
loguru                    0.7.2                    pypi_0    pypi
lxml                      4.9.3                    pypi_0    pypi
mapbox-earcut             1.0.1                    pypi_0    pypi
markupsafe                2.1.3                    pypi_0    pypi
matplotlib                3.8.0                    pypi_0    pypi
matplotlib-inline         0.1.6                    pypi_0    pypi
moviepy                   1.0.3                    pypi_0    pypi
mpmath                    1.3.0                    pypi_0    pypi
ncurses                   6.4                  h313beb8_0
networkx                  3.1                      pypi_0    pypi
nptyping                  2.5.0                    pypi_0    pypi
numpy                     1.26.0                   pypi_0    pypi
openssl                   1.1.1w               h1a28f6b_0
openturns                 1.21                     pypi_0    pypi
packaging                 23.1                     pypi_0    pypi
pandas                    2.1.0                    pypi_0    pypi
parso                     0.8.3                    pypi_0    pypi
pathtools                 0.1.2                    pypi_0    pypi
patsy                     0.5.3                    pypi_0    pypi
pexpect                   4.8.0                    pypi_0    pypi
pickleshare               0.7.5                    pypi_0    pypi
pillow                    10.0.1                   pypi_0    pypi
pip                       23.2.1          py310hca03da5_0
proglog                   0.1.10                   pypi_0    pypi
prompt-toolkit            3.0.39                   pypi_0    pypi
property-cached           1.6.4                    pypi_0    pypi
protobuf                  4.24.3                   pypi_0    pypi
psutil                    5.9.5                    pypi_0    pypi
ptyprocess                0.7.0                    pypi_0    pypi
pure-eval                 0.2.2                    pypi_0    pypi
pycollada                 0.7.2                    pypi_0    pypi
pygments                  2.16.1                   pypi_0    pypi
pyparsing                 3.1.1                    pypi_0    pypi
python                    3.10.0               hbdb9e5c_5
python-dateutil           2.8.2                    pypi_0    pypi
pytz                      2023.3.post1             pypi_0    pypi
pywavelets                1.4.1                    pypi_0    pypi
pyyaml                    6.0.1                    pypi_0    pypi
readline                  8.2                  h1a28f6b_0
referencing               0.30.2                   pypi_0    pypi
requests                  2.31.0                   pypi_0    pypi
rliable                   1.0.8                    pypi_0    pypi
rpds-py                   0.10.3                   pypi_0    pypi
rtree                     1.0.1                    pypi_0    pypi
s3transfer                0.6.2                    pypi_0    pypi
scikit-image              0.21.0                   pypi_0    pypi
scipy                     1.11.2                   pypi_0    pypi
seaborn                   0.12.2                   pypi_0    pypi
sentry-sdk                1.31.0                   pypi_0    pypi
setproctitle              1.3.2                    pypi_0    pypi
setuptools                68.0.0          py310hca03da5_0
sh                        2.0.6                    pypi_0    pypi
shapely                   2.0.1                    pypi_0    pypi
six                       1.16.0                   pypi_0    pypi
smmap                     5.0.1                    pypi_0    pypi
sqlite                    3.41.2               h80987f9_0
stack-data                0.6.2                    pypi_0    pypi
statsmodels               0.14.0                   pypi_0    pypi
svg-path                  6.3                      pypi_0    pypi
sympy                     1.12                     pypi_0    pypi
termcolor                 2.3.0                    pypi_0    pypi
tifffile                  2023.8.30                pypi_0    pypi
tk                        8.6.12               hb8d0fd4_0
torch                     2.0.1                    pypi_0    pypi
tqdm                      4.66.1                   pypi_0    pypi
traitlets                 5.10.0                   pypi_0    pypi
trimesh                   3.21.7                   pypi_0    pypi
typing-extensions         4.8.0                    pypi_0    pypi
tzdata                    2023.3                   pypi_0    pypi
urllib3                   1.26.16                  pypi_0    pypi
wandb                     0.15.10                  pypi_0    pypi
wcwidth                   0.2.6                    pypi_0    pypi
wheel                     0.38.4          py310hca03da5_0
xxhash                    3.3.0                    pypi_0    pypi
xz                        5.4.2                h80987f9_0
zlib                      1.2.13               h5a0b063_0 ```




Changes needed to complete the tutorial_add_task tutorial

While I was able to successfully complete this tutorial, there are a number of issues in the directions. I catalog them here in case others encounter the same:
Some of these issues are already known from #30

(1) The tutorial directs one to install avalon per instructions in the repo's readme file. These steps fail installing godot as the install code depends on PyTorch. Installing PyTorch will fix it

(2) Step1 contains two errors

  • the instructions ask to open godot.project, but the file is actually project.godot
  • The expected view on opening and running main.tscn does not agree with the tutorial. To fix this "is_teleporter_enabled" must be changed in the config.json file to false

(3) Steps 2 through 5 have missing imports

  • The instructions are to strip down stack.py, to yield something like baseball.template.py. If one just uses baseball.template.py as the starting point, one will encounter many missing imports. These should be added to baseball.template.py
  • Step 5 calls out that certain constants can be imported from from avalon.datagen.world_creation.constant, but this is not correct for one of the constants. it's should be avalon.datagen.world_creation.indoor.constants for DEFAULT_FLOOR_THICKNESS
    -Here's the complete list of added imports, in the order added
from avalon.common.utils import only
from avalon.datagen.world_creation.indoor.task_generator import add_food_island
from avalon.datagen.world_creation.geometry import BuildingTile
from avalon.datagen.world_creation.constants import AGENT_HEIGHT
from avalon.datagen.world_creation.constants import FOOD_HOVER_DIST
from avalon.datagen.world_creation.geometry import local_to_global_coords
from avalon.datagen.world_creation.entities.tools.weapons import LargeStick
from itertools import product
from avalon.datagen.world_creation.indoor.tiles import decide_tiles_by_distance
from avalon.datagen.world_creation.constants import MAX_JUMP_HEIGHT_METERS
from avalon.datagen.world_creation.constants import STANDING_REACH_HEIGHT
from avalon.datagen.world_creation.indoor.constants import DEFAULT_FLOOR_THICKNESS

(4) Step2 add import to datagen/world_creation/world_generator.py
When adding the task-to-generator mapping, you must also import the task generator function in datagen/world_creation/world_generator.py, else generate_baseball_task is not defined
from baseball import generate_baseball_task

(5) Step3 make sure room_position_3d is defined before use
The ordering of edits in this block, if followed blindly will have rood_position_3d used before defined as previous step first set spawn_location, then target_location, but in step3 target is defined first, then spawn.

(6) Step 5 plinth_height is set, when it was meant to be min_plinth_height
The following line

plinth_height = MAX_JUMP_HEIGHT_METERS + STANDING_REACH_HEIGHT + DEFAULT_FLOOR_THICKNESS + 0.1

was probably meant to be

min_plinth_height = MAX_JUMP_HEIGHT_METERS + STANDING_REACH_HEIGHT + DEFAULT_FLOOR_THICKNESS + 0.1

[Error] Inconsistent coordinate dimensionality

When running the test code python -m avalon.agent.train_ppo_avalon In Docker container , the error info as:

  ValueError: Inconsistent coordinate dimensionality
  Caught error in _on_world_generation_error. This shouldn't happen!!!:
  Inconsistent coordinate dimensionality
  Unspecified error in world generation, this was try 0... (reason: Inconsistent coordinate dimensionality)
  Unspecified error in world generation, this was try 0... (reason: Inconsistent coordinate dimensionality)
  Unspecified error in world generation, this was try 0... (reason: Inconsistent coordinate dimensionality)
  Unspecified error in world generation, this was try 0... (reason: Inconsistent coordinate dimensionality)
  Unspecified error in world generation, this was try 0... (reason: Inconsistent coordinate dimensionality)
  Unspecified error in world generation, this was try 0... (reason: Inconsistent coordinate dimensionality)
  z^H^HUnspecified error in world generation, this was try 0... (reason: Inconsistent coordinate dimensionality)
  Unspecified error in world generation, this was try 1... (reason: Inconsistent coordinate dimensionality)
  Unspecified error in world generation, this was try 2... (reason: Inconsistent coordinate dimensionality)
  Unspecified error in world generation, this was try 3... (reason: Inconsistent coordinate dimensionality)
  Ran out of retries to generate a good world!
  Params were: GenerateAvalonWorldParams(task=<AvalonTask.OPEN: 'OPEN'>, difficulty=0.0, seed=8, index=32, output='/tmp/science/data/level_gen/6b796894-c198-41ba-a553-dbca7358de88/32', num_retries=5)
  An error has been caught in function 'worker', process 'ForkPoolWorker-11:1' (2815), thread 'MainThread' (140485987227456):

Any planning to merge from Avalon-Benchmark/godot to upstream godot?

Hi Avalon-Benchmark Avalon team,

Is there planning to:

• Create future pull requests to merge from Avalon-Benchmark/godot to upstream godot?

• If yes, is there a roadmap summarizing the direction of how Avalon-Benchmark/godot would merge into upstream godot?

• If not, how would one report issues for Avalon-Benchmark/godot custom branches, such as 3.4.4-avalon, without an "Issues" section?

For example: I am posting here in Avalon-Benchmark: avalon because there isn't an "Issues" section in Avalon-Benchmark: godot

• If not, how often does Avalon-Benchmark/godot pull from upstream godot and resolve merge conflicts?

• A strategy with open source is to send pull requests upstream as early as possible to lower the maintenance burden of owning a fork drifting farther and farther away from upstream.

Thank you.

Error occurs in Generate_world when following Mac/Ubuntu instructions

Hello. I'm trying to install and test avalon-rl on both local MAC (m1) and headless server (Ubuntu-18.0.4, 20.0.4) environment.
(I'm working on conda)
I followed the installation instructions but they return same error like:
(In Mac)

2023-01-19 16:44:01.755 | ERROR    | avalon.datagen.world_creation.world_generator:generate_world:637 - Unspecified error in world generation, this was try 0... (reason: buffer source array is read-only)
2023-01-19 16:44:01.764 | ERROR    | avalon.datagen.world_creation.world_generator:generate_world:637 - Unspecified error in world generation, this was try 1... (reason: buffer source array is read-only)
2023-01-19 16:44:01.773 | ERROR    | avalon.datagen.world_creation.world_generator:generate_world:637 - Unspecified error in world generation, this was try 2... (reason: buffer source array is read-only)
2023-01-19 16:44:01.777 | ERROR    | avalon.datagen.world_creation.world_generator:generate_world:637 - Unspecified error in world generation, this was try 3... (reason: buffer source array is read-only)
2023-01-19 16:44:01.785 | ERROR    | avalon.datagen.world_creation.world_generator:generate_world:633 - Ran out of retries to generate a good world!
2023-01-19 16:44:01.785 | ERROR    | avalon.datagen.world_creation.world_generator:generate_world:634 - Params were: GenerateAvalonWorldParams(task=<AvalonTask.EAT: 'EAT'>, difficulty=0.0, seed=0, index=0, output='/var/folders/7d/4wzd69fn51dbr2z0d9y71vtc0000gn/T/science/data/level_gen/fe07b7c8-0560-49b0-ab0b-fd2a6b09176c/0', num_retries=5)
Caught error in _on_world_generation_error. This shouldn't happen!!!:
buffer source array is read-only

(In Ubuntu-18.0.4 and 20.0.4)

Unspecified error in world generation, this was try 0... (reason: buffer source array is read-only)
Unspecified error in world generation, this was try 0... (reason: buffer source array is read-only)
Unspecified error in world generation, this was try 1... (reason: buffer source array is read-only)
Unspecified error in world generation, this was try 2... (reason: buffer source array is read-only)
Unspecified error in world generation, this was try 1... (reason: buffer source array is read-only)
Unspecified error in world generation, this was try 3... (reason: buffer source array is read-only)
Ran out of retries to generate a good world!
Params were: GenerateAvalonWorldParams(task=<AvalonTask.EAT: 'EAT'>, difficulty=0.0, seed=0, index=0, output='/tmp/science/data/level_gen/59cd56e3-2069-42d3-ad37-d84889902b57/0', num_retries=5)
Unspecified error in world generation, this was try 2... (reason: buffer source array is read-only)
Caught error in _on_world_generation_error. This shouldn't happen!!!:
buffer source array is read-only

Base installation instructions in the avalon/README.md for Ubuntu are not correct

Specifically, following these two lines under ubuntu will fail
pip install avalon-rl
python -m avalon.install_godot_binary

With this stack trace
python -m avalon.install_godot_binary
Traceback (most recent call last):
File "/home/dfm/anaconda3/envs/avalon-rst/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/home/dfm/anaconda3/envs/avalon-rst/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/home/dfm/dev/avalon-benchmark/avalon/avalon/install_godot_binary.py", line 16, in
from avalon.datagen.godot_env.interactive_godot_process import GODOT_BINARY_PATH
File "/home/dfm/dev/avalon-benchmark/avalon/avalon/datagen/godot_env/interactive_godot_process.py", line 22, in
from avalon.common.log_utils import log_to_sentry
File "/home/dfm/dev/avalon-benchmark/avalon/avalon/common/log_utils.py", line 13, in
from avalon.contrib.utils import FILESYSTEM_ROOT
File "/home/dfm/dev/avalon-benchmark/avalon/avalon/contrib/utils.py", line 18, in
import torch
ModuleNotFoundError: No module named 'torch'

It seems that torch is not installed when installing avalon-rl.
install_godot_binary uses code in utils.py, and that code imports torch for a single function that sets the random number generator seeds.

using pip install avalon-rl[train] will install torch and then the binary installation and common.check_install also succeeds.

Upgrading to Gymnasium

Hey there, I run the Farama Foundation and am one of the the maintainers of Gymnasium (and formerly Gym).

As you're able to, would you be willing to upgrade from Gym to Gymnasium? Gym isn't maintained anymore and won't be getting support for new versions of Python or anything like that anymore, and RLlib and Stable Baselines3 and most of the other major packages have switched or are publicly planning to do so, and I've been going around and asking other notable packages that haven't upgraded yet to upgrade.

In case you haven't already seen it, we have a blog post that summarizes the backstory of the switch here- https://farama.org/Announcing-The-Farama-Foundation

I'm happy to answer any questions you have or help if I'm able to

Error running the quickstart code

I'm trying to run the quickstart code in readme but got the following error (ubuntu 22.04):

Traceback (most recent call last):
  File "/home/haotion/anaconda3/lib/python3.9/multiprocessing/process.py", line 315, in _bootstrap
    self.run()
  File "/home/haotion/anaconda3/lib/python3.9/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/home/haotion/anaconda3/lib/python3.9/multiprocessing/pool.py", line 109, in worker
    initializer(*initargs)
  File "/home/haotion/Downloads/avalon/avalon/datagen/world_creation/world_generator.py", line 460, in disable_sigint
    configure_parent_logging()
  File "/home/haotion/Downloads/avalon/avalon/common/log_utils.py", line 101, in configure_parent_logging
    raise Exception(
Exception: No parent process logging configuration specified. You are likely attempting to call configure_parent_logging without having already called configure_remote_logger or configure_local_logger in a parent process. If this is not a spawned subprocess, you should call one of those two functions rather than calling this function.
Process ForkPoolWorker-364:
Traceback (most recent call last):
  File "/home/haotion/Downloads/avalon/avalon/common/log_utils.py", line 98, in configure_parent_logging
    from computronium.common.log_utils import configure_parent_logging as inner_configure_parent_logging
ModuleNotFoundError: No module named 'computronium'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/haotion/anaconda3/lib/python3.9/multiprocessing/process.py", line 315, in _bootstrap
    self.run()
  File "/home/haotion/anaconda3/lib/python3.9/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/home/haotion/anaconda3/lib/python3.9/multiprocessing/pool.py", line 109, in worker
    initializer(*initargs)
  File "/home/haotion/Downloads/avalon/avalon/datagen/world_creation/world_generator.py", line 460, in disable_sigint
    configure_parent_logging()
  File "/home/haotion/Downloads/avalon/avalon/common/log_utils.py", line 101, in configure_parent_logging
    raise Exception(
Exception: No parent process logging configuration specified. You are likely attempting to call configure_parent_logging without having already called configure_remote_logger or configure_local_logger in a parent process. If this is not a spawned subprocess, you should call one of those two functions rather than calling this function.
Aborted (core dumped)

Problems on installing Avalon on intel macOS

Following the guide described on the GitHub README leads to failing of tests (python -m avalon.common.check_install).
I have created a python 3.10 conda environment, installed avalon-rl[train], and then python -m avalon.install_godot_binary.
Executed code:

from avalon.agent.godot.godot_gym import AvalonEnv
from avalon.agent.godot.godot_gym import GodotEnvironmentParams
from avalon.agent.godot.godot_gym import TrainingProtocolChoice
from avalon.datagen.env_helper import display_video

env_params = GodotEnvironmentParams(
    resolution=256,
    training_protocol=TrainingProtocolChoice.SINGLE_TASK_MOVE,
    initial_difficulty=0,
)
env = AvalonEnv(env_params)
env.reset()

def random_env_step():
    action = env.action_space.sample()
    obs, reward, done, info = env.step(action)
    if done:
        env.reset()
    return obs


observations = [random_env_step() for _ in range(50)]
display_video(observations, fps=10)

Full error:

File "/Users/<USER>/opt/miniconda3/envs/avalon/lib/python3.10/multiprocessing/spawn.py", line 134, in _check_not_importing_main
    raise RuntimeError('''
RuntimeError:
        An attempt has been made to start a new process before the
        current process has finished its bootstrapping phase.

        This probably means that you are not using fork to start your
        child processes and you have forgotten to use the proper idiom
        in the main module:

            if __name__ == '__main__':
                freeze_support()
                ...

        The "freeze_support()" line can be omitted if the program
        is not going to be frozen to produce an executable.

Following instructions in tutorial_custom_env fails on first step

I'm trying to walk through the instruction in the README.md file to create a custom environment.
Summarizing, the steps I took were to copy avalon/datagen/godot to another location, per instructions
rsync -r ./avalon/datagen/godot/ <my_path>/sphere_eater --info=progress2
copy main.tscn and sphere.gd to <my_path>/sphere_eater
then launch the godot_editor, import project.godot

When this is done, a top level scene is already open - scene_root

Ignoring that, I open main.tscn and see the expected cube and sphere.

Next step is to run the environment. This however launches an avalon environment rather than the custom one, as
project settings -> Application -> run -> Main Scene points to the scene_root.tscn file

Setting project settings -> Application -> run -> Main Scene to the main.tscn file however results in a fault at
res://game/game_manager/game_manager.gd:46 - at function _init
which is the line scene_root.add_child(node) line in this loop

for node in controlled_nodes:
scene_root.add_child(node)

The error message is
Attempt to call function 'add-child' in base 'null instance' on a null instance

It seems that scene_root is hardwired? Rather than using the node passed in to the init function as _root?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.