mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-13 15:52:04 +00:00
feat(*): Add bot-vs-bot Spectate mode with main-menu entry, entropy-control flags (--ent-coef, --reset-std) for resumed training runs, and a Linux/3090 remote-training guide (TRAINING_LINUX.md)
This commit is contained in:
+18
-3
@@ -39,6 +39,13 @@ def parse_args():
|
||||
parser.add_argument("--port", type=int, default=11008, help="Base TCP port (one per instance)")
|
||||
parser.add_argument("--seed", type=int, default=0)
|
||||
parser.add_argument("--resume", default=None, help="Checkpoint .zip to resume from")
|
||||
parser.add_argument("--ent-coef", type=float, default=0.0001, help="Entropy bonus coefficient (applied on resume too)")
|
||||
parser.add_argument(
|
||||
"--reset-std",
|
||||
type=float,
|
||||
default=None,
|
||||
help="On resume, reset the policy action std to this value (recovers exploration after entropy collapse)",
|
||||
)
|
||||
parser.add_argument("--checkpoint-every", type=int, default=100_000, help="Timesteps between checkpoints")
|
||||
parser.add_argument("--viz", action="store_true", help="Show game windows (debugging; slow)")
|
||||
parser.add_argument("--wandb", action="store_true", help="Also log to Weights & Biases")
|
||||
@@ -67,14 +74,22 @@ def main():
|
||||
env = VecMonitor(env)
|
||||
|
||||
if args.resume:
|
||||
model = PPO.load(args.resume, env=env, tensorboard_log=str(log_dir))
|
||||
print(f"Resumed from {args.resume} at {model.num_timesteps} timesteps")
|
||||
model = PPO.load(args.resume, env=env, tensorboard_log=str(log_dir), ent_coef=args.ent_coef)
|
||||
print(f"Resumed from {args.resume} at {model.num_timesteps} timesteps (ent_coef={args.ent_coef})")
|
||||
if args.reset_std is not None:
|
||||
import math
|
||||
|
||||
import torch
|
||||
|
||||
with torch.no_grad():
|
||||
model.policy.log_std.fill_(math.log(args.reset_std))
|
||||
print(f"Reset policy action std to {args.reset_std}")
|
||||
else:
|
||||
model = PPO(
|
||||
"MultiInputPolicy",
|
||||
env,
|
||||
verbose=1,
|
||||
ent_coef=0.0001,
|
||||
ent_coef=args.ent_coef,
|
||||
n_steps=256,
|
||||
batch_size=256,
|
||||
learning_rate=3e-4,
|
||||
|
||||
Reference in New Issue
Block a user