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
e7d409ec
Commit
e7d409ec
authored
Jun 01, 2024
by
sbl1996@126.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add agent version 2
parent
f94a7fc3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
4 deletions
+9
-4
ygoai/rl/jax/agent.py
ygoai/rl/jax/agent.py
+6
-1
ygoai/rl/jax/modules.py
ygoai/rl/jax/modules.py
+3
-3
No files found.
ygoai/rl/jax/agent.py
View file @
e7d409ec
...
...
@@ -406,6 +406,11 @@ class Encoder(nn.Module):
f_state
=
jnp
.
concatenate
(
g_feats
,
axis
=-
1
)
oc
=
self
.
out_channels
or
c
if
self
.
version
==
2
:
f_state
=
GLUMlp
(
intermediate_size
=
c
*
2
,
output_size
=
oc
,
dtype
=
self
.
dtype
,
param_dtype
=
self
.
param_dtype
)(
f_state
)
else
:
f_state
=
MLP
((
c
*
2
,
oc
),
dtype
=
self
.
dtype
,
param_dtype
=
self
.
param_dtype
)(
f_state
)
f_state
=
layer_norm
(
dtype
=
self
.
dtype
)(
f_state
)
return
f_actions
,
f_state
,
a_mask
,
valid
...
...
ygoai/rl/jax/modules.py
View file @
e7d409ec
...
...
@@ -57,6 +57,7 @@ class MLP(nn.Module):
class
GLUMlp
(
nn
.
Module
):
intermediate_size
:
int
output_size
:
Optional
[
int
]
=
None
dtype
:
Optional
[
jnp
.
dtype
]
=
None
param_dtype
:
jnp
.
dtype
=
jnp
.
float32
kernel_init
:
nn
.
initializers
.
Initializer
=
nn
.
initializers
.
lecun_normal
()
...
...
@@ -74,8 +75,7 @@ class GLUMlp(nn.Module):
kernel_init
=
self
.
kernel_init
,
)
for
_
in
range
(
3
)
]
actual_out_dim
=
inputs
.
shape
[
-
1
]
output_size
=
self
.
output_size
or
inputs
.
shape
[
-
1
]
g
=
dense
[
0
](
features
=
self
.
intermediate_size
,
name
=
"gate"
,
...
...
@@ -86,7 +86,7 @@ class GLUMlp(nn.Module):
name
=
"up"
,
)(
inputs
)
x
=
dense
[
2
](
features
=
actual_out_dim
,
features
=
output_size
,
name
=
"down"
,
)(
x
)
return
x
...
...
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