你好,我执行ModelScope这个代码,但是返回结果不是答案import copy
import random
from modelscope import snapshot_download
from dashinfer.helper import EngineHelper, ConfigManager
model_path = snapshot_download("dash-infer/Qwen2-7B-DI")
config_file = model_path + "/" + "di_config.json"
config = ConfigManager.get_config_from_json(config_file)
config["model_path"] = model_path
engine_helper = EngineHelper(config)
engine_helper.verbose = True
engine_helper.init_tokenizer(model_path)
engine_helper.init_engine()
user_input = "浙江的省会在哪"
prompt = "<|im_start|>" + "system\n" + "You are a helpful assistant." + "<|im_end|>\n" + \
"<|im_start|>" + "user\n" + user_input + "<|im_end|>\n" + \
"<|im_start|>" + "assistant\n"
gen_cfg = copy.deepcopy(engine_helper.default_gen_cfg)
gen_cfg["seed"] = random.randint(0, 10000)
request_list = engine_helper.create_request([prompt], [gen_cfg])
engine_helper.process_one_request(request_list[0])
engine_helper.print_inference_result_all(request_list)
engine_helper.uninit_engine()
返回的是这个
2024-06-07 21:09:24,875 - modelscope - INFO - PyTorch version 2.3.0+cpu Found.
2024-06-07 21:09:24,878 - modelscope - INFO - Loading ast index from /mnt/workspace/.cache/modelscope/ast_indexer
2024-06-07 21:09:24,909 - modelscope - INFO - Loading done! Current index file version is 1.15.0, with md5 eccbdad6389abeac8790b84f257211fb and a total number of 980 components indexed
/usr/local/lib/python3.10/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html
from .autonotebook import tqdm as notebook_tqdm
/usr/local/lib/python3.10/site-packages/beartype/_util/error/utilerrwarn.py:67: BeartypeModuleUnimportableWarning: Ignoring module "onnx" importation exception:
ImportError: cannot import name 'builder' from 'google.protobuf.internal' (/usr/local/lib/python3.10/site-packages/google/protobuf/internal/init.py)
warn(message, cls)
/usr/local/lib/python3.10/site-packages/beartype/_util/error/utilerrwarn.py:67: BeartypeModuleUnimportableWarning: Ignoring module "onnx" importation exception:
ImportError: cannot import name 'builder' from 'google.protobuf.internal' (/usr/local/lib/python3.10/site-packages/google/protobuf/internal/init.py)
warn(message, cls)
WARNING: Logging before InitGoogleLogging() is written to STDERR
I20240607 21:09:26.608070 1340 thread_pool.h:46] ThreadPool created with: 1
I20240607 21:09:26.608146 1340 as_engine.cpp:232] AllSpark Init with Version: 1.1.0/(GitSha1:1b9b010c-dirty)
Special tokens have been added in the vocabulary, make sure the associated word embeddings are fine-tuned or trained. 这是为啥呢?
ModelScope旨在打造下一代开源的模型即服务共享平台,为泛AI开发者提供灵活、易用、低成本的一站式模型服务产品,让模型应用更简单!欢迎加入技术交流群:微信公众号:魔搭ModelScope社区,钉钉群号:44837352