Skip to content

Commit

Permalink
Make the policy training deterministic
Browse files Browse the repository at this point in the history
  • Loading branch information
mosayebshams committed Jun 12, 2023
1 parent 7562e57 commit 9bb6307
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion closed_loop_AFC/jet_cylinder/ppo_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,9 +385,11 @@ def parse_args():
logger.error("wandb is not installed, run `pip install gymprecice[vis]`")
raise err

# TRY NOT TO MODIFY: seeding
# deterministic training
random.seed(args.seed)
np.random.seed(args.seed)
torch.manual_seed(args.seed)
torch.backends.cudnn.deterministic = args.torch_deterministic

def make_env(options, idx, wrappers=None):
def _make_env():
Expand Down
4 changes: 3 additions & 1 deletion closed_loop_AFC/rotating_cylinder/ppo_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,9 +390,11 @@ def parse_args():
logger.error("wandb is not installed, run `pip install gymprecice[vis]`")
raise err

# TRY NOT TO MODIFY: seeding
# deterministic training
random.seed(args.seed)
np.random.seed(args.seed)
torch.manual_seed(args.seed)
torch.backends.cudnn.deterministic = args.torch_deterministic

def make_env(options, idx, wrappers=None):
def _make_env():
Expand Down

0 comments on commit 9bb6307

Please sign in to comment.