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
67e8d6e9
Commit
67e8d6e9
authored
Jan 29, 2026
by
wooway777
Browse files
issue/208 - adapt to ali ppu
parent
6cc680ba
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
3 deletions
+23
-3
examples/bench.py
examples/bench.py
+7
-0
examples/jiuge.py
examples/jiuge.py
+8
-1
python/infinilm/server/inference_server.py
python/infinilm/server/inference_server.py
+4
-1
scripts/jiuge.py
scripts/jiuge.py
+3
-1
scripts/libinfinicore_infer/base.py
scripts/libinfinicore_infer/base.py
+1
-0
No files found.
examples/bench.py
View file @
67e8d6e9
...
@@ -157,6 +157,11 @@ def get_args():
...
@@ -157,6 +157,11 @@ def get_args():
action
=
"store_true"
,
action
=
"store_true"
,
help
=
"Run cambricon test"
,
help
=
"Run cambricon test"
,
)
)
parser
.
add_argument
(
"--ali"
,
action
=
"store_true"
,
help
=
"Run alippu test"
,
)
parser
.
add_argument
(
parser
.
add_argument
(
"--model"
,
"--model"
,
type
=
str
,
type
=
str
,
...
@@ -351,6 +356,8 @@ if __name__ == "__main__":
...
@@ -351,6 +356,8 @@ if __name__ == "__main__":
device_str
=
"cuda"
device_str
=
"cuda"
elif
args
.
cambricon
:
elif
args
.
cambricon
:
device_str
=
"mlu"
device_str
=
"mlu"
elif
args
.
ali
:
device_str
=
"cuda"
else
:
else
:
print
(
print
(
"python examples/bench.py --nvidia --model=~/TinyLlama-1.1B-Chat-v1.0/ --batch-size=2 --tp=1 --input-len=50 --output-len=50"
"python examples/bench.py --nvidia --model=~/TinyLlama-1.1B-Chat-v1.0/ --batch-size=2 --tp=1 --input-len=50 --output-len=50"
...
...
examples/jiuge.py
View file @
67e8d6e9
...
@@ -47,6 +47,11 @@ def get_args():
...
@@ -47,6 +47,11 @@ def get_args():
action
=
"store_true"
,
action
=
"store_true"
,
help
=
"Run cambricon test"
,
help
=
"Run cambricon test"
,
)
)
parser
.
add_argument
(
"--ali"
,
action
=
"store_true"
,
help
=
"Run alippu test"
,
)
parser
.
add_argument
(
parser
.
add_argument
(
"--hygon"
,
"--hygon"
,
action
=
"store_true"
,
action
=
"store_true"
,
...
@@ -257,11 +262,13 @@ if __name__ == "__main__":
...
@@ -257,11 +262,13 @@ if __name__ == "__main__":
device_str
=
"cuda"
device_str
=
"cuda"
elif
args
.
cambricon
:
elif
args
.
cambricon
:
device_str
=
"mlu"
device_str
=
"mlu"
elif
args
.
ali
:
device_str
=
"cuda"
elif
args
.
hygon
:
elif
args
.
hygon
:
device_str
=
"cuda"
device_str
=
"cuda"
else
:
else
:
print
(
print
(
"Usage: python examples/jiuge.py [--cpu | --nvidia | --metax | --moore | --iluvatar | --cambricon | --hygon] --model_path=<path/to/model_dir>
\n
"
"Usage: python examples/jiuge.py [--cpu | --nvidia | --metax | --moore | --iluvatar | --cambricon |
--ali |
--hygon] --model_path=<path/to/model_dir>
\n
"
"such as, python examples/jiuge.py --nvidia --model_path=~/TinyLlama-1.1B-Chat-v1.0"
"such as, python examples/jiuge.py --nvidia --model_path=~/TinyLlama-1.1B-Chat-v1.0"
)
)
sys
.
exit
(
1
)
sys
.
exit
(
1
)
...
...
python/infinilm/server/inference_server.py
View file @
67e8d6e9
...
@@ -487,6 +487,7 @@ def parse_args():
...
@@ -487,6 +487,7 @@ def parse_args():
parser
.
add_argument
(
"--moore"
,
action
=
"store_true"
,
help
=
"Use Moore device"
)
parser
.
add_argument
(
"--moore"
,
action
=
"store_true"
,
help
=
"Use Moore device"
)
parser
.
add_argument
(
"--iluvatar"
,
action
=
"store_true"
,
help
=
"Use Iluvatar device"
)
parser
.
add_argument
(
"--iluvatar"
,
action
=
"store_true"
,
help
=
"Use Iluvatar device"
)
parser
.
add_argument
(
"--cambricon"
,
action
=
"store_true"
,
help
=
"Use Cambricon device"
)
parser
.
add_argument
(
"--cambricon"
,
action
=
"store_true"
,
help
=
"Use Cambricon device"
)
parser
.
add_argument
(
"--ali"
,
action
=
"store_true"
,
help
=
"Use Ali PPU device"
)
parser
.
add_argument
(
parser
.
add_argument
(
"--enable-graph"
,
"--enable-graph"
,
action
=
"store_true"
,
action
=
"store_true"
,
...
@@ -520,9 +521,11 @@ def main():
...
@@ -520,9 +521,11 @@ def main():
device
=
"cuda"
device
=
"cuda"
elif
args
.
cambricon
:
elif
args
.
cambricon
:
device
=
"mlu"
device
=
"mlu"
elif
args
.
ali
:
device
=
"cuda"
else
:
else
:
print
(
print
(
"Usage: python infinilm.server.inference_server [--cpu | --nvidia | --metax | --moore | --iluvatar | --cambricon] "
"Usage: python infinilm.server.inference_server [--cpu | --nvidia | --metax | --moore | --iluvatar | --cambricon
| --ali
] "
"--model_path=<path/to/model_dir> --max_tokens=MAX_TOKENS --max_batch_size=MAX_BATCH_SIZE"
"--model_path=<path/to/model_dir> --max_tokens=MAX_TOKENS --max_batch_size=MAX_BATCH_SIZE"
"
\n
"
"
\n
"
"Example: python infinilm.server.inference_server --nvidia --model_path=/data/shared/models/9G7B_MHA/ "
"Example: python infinilm.server.inference_server --nvidia --model_path=/data/shared/models/9G7B_MHA/ "
...
...
scripts/jiuge.py
View file @
67e8d6e9
...
@@ -860,9 +860,11 @@ def test():
...
@@ -860,9 +860,11 @@ def test():
device_type
=
DeviceType
.
DEVICE_TYPE_KUNLUN
device_type
=
DeviceType
.
DEVICE_TYPE_KUNLUN
elif
sys
.
argv
[
1
]
==
"--hygon"
:
elif
sys
.
argv
[
1
]
==
"--hygon"
:
device_type
=
DeviceType
.
DEVICE_TYPE_HYGON
device_type
=
DeviceType
.
DEVICE_TYPE_HYGON
elif
sys
.
argv
[
1
]
==
"--ali"
:
device_type
=
DeviceType
.
DEVICE_TYPE_ALI
else
:
else
:
print
(
print
(
"Usage: python jiuge.py [--cpu | --nvidia| --qy| --cambricon | --ascend | --metax | --moore | --iluvatar | --kunlun | --hygon] <path/to/model_dir> [n_device] [--verbose]"
"Usage: python jiuge.py [--cpu | --nvidia| --qy| --cambricon | --ascend | --metax | --moore | --iluvatar | --kunlun | --hygon
| --ali
] <path/to/model_dir> [n_device] [--verbose]"
)
)
sys
.
exit
(
1
)
sys
.
exit
(
1
)
...
...
scripts/libinfinicore_infer/base.py
View file @
67e8d6e9
...
@@ -37,6 +37,7 @@ class DeviceType(ctypes.c_int):
...
@@ -37,6 +37,7 @@ class DeviceType(ctypes.c_int):
DEVICE_TYPE_KUNLUN
=
7
DEVICE_TYPE_KUNLUN
=
7
DEVICE_TYPE_HYGON
=
8
DEVICE_TYPE_HYGON
=
8
DEVICE_TYPE_QY
=
9
DEVICE_TYPE_QY
=
9
DEVICE_TYPE_ALI
=
10
class
KVCacheCStruct
(
ctypes
.
Structure
):
class
KVCacheCStruct
(
ctypes
.
Structure
):
...
...
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