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
jerrrrry
infinilm
Commits
faaa9ec3
Commit
faaa9ec3
authored
Nov 22, 2025
by
pengcheng888
Browse files
issue/80 模型文件夹名字改为为model_path,增加moore平台的参数
parent
7d222d83
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
11 deletions
+25
-11
examples/llama.py
examples/llama.py
+15
-1
test/qwen3_atteniton_test.py
test/qwen3_atteniton_test.py
+5
-5
test/qwen3_moe_test.py
test/qwen3_moe_test.py
+5
-5
No files found.
examples/llama.py
View file @
faaa9ec3
...
@@ -31,6 +31,16 @@ def get_args():
...
@@ -31,6 +31,16 @@ def get_args():
action
=
"store_true"
,
action
=
"store_true"
,
help
=
"Run metax test"
,
help
=
"Run metax test"
,
)
)
parser
.
add_argument
(
"--moore"
,
action
=
"store_true"
,
help
=
"Run moore test"
,
)
parser
.
add_argument
(
"--iluvatar"
,
action
=
"store_true"
,
help
=
"Run iluvatar test"
,
)
parser
.
add_argument
(
parser
.
add_argument
(
"--model_path"
,
"--model_path"
,
type
=
str
,
type
=
str
,
...
@@ -141,9 +151,13 @@ if __name__ == "__main__":
...
@@ -141,9 +151,13 @@ if __name__ == "__main__":
device_type
=
"cuda"
device_type
=
"cuda"
elif
args
.
metax
:
elif
args
.
metax
:
device_type
=
"cuda"
device_type
=
"cuda"
elif
args
.
moore
:
device_type
=
"musa"
elif
args
.
iluvatar
:
device_type
=
"cuda"
else
:
else
:
print
(
print
(
"Usage: python examples/llama.py [--cpu | --nvidia] --model_path=<path/to/model_dir>"
"Usage: python examples/llama.py [--cpu | --nvidia
| --metax | --moore | --iluvatar
] --model_path=<path/to/model_dir>"
)
)
sys
.
exit
(
1
)
sys
.
exit
(
1
)
...
...
test/qwen3_atteniton_test.py
View file @
faaa9ec3
...
@@ -25,7 +25,7 @@ def get_args():
...
@@ -25,7 +25,7 @@ def get_args():
parser
=
argparse
.
ArgumentParser
(
description
=
"Test Operator"
)
parser
=
argparse
.
ArgumentParser
(
description
=
"Test Operator"
)
parser
.
add_argument
(
parser
.
add_argument
(
"--model_
dir
"
,
"--model_
path
"
,
action
=
"store"
,
action
=
"store"
,
help
=
"The directory of the model to be tested"
,
help
=
"The directory of the model to be tested"
,
)
)
...
@@ -55,7 +55,7 @@ def get_args():
...
@@ -55,7 +55,7 @@ def get_args():
parser
.
add_argument
(
parser
.
add_argument
(
"--iluvatar"
,
"--iluvatar"
,
action
=
"store_true"
,
action
=
"store_true"
,
help
=
"Run
moore
test"
,
help
=
"Run
iluvatar
test"
,
)
)
return
parser
.
parse_args
()
return
parser
.
parse_args
()
...
@@ -400,7 +400,7 @@ if __name__ == "__main__":
...
@@ -400,7 +400,7 @@ if __name__ == "__main__":
args
=
get_args
()
args
=
get_args
()
print
(
args
)
print
(
args
)
model_
dir
=
args
.
model_
dir
model_
path
=
args
.
model_
path
dtype
=
torch
.
bfloat16
dtype
=
torch
.
bfloat16
# Parse command line arguments
# Parse command line arguments
...
@@ -417,7 +417,7 @@ if __name__ == "__main__":
...
@@ -417,7 +417,7 @@ if __name__ == "__main__":
device
=
"cuda"
device
=
"cuda"
else
:
else
:
print
(
print
(
"Usage: python test/qwen3_atteniton_test.py [--cpu | --nvidia | --metax | --moore | --iluvatar] --model_
dir
=<path/to/model_
dir
>"
"Usage: python test/qwen3_atteniton_test.py [--cpu | --nvidia | --metax | --moore | --iluvatar] --model_
path
=<path/to/model_
path
>"
)
)
sys
.
exit
(
1
)
sys
.
exit
(
1
)
...
@@ -425,7 +425,7 @@ if __name__ == "__main__":
...
@@ -425,7 +425,7 @@ if __name__ == "__main__":
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
model
,
rotary_emb
=
create_Qwen3attention_torch
(
model
,
rotary_emb
=
create_Qwen3attention_torch
(
model_
dir
,
device
=
device
,
dtype
=
dtype
model_
path
,
device
=
device
,
dtype
=
dtype
)
)
print
(
"
\n
"
)
print
(
"
\n
"
)
print
(
"*"
*
130
)
print
(
"*"
*
130
)
...
...
test/qwen3_moe_test.py
View file @
faaa9ec3
...
@@ -25,7 +25,7 @@ def get_args():
...
@@ -25,7 +25,7 @@ def get_args():
parser
=
argparse
.
ArgumentParser
(
description
=
"Test Operator"
)
parser
=
argparse
.
ArgumentParser
(
description
=
"Test Operator"
)
parser
.
add_argument
(
parser
.
add_argument
(
"--model_
dir
"
,
"--model_
path
"
,
action
=
"store"
,
action
=
"store"
,
help
=
"The directory of the model to be tested"
,
help
=
"The directory of the model to be tested"
,
)
)
...
@@ -55,7 +55,7 @@ def get_args():
...
@@ -55,7 +55,7 @@ def get_args():
parser
.
add_argument
(
parser
.
add_argument
(
"--iluvatar"
,
"--iluvatar"
,
action
=
"store_true"
,
action
=
"store_true"
,
help
=
"Run
moore
test"
,
help
=
"Run
iluvatar
test"
,
)
)
return
parser
.
parse_args
()
return
parser
.
parse_args
()
...
@@ -111,7 +111,7 @@ if __name__ == "__main__":
...
@@ -111,7 +111,7 @@ if __name__ == "__main__":
args
=
get_args
()
args
=
get_args
()
print
(
args
)
print
(
args
)
model_
dir
=
args
.
model_
dir
model_
path
=
args
.
model_
path
dtype
=
torch
.
bfloat16
dtype
=
torch
.
bfloat16
# Parse command line arguments
# Parse command line arguments
device
=
"cpu"
device
=
"cpu"
...
@@ -127,7 +127,7 @@ if __name__ == "__main__":
...
@@ -127,7 +127,7 @@ if __name__ == "__main__":
device
=
"cuda"
device
=
"cuda"
else
:
else
:
print
(
print
(
"Usage: python test/qwen3_
atteniton
_test.py [--cpu | --nvidia | --metax | --moore | --iluvatar] --model_
dir
=<path/to/model_
dir
>"
"Usage: python test/qwen3_
moe
_test.py [--cpu | --nvidia | --metax | --moore | --iluvatar] --model_
path
=<path/to/model_
path
>"
)
)
sys
.
exit
(
1
)
sys
.
exit
(
1
)
...
@@ -135,7 +135,7 @@ if __name__ == "__main__":
...
@@ -135,7 +135,7 @@ if __name__ == "__main__":
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
moe
=
create_moe_torch
(
model_
dir
,
device
=
device
,
dtype
=
dtype
)
moe
=
create_moe_torch
(
model_
path
,
device
=
device
,
dtype
=
dtype
)
print
(
"*"
*
130
)
print
(
"*"
*
130
)
print
(
"Test Qwen3 MoE"
)
print
(
"Test Qwen3 MoE"
)
...
...
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