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

[pre-commit.ci] pre-commit autoupdate #1

Open
wants to merge 2 commits into
base: master
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
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v5.0.0
hooks:
- id: check-yaml
- id: requirements-txt-fixer
- id: trailing-whitespace
- repo: https://github.com/psf/black
rev: 22.10.0
rev: 24.10.0
hooks:
- id: black
- repo: https://github.com/nbQA-dev/nbQA
rev: 1.5.2
rev: 1.9.1
hooks:
- id: nbqa-black
- id: nbqa-isort
# - id: nbqa-flake8
- repo: https://github.com/PyCQA/isort
rev: 5.10.1
rev: 5.13.2
hooks:
- id: isort
# - repo: https://github.com/pycqa/flake8
Expand Down
2 changes: 1 addition & 1 deletion experiments/plot/plot_gifs.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def plot_gif(
fig=fig,
func=update_custom,
frames=num_episodes,
interval=250
interval=250,
# interval=150
)
pathlib.Path(save_name).parents[0].mkdir(parents=True, exist_ok=True)
Expand Down
4 changes: 1 addition & 3 deletions moderl/controllers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ def control_dim(self) -> int:
class TrajectoryOptimisationController(ControllerInterface):
trajectory_optimiser: TrajectoryOptimiser

def __call__(
self, timestep: Optional[int] = None, dist: bool = False
) -> Union[
def __call__(self, timestep: Optional[int] = None, dist: bool = False) -> Union[
tfd.Distribution,
Union[ttf.Tensor1[ControlDim], ttf.Tensor2[Horizon, ControlDim]],
]:
Expand Down
6 changes: 3 additions & 3 deletions moderl/objectives.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def bernoulli_entropy(
mode_probs = dynamics.mosvgpe.gating_network.gp.likelihood.predict_mean_and_var(
input_dists.mean(),
Fmu=h_means,
Fvar=h_covs
Fvar=h_covs,
# input_means, Fmu=h_means, Fvar=h_vars
)[0]
print("mode_probs.shape")
Expand Down Expand Up @@ -224,7 +224,7 @@ def bald_objective_sampling(input_dists):
h_samples = dynamics.mosvgpe.gating_network.gp.predict_f_samples(
input_dists.mean(),
num_samples=10,
full_cov=False
full_cov=False,
# input_dists.mean(), num_samples=10, full_cov=True
)
print("h_samples")
Expand Down Expand Up @@ -339,7 +339,7 @@ def entropy_approx(h_means, h_vars, mode_probs):
def bald_objective_closed_form():
h_means, h_vars = dynamics.mosvgpe.gating_network.gp.predict_f(
input_dists.mean(),
full_cov=True
full_cov=True,
# full_cov=False
# input_dists.mean(), full_cov=True
)
Expand Down
1 change: 1 addition & 0 deletions subtrees/mosvgpe/mosvgpe/mixture_of_experts.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

logger = logging.getLogger(__name__)


# class MixtureOfExpertsBase(gpf.models.BayesianModel, abc.ABC):
# class MixtureOfExpertsBase(tf.keras.Model, abc.ABC):
class MixtureOfExpertsBase(tf.keras.Model, BayesianModel, abc.ABC):
Expand Down
5 changes: 4 additions & 1 deletion subtrees/simenvs/simenvs/point_mass/generate_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ def generate_point_mass_dataset(
toml_env_config_file, gating_bitmap_filename=gating_bitmap_file
)

(state_action_inputs, delta_state_outputs,) = generate_transitions_dataset(
(
state_action_inputs,
delta_state_outputs,
) = generate_transitions_dataset(
num_states=num_states,
num_actions=num_actions,
env=env,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ gating_bitmap = "./bitmaps/gating_mask.bmp" # filename for gating bitmap
# gating_bitmap = "../scenario-1/gating_mask.bmp" # filename for gating bitmap

# lists are converted to 1D np.arrays and floats/ints are broadcast
# e.g min_state = [-3.0, -2.0] is converted with np.array(min_state)
# e.g min_state = [-3.0, -2.0] is converted with np.array(min_state)
# state constraints
min_state = [-3.0, -2.0]
max_state = [3.0, 3.0]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@
# configure environment from toml config file
env = parse_toml_config_to_VelocityControlledQuadcopter2DEnv(toml_env_config_file)

(state_action_inputs, delta_state_outputs,) = generate_transitions_dataset_const_action(
(
state_action_inputs,
delta_state_outputs,
) = generate_transitions_dataset_const_action(
action, num_states=num_states, env=env, omit_data_mask=omit_data_mask
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
# configure environment from toml config file
env = parse_toml_config_to_VelocityControlledQuadcopter2DEnv(toml_env_config_file)

(state_action_inputs, delta_state_outputs,) = generate_transitions_dataset(
(
state_action_inputs,
delta_state_outputs,
) = generate_transitions_dataset(
num_states=num_states,
num_actions=num_actions,
env=env,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ def generate_point_mass_dataset(
toml_env_config_file, gating_bitmap_filename=gating_bitmap_file
)

(state_action_inputs, delta_state_outputs,) = generate_transitions_dataset(
(
state_action_inputs,
delta_state_outputs,
) = generate_transitions_dataset(
num_states=num_states,
num_actions=num_actions,
env=env,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ gating_bitmap = "./bitmaps/gating_mask.bmp" # filename for gating bitmap
# gating_bitmap = "../scenario-1/gating_mask.bmp" # filename for gating bitmap

# lists are converted to 1D np.arrays and floats/ints are broadcast
# e.g min_state = [-3.0, -2.0] is converted with np.array(min_state)
# e.g min_state = [-3.0, -2.0] is converted with np.array(min_state)
# state constraints
min_state = [-3.0, -3.0]
# min_state = [-3.0, -3.0]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ gating_bitmap = "./bitmaps/gating_mask.bmp" # filename for gating bitmap
# gating_bitmap = "../scenario-1/gating_mask.bmp" # filename for gating bitmap

# lists are converted to 1D np.arrays and floats/ints are broadcast
# e.g min_state = [-3.0, -2.0] is converted with np.array(min_state)
# e.g min_state = [-3.0, -2.0] is converted with np.array(min_state)
# state constraints
min_state = [-3.0, -2.0]
max_state = [3.0, 3.0]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ gating_bitmap = "./bitmaps/gating_mask.bmp" # filename for gating bitmap
# gating_bitmap = "../scenario-1/gating_mask.bmp" # filename for gating bitmap

# lists are converted to 1D np.arrays and floats/ints are broadcast
# e.g min_state = [-3.0, -2.0] is converted with np.array(min_state)
# e.g min_state = [-3.0, -2.0] is converted with np.array(min_state)
# state constraints
min_state = [-3.0, -2.0]
max_state = [3.0, 3.0]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ gating_bitmap = "./bitmaps/gating_mask.bmp" # filename for gating bitmap
# gating_bitmap = "../scenario-1/gating_mask.bmp" # filename for gating bitmap

# lists are converted to 1D np.arrays and floats/ints are broadcast
# e.g min_state = [-3.0, -2.0] is converted with np.array(min_state)
# e.g min_state = [-3.0, -2.0] is converted with np.array(min_state)
# state constraints
min_state = [-3.0, -2.0]
max_state = [3.0, 3.0]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ gating_bitmap = "./bitmaps/gating_mask.bmp" # filename for gating bitmap
# gating_bitmap = "../scenario-1/gating_mask.bmp" # filename for gating bitmap

# lists are converted to 1D np.arrays and floats/ints are broadcast
# e.g min_state = [-3.0, -2.0] is converted with np.array(min_state)
# e.g min_state = [-3.0, -2.0] is converted with np.array(min_state)
# state constraints
min_state = [-3.1, -3.0]
# min_state = [-3.0, -3.0]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ gating_bitmap = "./bitmaps/gating_mask.bmp" # filename for gating bitmap
# gating_bitmap = "../scenario-1/gating_mask.bmp" # filename for gating bitmap

# lists are converted to 1D np.arrays and floats/ints are broadcast
# e.g min_state = [-3.0, -2.0] is converted with np.array(min_state)
# e.g min_state = [-3.0, -2.0] is converted with np.array(min_state)
# state constraints
min_state = [-3.0, -2.0]
max_state = [3.0, 3.0]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ gating_bitmap = "./bitmaps/gating_mask.bmp" # filename for gating bitmap
# gating_bitmap = "../scenario-1/gating_mask.bmp" # filename for gating bitmap

# lists are converted to 1D np.arrays and floats/ints are broadcast
# e.g min_state = [-3.0, -2.0] is converted with np.array(min_state)
# e.g min_state = [-3.0, -2.0] is converted with np.array(min_state)
# state constraints
min_state = [-3.0, -3.0]
max_state = [3.0, 3.0]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ gating_bitmap = "./bitmaps/gating_mask.bmp" # filename for gating bitmap
# gating_bitmap = "../scenario-1/gating_mask.bmp" # filename for gating bitmap

# lists are converted to 1D np.arrays and floats/ints are broadcast
# e.g min_state = [-3.0, -2.0] is converted with np.array(min_state)
# e.g min_state = [-3.0, -2.0] is converted with np.array(min_state)
# state constraints
min_state = [-3.0, -3.0]
max_state = [3.0, 3.0]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ gating_bitmap = "./bitmaps/gating_mask.bmp" # filename for gating bitmap
# gating_bitmap = "../scenario-1/gating_mask.bmp" # filename for gating bitmap

# lists are converted to 1D np.arrays and floats/ints are broadcast
# e.g min_state = [-3.0, -2.0] is converted with np.array(min_state)
# e.g min_state = [-3.0, -2.0] is converted with np.array(min_state)
# state constraints
min_state = [-3.0, -3.0]
max_state = [3.0, 3.0]
Expand Down