danijar / crafter Goto Github PK
View Code? Open in Web Editor NEWBenchmarking the Spectrum of Agent Capabilities
Home Page: https://danijar.com/crafter
License: MIT License
Benchmarking the Spectrum of Agent Capabilities
Home Page: https://danijar.com/crafter
License: MIT License
First of all, thank you for this environment!
I think VideoRecorder has a small bug that causes duplicate directories in the path, which causes an error when saving logs.
Example of an error for directory="videos"
:
FileNotFoundError: The directory '/home/project_path/videos/videos' does not exist
Removing self._directory /
from filename fixes this error for me.
Line 98 in e36271d
Thanks Hafner for this environment. Have you or anyone else made multiagent versions of it?
I followed the instructions but I got the error:
"reset() missing 1 required positional argument: 'self'"
When using:
env = crafter.Recorder(
env, './',
save_stats=True,
save_video=True,
save_episode=True,
)
env.reset()
Any solution? I really would like to try this environment :(
The installation seems to go well but when I try to import crafter it doesn't work. I looked for some ways to solve this problem but the only solution I could find was to upgrade to Python 3.9 but I can't do that since I plan on using an online service like google colab or kaggle. What would you suggest I do?
I'm trying to get DREAMER v3 working, but can't get all dependencies to install. I'm using >> pip install crafter or with specific version 1.8.2, and getting the following error (I was able to install version 1.8.1, but then got the error in using yaml when trying to do load):
I am using pip (23.3.1), python (3.9), and setuptools (69.0.1). After >> pip install crafter, I get this error:
Collecting crafter==1.8.2
Using cached crafter-1.8.2.tar.gz (107 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [10 lines of output]
Traceback (most recent call last):
File "", line 2, in
File "", line 34, in
File "~AppData\Local\Temp\pip-install-qn4q8ono\crafter_8c8a23be6c8f433b9c43fe2ca828a022\setup.py", line 10, in
long_description=pathlib.Path('README.md').read_text(),
File "~AppData\Local\Programs\Python\Python39\lib\pathlib.py", line 1267, in read_text
return f.read()
File "~AppData\Local\Programs\Python\Python39\lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 6432: character maps to
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
Hi. The paper mentions
Rainbow (Hessel et al., 2018) is based on Q-Learning and combines several advances, including for exploration. The defaults for Atari did not work well, so we tuned the hyper parameters for Crafter and found a compromise between Atari defaults and the data-efficient version of the method (van Hasselt et al., 2019) to be ideal.
Are these hyperparameters available anywhere, and if not, can you please share these? The crafter baselines for Rainbow has the same hyperparameters as Kaixhin's Rainbow (which are designed for ALE), and there are no hyper parameter values mentioned in the paper. Thanks for your time!
Hello,
In the gym.Env
class, the first argument is defined as the mode, which is either "human" or "rgb_array". In Crafter, the render function takes only one argument, size
. This causes errors when using stable-baselines3 to evaluate policies and create videos since their helper functions assume envs follow gym.Env
and have the first argument as the mode.
A fix would be to just add a dummy first argument mode
to the render function
Lines 120 to 122 in e955b11
Hi!
I was wondering if there exists a plan to integrate the crafter learning environment in Envpool. I think it would be very useful since it would allow training agents in parallel to benefit from the high-performance framework of Envpool, and build on top of great baselines.
There exists this guide which can be useful.
Thank you very much!
Hi!,
I am having problems with the recorder, as
env = crafter.Recorder(
env, './logs',
save_stats=True,
save_video=True,
save_episode=True,
)
returns TypeError: render() takes 1 positional argument but 2 were given
and
env.render()
returns AttributeError: 'NoneType' object has no attribute 'get'
Hi! Is there any way to generate a global view of the map like the ones in the readme? I have seen a Global View class in engine.py but it is not implemented. Thank you!
The newest version of ruamel.yaml has removed the safe_load
function used by crafter, causing the following error when trying to run through the gui:
AttributeError:
"safe_load()" has been removed, use
yaml = YAML(typ='safe', pure=True)
yaml.load(...)
The can be fixed most easily by running
pip install "ruamel.yaml<0.18.0"
The latest Gym API expects terminated
, truncated
rather than just done
after a env.step()
, and seeds the environment with env.reset(seed=seed)
rather than env.seed(seed=seed)
. It is possible to apply a compatibility wrapper by making the env with env = gym.make('CrafterReward-v1', apply_api_compatibility=True)
but to work properly the base env must have the env.seed(seed=seed)
function, which your Env
class does not have (instead, it has the self._seed
attribute).
Is there any plan to add the env.seed()
function, to make it fully compatible with the latest API? That would also make it compatible with Gymnasium.
See Appendix 1 in https://arxiv.org/html/2406.01361v1
Model | DreamerV3 (2023 preprint) | IRIS | DART |
---|---|---|---|
Steps | 1M | 1M | 1M |
Return | 11.7±1.9 | 9.23±0.56 | 12.2±1.67 |
Hi!
I am not being able to load the scripts in the analysis folder with the stored .jsonl
files from the Recorder. I think the format of the saved files (line-separated dictionaries) is not the expected format for the analysis
code. It is also not the same as the .json
files that are stored in the scores/
folder. Am I missing something?
Thank you!
Hi @danijar!
I'm the creator of Griddly https://griddly.readthedocs.io/en/latest/ and I'm pretty sure it would be possible to port most of the crafter environment to use the Griddly Engine.
Using Griddly you get a bunch of features that work out of the box
It would be super simple to skin crafter like this also for interesting demos:
What do you think? There's definitely some things I'd have to add to Griddly (such as the chasing mechanics) But I've been looking to do that for a while anyway.
Ill see if I can make a super simple example and add some images/gifs this weekend.
Hi. I am a little confused about how many steps should the agent train and then evalauted on. To add a little context, the paper mentions on pg2
Crafter evaluates many different abilities of an agent by training only on a single environment for 5M steps
and this can be seen in crafter_baselines code as well (e.g. PPO, Rainbow)
But in Sec 3.3 of the paper
An agent is granted a budget of 1M environment steps to interact with the environment.
elsewhere (pg 6, sec 4.1), multiple figures
budget of 1M environment steps
Table A.1
It is computed across all training episodes within the budget of 1M environment steps
I also see that you commented out evaluation code from the Rainbow code (here).
What I can make of this is that I need to run crafter agent for 1M steps (I saw the PPO example) and then use the saved stats (json file?) and the analysis
code to calculate the success rate and score. Precisely, using the existing crafter code available, how can I go from training to plotting meaningful results. Can you please clarify? Thanks
Hi, danijar.
Thanks for making a good environment.
I could check 'Play Yourself' and play the game myself. however, I just got information on (obs, reward, done, info), the gui game is not working when I tried to import crafter in a python script. And env.render() is also not working.
could you give me the answer how can I render in a python script?
Hi,
Thank you for this environment. What would be the dreamer config for training this environment?
p.
It would be nice to add no-enemy mode, it would be extremely useful for learning game mechanics/crafting without dying or avoiding enemies.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.