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
366e5f3b
Commit
366e5f3b
authored
Feb 25, 2024
by
sbl1996@126.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add ppo_sp
parent
598465e8
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
503 additions
and
4 deletions
+503
-4
docs/features.md
docs/features.md
+14
-0
scripts/eval.py
scripts/eval.py
+7
-3
scripts/ppo.py
scripts/ppo.py
+1
-1
scripts/ppo_sp.py
scripts/ppo_sp.py
+480
-0
ygoai/rl/agent.py
ygoai/rl/agent.py
+1
-0
No files found.
docs/features.md
View file @
366e5f3b
...
...
@@ -18,6 +18,20 @@
## Global
-
lp: 2, max 65535 to 2 bytes
-
oppo_lp: 2, max 65535 to 2 bytes
-
n_my_decks: 1, int
-
n_my_extras:
-
n_my_hands:
-
n_my_graves:
-
n_my_removes:
-
n_my_monsters:
-
n_my_spell_traps:
-
n_op_decks:
-
n_op_extras:
-
n_op_hands:
-
n_op_graves:
-
n_op_removes:
-
n_op_monsters:
-
n_op_spell_traps:
-
turn: 1, int, trunc to 8
-
phase: 1, int, one-hot (10)
-
is_first: 1, int, 0: False, 1: True
...
...
scripts/eval.py
View file @
366e5f3b
...
...
@@ -43,6 +43,8 @@ class Args:
"""the maximum number of options"""
n_history_actions
:
int
=
16
"""the number of history actions to use"""
num_embeddings
:
Optional
[
int
]
=
None
"""the number of embeddings of the agent"""
player
:
int
=
-
1
"""the player to play as, -1 means random, 0 is the first player, 1 is the second player"""
...
...
@@ -138,6 +140,8 @@ if __name__ == "__main__":
if
args
.
agent
:
# count lines of code_list
embedding_shape
=
args
.
num_embeddings
if
embedding_shape
is
None
:
with
open
(
args
.
code_list_file
,
"r"
)
as
f
:
code_list
=
f
.
readlines
()
embedding_shape
=
len
(
code_list
)
...
...
scripts/ppo.py
View file @
366e5f3b
scripts/ppo_sp.py
0 → 100644
View file @
366e5f3b
This diff is collapsed.
Click to expand it.
ygoai/rl/agent.py
View file @
366e5f3b
...
...
@@ -105,6 +105,7 @@ class Encoder(nn.Module):
self
.
a_option_embed
=
nn
.
Embedding
(
6
,
c
//
divisor
//
2
)
self
.
a_number_embed
=
nn
.
Embedding
(
13
,
c
//
divisor
//
2
)
self
.
a_place_embed
=
nn
.
Embedding
(
31
,
c
//
divisor
//
2
)
# TODO: maybe same embedding as attribute_embed
self
.
a_attrib_embed
=
nn
.
Embedding
(
10
,
c
//
divisor
//
2
)
self
.
a_feat_norm
=
nn
.
LayerNorm
(
c
,
elementwise_affine
=
affine
)
...
...
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