Skip to content

Commit

Permalink
fix(mees): add batch size property (#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
felixchalumeau authored Nov 23, 2022
1 parent 211d176 commit d7c6dc7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 14 deletions.
8 changes: 8 additions & 0 deletions qdax/core/emitters/mees_emitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,14 @@ def __init__(
else:
self._optimizer = optax.sgd(learning_rate=config.learning_rate)

@property
def batch_size(self) -> int:
"""
Returns:
the batch size emitted by the emitter.
"""
return 1

@partial(
jax.jit,
static_argnames=("self",),
Expand Down
28 changes: 14 additions & 14 deletions tests/baselines_test/mees_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from qdax.types import EnvState, Params, RNGKey


def test_mees_elites() -> None:
def test_mees() -> None:
env_name = "walker2d_uni"
episode_length = 100
num_iterations = 10
Expand All @@ -29,19 +29,19 @@ def test_mees_elites() -> None:
min_bd = 0.0
max_bd = 1.0

# @title MEES Emitter Definitions Fields
sample_number = 128 # @param {type:"integer"}
sample_sigma = 0.02 # @param {type:"number"}
num_optimizer_steps = 2 # @param {type:"integer"}
learning_rate = 0.01 # @param {type:"number"}
l2_coefficient = 0.02 # @param {type:"number"}
novelty_nearest_neighbors = 10 # @param {type:"integer"}

adam_optimizer = True # @param {type:"boolean"}
sample_mirror = True # @param {type:"boolean"}
sample_rank_norm = True # @param {type:"boolean"}
use_explore = True # @param {type:"boolean"}
use_exploit = True # @param {type:"boolean"}
# MEES Emitter params
sample_number = 128
sample_sigma = 0.02
num_optimizer_steps = 2
learning_rate = 0.01
l2_coefficient = 0.02
novelty_nearest_neighbors = 10

adam_optimizer = True
sample_mirror = True
sample_rank_norm = True
use_explore = True
use_exploit = True

# Init environment
env = environments.create(env_name, episode_length=episode_length)
Expand Down

0 comments on commit d7c6dc7

Please sign in to comment.