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
c5cfd5fb
Commit
c5cfd5fb
authored
Jan 25, 2021
by
Rick Ho
Browse files
pass test
parent
ed69591a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
7 deletions
+21
-7
.gitignore
.gitignore
+4
-1
fmoe/moe.py
fmoe/moe.py
+2
-2
tests/dev_test.sh
tests/dev_test.sh
+13
-3
tests/moe_test.py
tests/moe_test.py
+2
-1
No files found.
.gitignore
View file @
c5cfd5fb
...
...
@@ -6,4 +6,7 @@ exp/
.vscode/
a.out
*.egg-info
*.egg
\ No newline at end of file
*.egg
build
*swp
logs
fmoe/moe.py
View file @
c5cfd5fb
...
...
@@ -8,7 +8,7 @@ from .moe_function import moe
class
FMoE
(
nn
.
Module
):
def
__init__
(
self
,
num_expert
=
32
,
in_feat
=
1024
,
out_feat
=
1024
,
world_size
=
None
):
super
(
MOELayer
,
self
).
__init__
()
super
(
FMoE
,
self
).
__init__
()
self
.
num_expert
=
num_expert
self
.
in_feat
=
in_feat
self
.
out_feat
=
out_feat
...
...
@@ -29,7 +29,7 @@ class FMoE(nn.Module):
class
BruteForceMoE
(
nn
.
Module
):
def
__init__
(
self
,
num_expert
=
32
,
in_feat
=
1024
,
out_feat
=
1024
,
world_size
=
0
):
super
(
MOELayer_raw
,
self
).
__init__
()
super
(
BruteForceMoE
,
self
).
__init__
()
self
.
num_expert
=
num_expert
self
.
in_feat
=
in_feat
self
.
out_feat
=
out_feat
...
...
tests/dev_test.sh
View file @
c5cfd5fb
...
...
@@ -4,11 +4,21 @@ then
export
CUDA_VISIBLE_DEVICES
=
$OMPI_COMM_WORLD_LOCAL_RANK
fi
export
PYTHONPATH
=
$PWD
/build/lib.linux-x86_64-3.7
if
[
-z
$OMPI_COMM_WORLD_RANK
]
then
RANK
=
single
else
RANK
=
$OMPI_COMM_WORLD_RANK
fi
mkdir
-p
logs
SCRIPT_PATH
=
$(
dirname
$(
dirname
$(
realpath
$0
)))
export
PYTHONPATH
=
$SCRIPT_PATH
:
$SCRIPT_PATH
/build/lib.linux-x86_64-3.7:
$PYTHONPATH
export
LD_LIBRARY_PATH
=
/home/laekov/.local/lib/python3.7/site-packages/torch/lib:
$LD_LIBRARY_PATH
if
[
-z
$1
]
then
python3 moe_test.py 2>logs/
$
OMPI_COMM_WORLD_
RANK
.log
python3
tests/
moe_test.py 2>logs/
$RANK
.log
else
python3
$@
2>logs/
$
OMPI_COMM_WORLD_
RANK
.log
python3
$@
2>logs/
$RANK
.log
fi
tests/moe_test.py
View file @
c5cfd5fb
from
moe
import
MOELayer
,
MOELayer_raw
from
fmoe
import
FMoE
as
MOELayer
from
fmoe
import
BruteForceMoE
as
MOELayer_raw
import
torch
from
torch
import
nn
import
time
...
...
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