Skip to content

Commit 67e8d6e

Browse files
committed
issue/208 - adapt to ali ppu
1 parent 6cc680b commit 67e8d6e

File tree

5 files changed

+23
-3
lines changed

5 files changed

+23
-3
lines changed

examples/bench.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,11 @@ def get_args():
157157
action="store_true",
158158
help="Run cambricon test",
159159
)
160+
parser.add_argument(
161+
"--ali",
162+
action="store_true",
163+
help="Run alippu test",
164+
)
160165
parser.add_argument(
161166
"--model",
162167
type=str,
@@ -351,6 +356,8 @@ def run(
351356
device_str = "cuda"
352357
elif args.cambricon:
353358
device_str = "mlu"
359+
elif args.ali:
360+
device_str = "cuda"
354361
else:
355362
print(
356363
"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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ def get_args():
4747
action="store_true",
4848
help="Run cambricon test",
4949
)
50+
parser.add_argument(
51+
"--ali",
52+
action="store_true",
53+
help="Run alippu test",
54+
)
5055
parser.add_argument(
5156
"--hygon",
5257
action="store_true",
@@ -257,11 +262,13 @@ def test(
257262
device_str = "cuda"
258263
elif args.cambricon:
259264
device_str = "mlu"
265+
elif args.ali:
266+
device_str = "cuda"
260267
elif args.hygon:
261268
device_str = "cuda"
262269
else:
263270
print(
264-
"Usage: python examples/jiuge.py [--cpu | --nvidia | --metax | --moore | --iluvatar | --cambricon | --hygon] --model_path=<path/to/model_dir>\n"
271+
"Usage: python examples/jiuge.py [--cpu | --nvidia | --metax | --moore | --iluvatar | --cambricon | --ali | --hygon] --model_path=<path/to/model_dir>\n"
265272
"such as, python examples/jiuge.py --nvidia --model_path=~/TinyLlama-1.1B-Chat-v1.0"
266273
)
267274
sys.exit(1)

python/infinilm/server/inference_server.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,7 @@ def parse_args():
487487
parser.add_argument("--moore", action="store_true", help="Use Moore device")
488488
parser.add_argument("--iluvatar", action="store_true", help="Use Iluvatar device")
489489
parser.add_argument("--cambricon", action="store_true", help="Use Cambricon device")
490+
parser.add_argument("--ali", action="store_true", help="Use Ali PPU device")
490491
parser.add_argument(
491492
"--enable-graph",
492493
action="store_true",
@@ -520,9 +521,11 @@ def main():
520521
device = "cuda"
521522
elif args.cambricon:
522523
device = "mlu"
524+
elif args.ali:
525+
device = "cuda"
523526
else:
524527
print(
525-
"Usage: python infinilm.server.inference_server [--cpu | --nvidia | --metax | --moore | --iluvatar | --cambricon] "
528+
"Usage: python infinilm.server.inference_server [--cpu | --nvidia | --metax | --moore | --iluvatar | --cambricon | --ali] "
526529
"--model_path=<path/to/model_dir> --max_tokens=MAX_TOKENS --max_batch_size=MAX_BATCH_SIZE"
527530
"\n"
528531
"Example: python infinilm.server.inference_server --nvidia --model_path=/data/shared/models/9G7B_MHA/ "

scripts/jiuge.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -860,9 +860,11 @@ def test():
860860
device_type = DeviceType.DEVICE_TYPE_KUNLUN
861861
elif sys.argv[1] == "--hygon":
862862
device_type = DeviceType.DEVICE_TYPE_HYGON
863+
elif sys.argv[1] == "--ali":
864+
device_type = DeviceType.DEVICE_TYPE_ALI
863865
else:
864866
print(
865-
"Usage: python jiuge.py [--cpu | --nvidia| --qy| --cambricon | --ascend | --metax | --moore | --iluvatar | --kunlun | --hygon] <path/to/model_dir> [n_device] [--verbose]"
867+
"Usage: python jiuge.py [--cpu | --nvidia| --qy| --cambricon | --ascend | --metax | --moore | --iluvatar | --kunlun | --hygon | --ali] <path/to/model_dir> [n_device] [--verbose]"
866868
)
867869
sys.exit(1)
868870

scripts/libinfinicore_infer/base.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ class DeviceType(ctypes.c_int):
3737
DEVICE_TYPE_KUNLUN = 7
3838
DEVICE_TYPE_HYGON = 8
3939
DEVICE_TYPE_QY = 9
40+
DEVICE_TYPE_ALI = 10
4041

4142

4243
class KVCacheCStruct(ctypes.Structure):

0 commit comments

Comments
 (0)