Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated dmc and atari #1

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions hsuanwuhub/datasets/atari_100k.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from typing import Dict
from huggingface_hub import hf_hub_download
import pandas as pd
import numpy as np


class Atari_100k(object):
def __init__(self) -> None:
file = hf_hub_download(
repo_id="RLE-Foundation/HsuanwuHub",
repo_type="dataset",
filename="atari_100k.json",
subfolder="datasets"
)
self.atari_100k_data = pd.read_json(file)

def load_scores(self) -> Dict[str, np.ndarray]:
"""Returns final performance"""
scores_dict = dict()
for algo in self.atari_100k_data.keys():
scores_dict[algo] = np.array([value for _, value in self.atari_100k_data[algo].items()]).T

return scores_dict

def load_curves(self) -> np.ndarray:
pass
27 changes: 27 additions & 0 deletions hsuanwuhub/datasets/atari_200_iters.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from typing import Dict
from huggingface_hub import hf_hub_download
import numpy as np


class Atari_200_iters(object):
def __init__(self) -> None:
file = hf_hub_download(
repo_id="RLE-Foundation/HsuanwuHub",
repo_type="dataset",
filename="atari_200_iters_normalized_scores.npy",
subfolder="datasets"
)

with open(file, 'rb') as f:
atari_200m_scores = np.load(f, allow_pickle=True)
atari_200m_scores = atari_200m_scores.tolist()
for key, val in atari_200m_scores.items():
atari_200m_scores[key] = np.transpose(val, axes=(1, 2, 0))
self.atari_200_iters_normalized_scores = atari_200m_scores

def load_scores(self) -> Dict[str, np.ndarray]:
"""Returns final performance"""
return self.atari_200_iters_normalized_scores

def load_curves(self) -> np.ndarray:
pass
26 changes: 26 additions & 0 deletions hsuanwuhub/datasets/dm_control.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from typing import Dict
from huggingface_hub import hf_hub_download
import pandas as pd
import numpy as np


class DM_Control(object):
def __init__(self) -> None:
file = hf_hub_download(
repo_id="RLE-Foundation/HsuanwuHub",
repo_type="dataset",
filename="dm_control.json",
subfolder="datasets"
)
self.dm_control_data = pd.read_json(file)

def load_scores(self) -> Dict[str, np.ndarray]:
"""Returns final performance"""
scores_dict = dict()
for algo in self.dm_control_data.keys():
scores_dict[algo] = np.array([value for _, value in self.dm_control_data[algo].items()]).T

return scores_dict

def load_curves(self) -> np.ndarray:
pass