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
d3f71f21
Unverified
Commit
d3f71f21
authored
May 26, 2022
by
Rick Ho
Committed by
GitHub
May 26, 2022
Browse files
Merge pull request #113 from laekov/compat-fix
Fix smart schedule with older PyTorch
parents
5083a736
db247e85
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
fmoe/fastermoe/schedule.py
fmoe/fastermoe/schedule.py
+7
-2
No files found.
fmoe/fastermoe/schedule.py
View file @
d3f71f21
...
@@ -33,8 +33,13 @@ class MoEForward(Function):
...
@@ -33,8 +33,13 @@ class MoEForward(Function):
x
=
x
.
data
x
=
x
.
data
with
torch
.
enable_grad
():
with
torch
.
enable_grad
():
x
.
requires_grad
=
True
x
.
requires_grad
=
True
# To skip torch autograd's version check.
try
:
with
torch
.
autograd
.
graph
.
saved_tensors_hooks
(
nothing
,
nothing
):
# To skip torch autograd's version check.
with
torch
.
autograd
.
graph
.
saved_tensors_hooks
(
nothing
,
nothing
):
y0
=
expert_fn
(
x
,
torch
.
tensor
([
x
.
shape
[
0
]],
dtype
=
torch
.
int64
))
except
Exception
as
e
:
# Ignore the error and fall back for compatibility to older
# versions of PyTorch
y0
=
expert_fn
(
x
,
torch
.
tensor
([
x
.
shape
[
0
]],
dtype
=
torch
.
int64
))
y0
=
expert_fn
(
x
,
torch
.
tensor
([
x
.
shape
[
0
]],
dtype
=
torch
.
int64
))
ctx
.
gibs
[
idx
]
=
x
ctx
.
gibs
[
idx
]
=
x
ctx
.
gobs
[
idx
]
=
y0
ctx
.
gobs
[
idx
]
=
y0
...
...
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