Skip to content

Commit

Permalink
Add optional Numba dependency for faster world generation.
Browse files Browse the repository at this point in the history
  • Loading branch information
danijar committed Feb 10, 2022
1 parent 0a1761a commit e955b11
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions analysis/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ def compute_success_rates(runs, budget=1e6, sortby=None):

def compute_scores(percents):
# Geometric mean with an offset of 1%.
assert all(0 <= x <= 100 for x in percents)
if all(x <= 1.0 for x in percents):
print('Warning: The input may not be in the right range.')
with warnings.catch_warnings(): # Empty seeds become NaN.
warnings.simplefilter('ignore', category=RuntimeWarning)
scores = np.exp(np.nanmean(np.log(1 + percents), -1)) - 1
Expand Down
8 changes: 6 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

setuptools.setup(
name='crafter',
version='1.7.1',
version='1.8.0',
description='Open world survival game for reinforcement learning.',
url='http://github.com/danijar/crafter',
long_description=pathlib.Path('README.md').read_text(),
Expand All @@ -13,7 +13,11 @@
package_data={'crafter': ['data.yaml', 'assets/*']},
entry_points={'console_scripts': ['crafter=crafter.run_gui:main']},
install_requires=[
'numpy', 'imageio', 'pillow', 'opensimplex', 'ruamel.yaml'],
'numpy', 'imageio', 'pillow', 'opensimplex', 'ruamel.yaml',
# Numba is an optional dependency but we want it installed by default
# because it speeds up world generation by ~5x.
'numba',
],
extras_require={'gui': ['pygame']},
classifiers=[
'Intended Audience :: Science/Research',
Expand Down

0 comments on commit e955b11

Please sign in to comment.