Commit 4ae87a70 authored by sbl1996@126.com's avatar sbl1996@126.com

Refactor seed

parent cb324901
......@@ -620,11 +620,16 @@ def main():
args.ckpt_dir, save_fn, n_saved=2)
# seeding
seed_offset = args.local_rank
args.seed += seed_offset
random.seed(args.seed)
seed = random.randint(0, 1e8)
seed_offset = args.local_rank
seed += seed_offset
init_key = jax.random.PRNGKey(seed - seed_offset)
random.seed(seed)
args.real_seed = random.randint(0, 1e8)
init_key = jax.random.PRNGKey(args.seed - seed_offset)
key = jax.random.PRNGKey(args.real_seed)
key, *learner_keys = jax.random.split(key, len(learner_devices) + 1)
learner_keys = jax.device_put_sharded(learner_keys, devices=learner_devices)
......
......@@ -1726,7 +1726,7 @@ public:
throw std::runtime_error("record mode must be used with verbose mode and num_envs=1");
}
}
fmt::println("env_id: {}, seed: {}, x: {}", env_id_, seed_, dist_int_(gen_));
// fmt::println("env_id: {}, seed: {}, x: {}", env_id_, seed_, dist_int_(gen_));
duel_gen_ = std::mt19937(dist_int_(gen_));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment