Commit 0c7cfc92 authored by biluo.shen's avatar biluo.shen

Remove card of announce_card

parent 987146ea
......@@ -48,7 +48,6 @@
65330383
38342335
2857636
28776350
75452921
3987233
3987233
......
......@@ -88,6 +88,8 @@ class Args:
env_threads: Optional[int] = 32
"""the number of threads to use for envpool, defaults to `num_envs`"""
tb_dir: str = "./runs"
"""tensorboard log directory"""
# to be filled in runtime
num_iterations: int = 0
......@@ -109,7 +111,7 @@ if __name__ == "__main__":
run_name = f"{args.env_id}__{args.exp_name}__{args.seed}__{timestamp}"
from torch.utils.tensorboard import SummaryWriter
writer = SummaryWriter(f"runs/{run_name}")
writer = SummaryWriter(os.path.join(args.tb_dir, run_name))
writer.add_text(
"hyperparameters",
"|param|value|\n|-|-|\n%s" % ("\n".join([f"|{key}|{value}|" for key, value in vars(args).items()])),
......@@ -164,7 +166,7 @@ if __name__ == "__main__":
avg_win_rates = []
avg_ep_returns = []
elo = Elo()
# elo = Elo()
selfplay = "self" in args.play_mode
rb = DMCDictBuffer(
......@@ -235,15 +237,13 @@ if __name__ == "__main__":
else:
# win rate of agent
winner = 0 if episode_reward > 0 else 1
elo.update(winner)
writer.add_scalar("charts/elo_rating", elo.r0, global_step)
# elo.update(winner)
else:
avg_ep_returns.append(episode_reward)
winner = 0 if episode_reward > 0 else 1
avg_win_rates.append(1 - winner)
elo.update(winner)
writer.add_scalar("charts/elo_rating", elo.r0, global_step)
print(f"global_step={global_step}, e_ret={episode_reward}, e_len={episode_length}, elo={elo.r0}")
# elo.update(winner)
print(f"global_step={global_step}, e_ret={episode_reward}, e_len={episode_length}")
if len(avg_win_rates) > 100:
writer.add_scalar("charts/avg_win_rate", np.mean(avg_win_rates), global_step)
......
......@@ -1454,11 +1454,11 @@ public:
}
void show_deck(const std::vector<CardCode> &deck, const std::string &prefix) const {
fmt::print("{} deck:", prefix);
for (auto code : deck) {
fmt::print(" {}", c_get_card(code).name());
fmt::print("{} deck: [", prefix);
for (int i = 0; i < deck.size(); i++) {
fmt::print(" '{}'", c_get_card(deck[i]).name());
}
fmt::print("\n");
fmt::print(" ]\n");
}
void show_turn() const {
......@@ -3961,6 +3961,8 @@ private:
set_responsei(pduel_, 1 << pos);
};
} else {
show_deck(0);
show_deck(1);
throw std::runtime_error(
fmt::format("Unknown message {}, length {}, dp {}",
msg_to_string(msg_), dl_, dp_));
......
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