Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygo-agent
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Biluo Shen
ygo-agent
Commits
b725f2dc
Commit
b725f2dc
authored
Jul 13, 2024
by
sbl1996@126.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prepare for release
parent
662b300f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
16 deletions
+6
-16
scripts/cleanba.py
scripts/cleanba.py
+4
-4
scripts/eval.py
scripts/eval.py
+1
-12
setup.py
setup.py
+1
-0
No files found.
scripts/cleanba.py
View file @
b725f2dc
...
...
@@ -20,7 +20,6 @@ import optax
import
distrax
import
tyro
from
rich.pretty
import
pprint
from
tensorboardX
import
SummaryWriter
from
ygoai.utils
import
init_ygopro
,
load_embeddings
from
ygoai.rl.utils
import
RecordEpisodeStatistics
,
EnvPreprocess
...
...
@@ -55,7 +54,7 @@ class Args:
debug
:
bool
=
False
"""whether to run the script in debug mode"""
tb_dir
:
str
=
"runs"
tb_dir
:
Optional
[
str
]
=
"runs"
"""the directory to save the tensorboard logs"""
tb_offset
:
int
=
0
"""the step offset of the tensorboard logs"""
...
...
@@ -696,8 +695,9 @@ def main():
dummy_writer
=
SimpleNamespace
()
dummy_writer
.
add_scalar
=
lambda
x
,
y
,
z
:
None
tb_log_dir
=
f
"{args.tb_dir}/{run_name}"
if
args
.
local_rank
==
0
and
not
args
.
debug
:
if
args
.
local_rank
==
0
and
not
args
.
debug
and
args
.
tb_dir
is
not
None
:
from
tensorboardX
import
SummaryWriter
tb_log_dir
=
f
"{args.tb_dir}/{run_name}"
writer
=
SummaryWriter
(
tb_log_dir
)
writer
.
add_text
(
"hyperparameters"
,
...
...
scripts/eval.py
View file @
b725f2dc
...
...
@@ -210,17 +210,6 @@ if __name__ == "__main__":
for
idx
,
d
in
enumerate
(
dones
):
if
not
d
:
continue
# for i in range(2):
# deck_time = infos['step_time'][idx][i]
# deck_name = deck_names[infos['deck'][idx][i]]
# time_count = deck_time_count[deck_name]
# avg_time = deck_times[deck_name]
# avg_time = avg_time * (time_count / (time_count + 1)) + deck_time / (time_count + 1)
# deck_times[deck_name] = avg_time
# deck_time_count[deck_name] += 1
# if deck_time_count[deck_name] % 100 == 0:
# print(f"Deck {deck_name}: {avg_time:.4f}")
win_reason
=
infos
[
'win_reason'
][
idx
]
episode_length
=
infos
[
'l'
][
idx
]
...
...
@@ -235,7 +224,7 @@ if __name__ == "__main__":
if
len
(
episode_lengths
)
>=
args
.
num_episodes
:
break
print
(
f
"len={np.mean(episode_lengths)
}, reward={np.mean(episode_rewards)}, win_rate={np.mean(win_rates)}, win_reason={np.mean(win_reasons)
}"
)
print
(
f
"len={np.mean(episode_lengths)
:.4f}, reward={np.mean(episode_rewards):.4f}, win_rate={np.mean(win_rates):.4f}, win_reason={np.mean(win_reasons):.4f
}"
)
if
not
args
.
play
:
total_time
=
time
.
time
()
-
start
total_steps
=
(
step
-
start_step
)
*
num_envs
...
...
setup.py
View file @
b725f2dc
...
...
@@ -15,6 +15,7 @@ VERSION = None
REQUIRED
=
[
"tyro"
,
"pandas"
,
"tensorboardX"
,
]
here
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment