Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
FastMoE
Commits
3a0eb3e6
Unverified
Commit
3a0eb3e6
authored
May 19, 2023
by
Rick Ho
Committed by
GitHub
May 19, 2023
Browse files
Merge pull request #150 from santurini/patch-1
convert input to same type as weight for mixed precision training
parents
df715c9f
1f7c04c9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
fmoe/linear.py
fmoe/linear.py
+2
-2
No files found.
fmoe/linear.py
View file @
3a0eb3e6
...
@@ -63,14 +63,14 @@ class FMoELinear(nn.Module):
...
@@ -63,14 +63,14 @@ class FMoELinear(nn.Module):
self
.
bias
=
nn
.
Parameter
(
torch
.
zeros
(
num_expert
,
out_feat
))
self
.
bias
=
nn
.
Parameter
(
torch
.
zeros
(
num_expert
,
out_feat
))
else
:
else
:
self
.
register_parameter
(
"bias"
,
None
)
self
.
register_parameter
(
"bias"
,
None
)
self
.
reset_parameters
()
self
.
reset_parameters
()
def
forward
(
self
,
inp
,
fwd_expert_count
):
def
forward
(
self
,
inp
,
fwd_expert_count
):
r
"""
r
"""
Call MOE function
Call MOE function
"""
"""
x
=
MOELinear
.
apply
(
inp
,
fwd_expert_count
,
self
.
weight
,
self
.
bias
)
x
=
MOELinear
.
apply
(
inp
.
type_as
(
self
.
weight
)
,
fwd_expert_count
,
self
.
weight
,
self
.
bias
)
return
x
return
x
def
extra_repr
(
self
)
->
str
:
def
extra_repr
(
self
)
->
str
:
...
...
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