Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ xmake && xmake install
- 运行模型推理测试

```bash
python scripts/jiuge.py [--cpu | --nvidia | --cambricon | --ascend | --metax | --moore | --iluvatar | --kunlun | --hygon] path/to/model_dir [n_device]
python scripts/jiuge.py [--cpu | --nvidia | --qy | --cambricon | --ascend | --metax | --moore | --iluvatar | --kunlun | --hygon] path/to/model_dir [n_device]
```

- 部署模型推理服务

```bash
python scripts/launch_server.py --model-path MODEL_PATH [-h] [--dev {cpu,nvidia,cambricon,ascend,metax,moore,iluvatar,kunlun,hygon}] [--ndev NDEV] [--max-batch MAX_BATCH] [--max-tokens MAX_TOKENS]
python scripts/launch_server.py --model-path MODEL_PATH [-h] [--dev {cpu,nvidia,qy, cambricon,ascend,metax,moore,iluvatar,kunlun,hygon}] [--ndev NDEV] [--max-batch MAX_BATCH] [--max-tokens MAX_TOKENS]
```

- 测试模型推理服务性能
Expand Down
10 changes: 6 additions & 4 deletions scripts/jiuge.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def match(state_dict):


class JiugeMetaFromLlama(JiugeMetaCStruct):
def __init__(self, config, dtype=torch.float16, max_tokens=None):
def __init__(self, config, dtype=torch.bfloat16, max_tokens=None):
if dtype == torch.float16:
dt_ = DataType.INFINI_DTYPE_F16
elif dtype == torch.float32:
Expand Down Expand Up @@ -146,7 +146,7 @@ def __init__(
meta,
naming,
state_dict,
torch_dt_mat=torch.float16,
torch_dt_mat=torch.bfloat16,
torch_dt_norm=torch.float32,
ndev=1,
transpose_weight=True,
Expand Down Expand Up @@ -825,7 +825,7 @@ def destroy_model_instance(self):
def test():
if len(sys.argv) < 3:
print(
"Usage: python jiuge.py [--cpu | --nvidia| --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] <path/to/model_dir> [n_device] [--verbose]"
)
sys.exit(1)

Expand All @@ -844,6 +844,8 @@ def test():
device_type = DeviceType.DEVICE_TYPE_CPU
elif sys.argv[1] == "--nvidia":
device_type = DeviceType.DEVICE_TYPE_NVIDIA
elif sys.argv[1] == "--qy":
device_type = DeviceType.DEVICE_TYPE_QY
elif sys.argv[1] == "--cambricon":
device_type = DeviceType.DEVICE_TYPE_CAMBRICON
elif sys.argv[1] == "--ascend":
Expand All @@ -860,7 +862,7 @@ def test():
device_type = DeviceType.DEVICE_TYPE_HYGON
else:
print(
"Usage: python jiuge.py [--cpu | --nvidia| --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] <path/to/model_dir> [n_device] [--verbose]"
)
sys.exit(1)

Expand Down
2 changes: 2 additions & 0 deletions scripts/jiuge_ppl.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
DEVICE_TYPE_MAP = {
"cpu": DeviceType.DEVICE_TYPE_CPU,
"nvidia": DeviceType.DEVICE_TYPE_NVIDIA,
"qy": DeviceType.DEVICE_TYPE_QY,
"cambricon": DeviceType.DEVICE_TYPE_CAMBRICON,
"ascend": DeviceType.DEVICE_TYPE_ASCEND,
"metax": DeviceType.DEVICE_TYPE_METAX,
Expand All @@ -19,6 +20,7 @@
TORCH_DEVICE_TYPE_MAP = {
"cpu": "cpu",
"nvidia": "cuda",
"qy": "cuda",
"cambricon": "mlu",
"ascend": "npu",
"metax": "cuda",
Expand Down
1 change: 1 addition & 0 deletions scripts/launch_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
DEVICE_TYPE_MAP = {
"cpu": DeviceType.DEVICE_TYPE_CPU,
"nvidia": DeviceType.DEVICE_TYPE_NVIDIA,
"qy": DeviceType.DEVICE_TYPE_QY,
"cambricon": DeviceType.DEVICE_TYPE_CAMBRICON,
"ascend": DeviceType.DEVICE_TYPE_ASCEND,
"metax": DeviceType.DEVICE_TYPE_METAX,
Expand Down
1 change: 1 addition & 0 deletions scripts/libinfinicore_infer/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class DeviceType(ctypes.c_int):
DEVICE_TYPE_ILUVATAR = 6
DEVICE_TYPE_KUNLUN = 7
DEVICE_TYPE_HYGON = 8
DEVICE_TYPE_QY = 9


class KVCacheCStruct(ctypes.Structure):
Expand Down