-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 89939eb
Showing
374 changed files
with
151,519 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
*.ipynb | ||
|
||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
.hypothesis/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
.static_storage/ | ||
.media/ | ||
local_settings.py | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# pyenv | ||
.python-version | ||
|
||
# celery beat schedule file | ||
celerybeat-schedule | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# Environments | ||
.env | ||
.venv | ||
# env/ | ||
venv/ | ||
# ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ | ||
|
||
# Mac | ||
.DS_Store | ||
|
||
# MuJoCo License key | ||
mjkey.txt | ||
|
||
.mujocomanip_temp_model.xml | ||
|
||
# Python IDE | ||
.idea | ||
|
||
# Locally generated files | ||
dump.rdb | ||
*.local.ipynb | ||
runs/ | ||
temp* | ||
debug_* | ||
*.swp | ||
|
||
.tabnine_root |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2022 MineDojo Team | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
recursive-include minedojo/sim * | ||
recursive-include minedojo *.json *.yaml *.java |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
## Modified MineDojo Package | ||
|
||
The code is a slightly modified version of [MineDojo](https://github.com/MineDojo/MineDojo) used for [COPL](https://github.com/PKU-RL/COPL). | ||
|
||
### Installation | ||
|
||
Please refer to this [document](https://docs.minedojo.org/sections/getting_started/install.html) for the package installation and use. Note that `Python>=3.9` is required. | ||
|
||
Install modified MineDojo: | ||
```shell | ||
git clone https://github.com/PKU-RL/MCEnv_COPL.git | ||
cd MCEnv_COPL | ||
pip install -e . | ||
``` | ||
|
||
### Modifications on MineDojo | ||
|
||
* We support multi-task environment setting, which is able to include combat tasks and harvest tasks simutaneously. See `minedojo/tasks/meta/multi_task.py`. | ||
* We support randomly teleporting the player in the fast_reset mode: when calling `env.reset()`, the player will be teleported to a random location near its initial spawn point. | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+107 KB
images/task_suite/combat/combat_bat_plains_diamond_armors_iron_sword_shield.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+105 KB
images/task_suite/combat/combat_husk_desert_iron_armors_diamond_sword_shield.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+139 KB
...sk_suite/combat/combat_pig_extreme_hills_leather_armors_wooden_sword_shield.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+161 KB
images/task_suite/combat/combat_spider_forest_iron_armors_wooden_sword_shield.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+183 KB
images/task_suite/harvest/harvest_milk_forest_with_an_empty_bucket.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+139 KB
images/task_suite/techtree/techtree_from_diamond_to_redstone_dispenser.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from .tasks import make |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from .reddit_dataset import RedditDataset | ||
from .wiki_dataset import WikiDataset | ||
from .youtube_dataset import YouTubeDataset |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
import os | ||
import sys | ||
import zipfile | ||
|
||
import requests | ||
import wget | ||
|
||
|
||
def get_doi(link): | ||
response = requests.get(link) | ||
return response.url | ||
|
||
|
||
DOWNLOAD_URLS = { | ||
"youtube": { | ||
"full": f"{get_doi('https://doi.org/10.5281/zenodo.6641142')}/files/youtube_full.json", | ||
"tutorial": f"{get_doi('https://doi.org/10.5281/zenodo.6641142')}/files/youtube_tutorial.json", | ||
}, | ||
"wiki": { | ||
"full": f"{get_doi('https://doi.org/10.5281/zenodo.6640448')}/files/wiki_full.zip", | ||
"samples": f"{get_doi('https://doi.org/10.5281/zenodo.6640448')}/files/wiki_samples.zip", | ||
}, | ||
"reddit": { | ||
"full": f"{get_doi('https://doi.org/10.5281/zenodo.6641114')}/files/reddit.json", | ||
}, | ||
} | ||
|
||
|
||
def get_fn(source: str = "youtube", download_dir: str = None, full: bool = True): | ||
url = DOWNLOAD_URLS[source][ | ||
"full" if full else "tutorial" if source == "youtube" else "samples" | ||
] | ||
fn = wget.filename_from_url(url) | ||
extracted_fn = fn if source != "wiki" else fn.replace(".zip", "") | ||
extracted_fn = os.path.join(download_dir, extracted_fn) | ||
download_fn = os.path.join(download_dir, fn) | ||
|
||
return extracted_fn, download_fn, url | ||
|
||
|
||
def download(source: str = "youtube", download_dir: str = None, full: bool = True): | ||
r"""Function that downloads the datasets of MineDojo to local. | ||
Args: | ||
source (string): the sub-dataset name: | ||
``'youtube'`` | ``'wiki'`` | ``'reddit'`` | ||
download_dir (string, optional): Directory path where the downloaded data will be saved. | ||
The default directory is ``~/.minedojo/``. | ||
full (bool, optional): Only useful when ``source='youtube'`` or ``source='wiki'``. If set to ``False``, only the tutorial version | ||
of YouTube dataset or the sample version of Wiki dataset will be downloaded. Default is ``True``. | ||
Returns: | ||
Directory path to downloaded (extracted) file or folder. | ||
Examples:: | ||
>>> from minedojo.data.download import download | ||
>>> print(download("youtube", full=False)) | ||
'~/.minedojo/youtube_tutorial.json' | ||
>>> print(download("wiki", full=False)) | ||
'~/.minedojo/wiki_samples' | ||
>>> print(download("reddit")) | ||
'~/.minedojo/reddit.json' | ||
""" | ||
|
||
if download_dir is None: | ||
download_dir = os.path.join(os.path.expanduser("~"), ".minedojo") | ||
if not os.path.exists(download_dir): | ||
os.makedirs(download_dir) | ||
|
||
if source == "reddit" and not full: | ||
print( | ||
"Reddit dataset does not have a sample version. Will download / use the full version." | ||
) | ||
full = True | ||
|
||
extracted_fn, download_fn, url = get_fn(source, download_dir, full) | ||
|
||
if os.path.exists(extracted_fn) and ( | ||
source != "wiki" or not os.path.exists(download_fn) | ||
): | ||
return extracted_fn | ||
elif not os.path.exists(download_fn): | ||
print(f"Downloading {url} to {download_fn}...") | ||
wget.download(url, out=download_fn, bar=bar_progress) | ||
|
||
if source == "wiki": | ||
with zipfile.ZipFile(download_fn, "r") as zip_ref: | ||
zip_ref.extractall(download_dir) | ||
os.remove(download_fn) | ||
|
||
return extracted_fn | ||
|
||
|
||
def bar_progress(current, total, width=80): | ||
progress_message = f"Downloading: {current / total * 100:.1f}% [{current/1e6:.1f} / {total/1e6:.1f}] MB" | ||
sys.stdout.write("\r" + progress_message) | ||
sys.stdout.flush() |
Oops, something went wrong.