Skip to content

Commit

Permalink
fixed install.
Browse files Browse the repository at this point in the history
  • Loading branch information
robfiras committed Dec 15, 2023
1 parent f960550 commit b23985b
Show file tree
Hide file tree
Showing 9 changed files with 92 additions and 47 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ __pycache__/
*.egg-info/
logs/
None/
dist/
.pytest_cache/
.DS_Store
loco_mujoco/datasets/
Expand Down
Binary file removed dist/loco-mujoco-0.1.tar.gz
Binary file not shown.
3 changes: 0 additions & 3 deletions download_datasets.py

This file was deleted.

13 changes: 4 additions & 9 deletions loco_mujoco/__init__.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
__version__ = '0.1'


from .environments import LocoEnv

try:

from .environments import LocoEnv

def get_all_task_names():
return LocoEnv.get_all_task_names()


def download_all_datasets():
return LocoEnv.download_all_datasets()

except ImportError:
pass
except ImportError as e:
print(e)
32 changes: 0 additions & 32 deletions loco_mujoco/environments/base.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import os

import wget
import zipfile
import warnings
from pathlib import Path
from copy import deepcopy
Expand Down Expand Up @@ -953,36 +951,6 @@ def get_all_task_names(cls):

_registered_envs = dict()

@classmethod
def download_all_datasets(cls):
"""
Download and installs all datasets.
"""
dataset_path = Path(loco_mujoco.__file__).resolve().parent / "datasets"

print("Downloading Humanoid Datasets ...\n")
dataset_path_humanoid = dataset_path / "humanoids/real"
dataset_path_humanoid_str = str(dataset_path_humanoid)
humanoid_url = "https://zenodo.org/records/10102870/files/humanoid_datasets_v0.1.zip?download=1"
wget.download(humanoid_url, out=dataset_path_humanoid_str)
file_name = "humanoid_datasets_v0.1.zip"
file_path = str(dataset_path_humanoid / file_name)
with zipfile.ZipFile(file_path, "r") as zip_ref:
zip_ref.extractall(dataset_path_humanoid_str)
os.remove(file_path)

print("Downloading Quadruped Datasets ...\n")
dataset_path_quadrupeds = dataset_path / "quadrupeds/real"
dataset_path_quadrupeds_str = str(dataset_path_quadrupeds)
quadruped_url = "https://zenodo.org/records/10102870/files/quadruped_datasets_v0.1.zip?download=1"
wget.download(quadruped_url, out=dataset_path_quadrupeds_str)
file_name = "quadruped_datasets_v0.1.zip"
file_path = str(dataset_path_quadrupeds / file_name)
with zipfile.ZipFile(file_path, "r") as zip_ref:
zip_ref.extractall(dataset_path_quadrupeds_str)
os.remove(file_path)


class ValidTaskConf:

Expand Down
1 change: 1 addition & 0 deletions loco_mujoco/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
from .checks import *
from .video import video2gif
from .domain_randomization import *
from .dataset import download_all_datasets, download_real_datasets, download_perfect_dataset
82 changes: 82 additions & 0 deletions loco_mujoco/utils/dataset.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import os
import wget
import zipfile
from pathlib import Path
import loco_mujoco


def download_all_datasets():
"""
Download and installs all datasets.
"""
download_real_datasets()
download_perfect_dataset()


def download_real_datasets():
"""
Download and installs real datasets.
"""

dataset_path = Path(loco_mujoco.__file__).resolve().parent / "datasets"
print(dataset_path)

print("Downloading Humanoid Datasets ...\n")
dataset_path_humanoid = dataset_path / "humanoids/real"
dataset_path_humanoid_str = str(dataset_path_humanoid)
os.makedirs(dataset_path_humanoid_str, exist_ok=True)
humanoid_url = "https://zenodo.org/records/10102870/files/humanoid_datasets_v0.1.zip?download=1"
wget.download(humanoid_url, out=dataset_path_humanoid_str)
file_name = "humanoid_datasets_v0.1.zip"
file_path = str(dataset_path_humanoid / file_name)
with zipfile.ZipFile(file_path, "r") as zip_ref:
zip_ref.extractall(dataset_path_humanoid_str)
os.remove(file_path)

print("Downloading Quadruped Datasets ...\n")
dataset_path_quadrupeds = dataset_path / "quadrupeds/real"
dataset_path_quadrupeds_str = str(dataset_path_quadrupeds)
os.makedirs(dataset_path_quadrupeds_str, exist_ok=True)
quadruped_url = "https://zenodo.org/records/10102870/files/quadruped_datasets_v0.1.zip?download=1"
wget.download(quadruped_url, out=dataset_path_quadrupeds_str)
file_name = "quadruped_datasets_v0.1.zip"
file_path = str(dataset_path_quadrupeds / file_name)
with zipfile.ZipFile(file_path, "r") as zip_ref:
zip_ref.extractall(dataset_path_quadrupeds_str)
os.remove(file_path)


def download_perfect_dataset():
"""
Download and installs perfect datasets.
"""
dataset_path = Path(loco_mujoco.__file__).resolve().parent / "datasets"

print("Downloading Perfect Humanoid Datasets ...\n")
dataset_path_humanoid = dataset_path / "humanoids/perfect"
dataset_path_humanoid_str = str(dataset_path_humanoid)
os.makedirs(dataset_path_humanoid_str, exist_ok=True)
humanoid_url = "https://zenodo.org/records/10102870/files/humanoid_datasets_v0.1.zip?download=1"
wget.download(humanoid_url, out=dataset_path_humanoid_str)
file_name = "humanoid_datasets_v0.1.zip"
file_path = str(dataset_path_humanoid / file_name)
with zipfile.ZipFile(file_path, "r") as zip_ref:
zip_ref.extractall(dataset_path_humanoid_str)
os.remove(file_path)


print("Downloading Perfect Quadruped Datasets ...\n")
dataset_path_quadrupeds = dataset_path / "quadrupeds/perfect"
dataset_path_quadrupeds_str = str(dataset_path_quadrupeds)
os.makedirs(dataset_path_quadrupeds_str, exist_ok=True)
quadruped_url = "https://zenodo.org/records/10102870/files/quadruped_datasets_v0.1.zip?download=1"
wget.download(quadruped_url, out=dataset_path_quadrupeds_str)
file_name = "quadruped_datasets_v0.1.zip"
file_path = str(dataset_path_quadrupeds / file_name)
with zipfile.ZipFile(file_path, "r") as zip_ref:
zip_ref.extractall(dataset_path_quadrupeds_str)
os.remove(file_path)

6 changes: 4 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["setuptools", "wheel"]
requires = ["setuptools", "wheel", "wget"]

[project]
name = "loco-mujoco"
Expand Down Expand Up @@ -35,4 +35,6 @@ Repository = "https://github.com/robfiras/loco-mujoco"
Issues = "https://github.com/robfiras/loco-mujoco/issues"

[project.scripts]
loco-mujoco-download = "loco_mujoco:download_all_datasets"
loco-mujoco-download = "loco_mujoco.utils:download_all_datasets"
loco-mujoco-download-real = "loco_mujoco.utils:download_real_datasets"
loco-mujoco-download-perfect = "loco_mujoco.utils:download_perfect_datasets"
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from setuptools import setup, find_packages
from os import path
import glob
from loco_mujoco import __version__

Expand Down

0 comments on commit b23985b

Please sign in to comment.