diff --git a/README.md b/README.md index 350d2d9e..ae30f040 100644 --- a/README.md +++ b/README.md @@ -71,7 +71,7 @@ python scripts/test_ppl.py --model-path MODEL_PATH [--ndev NDEV] [--max-batch MA - 单次推理测试 - llama示例 ```bash - python examples/llama.py [--cpu | --nvidia | --metax | --moore | --iluvatar] --model_path= + python examples/llama.py [--cpu | --nvidia | --qy | --metax | --moore | --iluvatar] --model_path= ``` - 例如: ```bash @@ -91,7 +91,7 @@ python scripts/test_ppl.py --model-path MODEL_PATH [--ndev NDEV] [--max-batch MA - 运行推理基准测试(C-Eval/MMLU) ```bash - python test/bench/test_benchmark.py [--cpu | --nvidia | --cambricon | --ascend | --metax | --moore | --iluvatar | --kunlun | --hygon] --bench {ceval|mmlu} [--backend cpp] [--ndev N] [--subject SUBJECT] [--num_samples N] [--max_new_tokens N] [--output_csv PATH] [--cache_dir PATH] + python test/bench/test_benchmark.py [--cpu | --nvidia | --qy | --cambricon | --ascend | --metax | --moore | --iluvatar | --kunlun | --hygon] --bench {ceval|mmlu} [--backend cpp] [--ndev N] [--subject SUBJECT] [--num_samples N] [--max_new_tokens N] [--output_csv PATH] [--cache_dir PATH] ``` - 参数说明: diff --git a/examples/jiuge.py b/examples/jiuge.py index 8b7d6bcd..d36923fc 100644 --- a/examples/jiuge.py +++ b/examples/jiuge.py @@ -26,6 +26,11 @@ def get_args(): action="store_true", help="Run nvidia test", ) + parser.add_argument( + "--qy", + action="store_true", + help="Run qy test", + ) parser.add_argument( "--metax", action="store_true", @@ -191,6 +196,8 @@ def test( device_str = "cpu" elif args.nvidia: device_str = "cuda" + elif args.qy: + device_str = "cuda" elif args.metax: device_str = "cuda" elif args.moore: @@ -201,7 +208,7 @@ def test( device_str = "mlu" else: print( - "Usage: python examples/jiuge.py [--cpu | --nvidia | --metax | --moore | --iluvatar] --model_path=\n" + "Usage: python examples/jiuge.py [--cpu | --nvidia | --qy | --metax | --moore | --iluvatar] --model_path=\n" "such as, python examples/jiuge.py --nvidia --model_path=~/TinyLlama-1.1B-Chat-v1.0" ) sys.exit(1) diff --git a/examples/llama.py b/examples/llama.py index aa890ca9..0401fc14 100644 --- a/examples/llama.py +++ b/examples/llama.py @@ -24,6 +24,11 @@ def get_args(): action="store_true", help="Run nvidia test", ) + parser.add_argument( + "--qy", + action="store_true", + help="Run qy test", + ) parser.add_argument( "--metax", action="store_true", @@ -172,6 +177,8 @@ def test( device_str = "cpu" elif args.nvidia: device_str = "cuda" + elif args.qy: + device_str = "cuda" elif args.metax: device_str = "cuda" elif args.moore: @@ -180,7 +187,7 @@ def test( device_str = "cuda" else: print( - "Usage: python examples/llama.py [--cpu | --nvidia | --metax | --moore | --iluvatar] --model_path=\n" + "Usage: python examples/llama.py [--cpu | --nvidia | --qy | --metax | --moore | --iluvatar] --model_path=\n" "such as, python examples/llama.py --nvidia --model_path=~/TinyLlama-1.1B-Chat-v1.0" ) sys.exit(1) diff --git a/python/infinilm/auto_config.py b/python/infinilm/auto_config.py index 5408fe0b..893fa31b 100644 --- a/python/infinilm/auto_config.py +++ b/python/infinilm/auto_config.py @@ -21,5 +21,9 @@ def from_pretrained(model_path): if config_dict["model_type"] == "llama": return LlamaConfig(**config_dict) + elif config_dict["model_type"] == "fm9g": + return LlamaConfig(**config_dict) + elif config_dict["model_type"] == "fm9g7b": + return LlamaConfig(**config_dict) raise ValueError(f"Unsupported model type `{config_dict['model_type']}`.") diff --git a/test/bench/test_benchmark.py b/test/bench/test_benchmark.py index 796ee9f3..e0eb0efa 100644 --- a/test/bench/test_benchmark.py +++ b/test/bench/test_benchmark.py @@ -72,6 +72,7 @@ def __init__( "iluvatar": "iluvatar", "kunlun": "kunlun", "hygon": "hygon", + "qy": "cuda", } device_name = device_map.get(device_type_str.lower(), "cpu") @@ -236,6 +237,8 @@ def __init__(self, model_dir_path, device_type_str="cpu", benchmark="ceval"): # Device if device_type_str == "nvidia": self.device = torch.device("cuda") + elif device_type_str == "qy": + self.device = torch.device("cuda") elif device_type_str == "cpu": self.device = torch.device("cpu") elif device_type_str == "cambricon": @@ -646,7 +649,7 @@ def test(): # Parse arguments manually to handle device flags properly if len(sys.argv) < 4: print( - "Usage: python test_benchmark.py [--cpu | --nvidia| --cambricon | --ascend | --metax | --moore | --iluvatar | --kunlun | --hygon] --bench [ceval|mmlu] [--backend cpp|torch] [--ndev N] [--subject SUBJECT] [--split {test|val|all}] [--num_samples N] [--max_new_tokens N] [--output_csv PATH] [--cache_dir PATH]" + "Usage: python test_benchmark.py [--cpu | --nvidia| --qy | --cambricon | --ascend | --metax | --moore | --iluvatar | --kunlun | --hygon] --bench [ceval|mmlu] [--backend cpp|torch] [--ndev N] [--subject SUBJECT] [--split {test|val|all}] [--num_samples N] [--max_new_tokens N] [--output_csv PATH] [--cache_dir PATH]" ) sys.exit(1) @@ -725,9 +728,11 @@ def test(): device_type_str = "kunlun" elif device_flag == "--hygon": device_type_str = "hygon" + elif device_flag == "--qy": + device_type_str = "qy" else: print( - "Usage: python test_benchmark.py [--cpu | --nvidia| --cambricon | --ascend | --metax | --moore | --iluvatar | --kunlun | --hygon] --bench [ceval|mmlu] [--backend cpp|torch] [--ndev N] [--subject SUBJECT] [--num_samples N] [--max_new_tokens N] [--output_csv PATH] [--cache_dir PATH]" + "Usage: python test_benchmark.py [--cpu | --nvidia| --qy | --cambricon | --ascend | --metax | --moore | --iluvatar | --kunlun | --hygon] --bench [ceval|mmlu] [--backend cpp|torch] [--ndev N] [--subject SUBJECT] [--num_samples N] [--max_new_tokens N] [--output_csv PATH] [--cache_dir PATH]" ) sys.exit(1)