chore: cleanup and HPC integration
This commit is contained in:
parent
93bff11208
commit
b4f1e98f8c
11 changed files with 4 additions and 330 deletions
|
|
@ -1,116 +0,0 @@
|
|||
from dataclasses import dataclass
|
||||
|
||||
import jax
|
||||
|
||||
|
||||
@jax.tree_util.register_dataclass
|
||||
@dataclass
|
||||
class PPOArgs:
|
||||
"""
|
||||
source: https://github.com/vwxyzjn/cleanrl/blob/master/cleanrl/ppo_atari_envpool_xla_jax_scan.py
|
||||
"""
|
||||
|
||||
# path to environment config file, if None, use default config
|
||||
env_config_path: str | None = None
|
||||
|
||||
# path to hyperparameter config file (yaml), if None, use default config
|
||||
hyperparameter_config_path: str | None = None
|
||||
|
||||
# the name of this experiment
|
||||
exp_name: str = "brittle_star_ppo"
|
||||
|
||||
# the directory to save the experiment results
|
||||
run_dir: str | None = None
|
||||
|
||||
# seed of the experiment
|
||||
seed: int = 1
|
||||
|
||||
# if toggled, `torch.backends.cudnn.deterministic=False`
|
||||
torch_deterministic: bool = True
|
||||
|
||||
# if toggled, cuda will be enabled by default
|
||||
cuda: bool = True
|
||||
|
||||
# if toggled, this experiment will be tracked with Weights and Biases
|
||||
track: bool = False
|
||||
|
||||
# the wandb's project name
|
||||
wandb_project_name: str = "PPO-Modularity"
|
||||
|
||||
# the entity (team) of wandb's project
|
||||
wandb_entity: str | None = "SEL3-2026-Groep-4"
|
||||
|
||||
# whether to capture videos of the agent performances (check out `videos` folder)
|
||||
capture_video: bool = False
|
||||
|
||||
# whether to save model into the `runs/{run_name}` folder
|
||||
save_model: bool = True
|
||||
|
||||
# checkpoint frequency (in iterations, 0 = no intermediate checkpoints)
|
||||
checkpoint_frequency: int = 100
|
||||
|
||||
# whether to upload the saved model to huggingface
|
||||
upload_model: bool = False
|
||||
|
||||
# the user or org name of the model repository from the Hugging Face Hub
|
||||
hf_entity: str = ""
|
||||
|
||||
# ==== Algorithm specific dataclasses ====
|
||||
|
||||
# total timesteps of the experiments
|
||||
total_timesteps: int = 10000000
|
||||
|
||||
# the learning rate of the optimizer
|
||||
learning_rate: float = 2.5e-4
|
||||
|
||||
# the number of parallel game environments
|
||||
num_envs: int = 100
|
||||
|
||||
# the number of steps to run in each environment per policy rollout
|
||||
num_steps: int = 128
|
||||
|
||||
# Toggle learning rate annealing for policy and value networks
|
||||
anneal_lr: bool = True
|
||||
|
||||
# the discount factor gamma
|
||||
gamma: float = 0.99
|
||||
|
||||
# the lambda for the general advantage estimation
|
||||
gae_lambda: float = 0.95
|
||||
|
||||
# the number of mini-batches
|
||||
num_minibatches: int = 4
|
||||
|
||||
# the K epochs to update the policy
|
||||
update_epochs: int = 4
|
||||
|
||||
# Toggles advantages normalization
|
||||
norm_adv: bool = True
|
||||
|
||||
# the surrogate clipping coefficient
|
||||
clip_coef: float = 0.1
|
||||
|
||||
# Toggles whether or not to use a clipped loss for the value function, as per the paper.
|
||||
clip_vloss: bool = True
|
||||
|
||||
# coefficient of the entropy
|
||||
ent_coef: float = 0.01
|
||||
|
||||
# coefficient of the value function
|
||||
vf_coef: float = 0.5
|
||||
|
||||
# the maximum norm for the gradient clipping
|
||||
max_grad_norm: float = 0.5
|
||||
|
||||
# the target KL divergence threshold
|
||||
target_kl: float | None = None
|
||||
|
||||
# ==== to be filled in runtime ====
|
||||
# the batch size (computed in runtime)
|
||||
batch_size: int = 0
|
||||
|
||||
# the mini-batch size (computed in runtime)
|
||||
minibatch_size: int = 0
|
||||
|
||||
# the number of iterations (computed in runtime)
|
||||
num_iterations: int = 0
|
||||
|
|
@ -1,8 +1,6 @@
|
|||
from .PPOArgs import PPOArgs
|
||||
from .EpisodeStatistics import EpisodeStatistics
|
||||
|
||||
|
||||
__all__ = [
|
||||
"PPOArgs",
|
||||
"EpisodeStatistics",
|
||||
]
|
||||
|
|
|
|||
Reference in a new issue