开发者社区 > 云原生 > Serverless > 正文

我通过函数计算FC 想搭建AI大语言模型API服务 现在服务部署后,调用一直报错,怎么处理?

我通过函数计算FC 想搭建AI大语言模型API服务
现在服务部署后,调用一直报错,怎么处理?:
{"ErrorCode":"CAExited","ErrorMessage":"Function instance exited unexpectedly(code 1, message:operation not permitted) with start command ' '.\nLogs:with NAS, mount built-in files to /mnt/auto/llm\r\nMount /mnt/auto/llm/models to /llm/models\r\nMount /mnt/auto/llm/app to /llm/app\r\n/mnt/auto/llm/models/chatglm2-6b-int4\r\nTraceback (most recent call last):\r\n File \"/opt/conda/lib/python3.10/site-packages/transformers/modeling_utils.py\", line 479, in load_state_dict\r\n return torch.load(checkpoint_file, map_location=map_location)\r\n File \"/opt/conda/lib/python3.10/site-packages/torch/serialization.py\", line 797, in load\r\n with _open_zipfile_reader(opened_file) as opened_zipfile:\r\n File \"/opt/conda/lib/python3.10/site-packages/torch/serialization.py\", line 283, in init\r\n super().init(torch._C.PyTorchFileReader(name_or_buffer))\r\nRuntimeError: PytorchStreamReader failed reading zip archive: failed finding central directory\r\n\r\nDuring handling of the above exception, another exception occurred:\r\n\r\nTraceback (most recent call last):\r\n File \"/opt/conda/lib/python3.10/site-packages/transformers/modeling_utils.py\", line 483, in load_state_dict\r\n if f.read(7) == \"version\":\r\n File \"/opt/conda/lib/python3.10/codecs.py\", line 322, in decode\r\n (result, consumed) = self._buffer_decode(data, self.errors, final)\r\nUnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 64: invalid start byte\r\n\r\nDuring handling of the above exception, another exception occurred:\r\n\r\nTraceback (most recent call last):\r\n File \"/llm/app/main.py\", line 5, in \u003cmodule\u003e\r\n uvicorn.run(\"server:app\", host=\"0.0.0.0\", port=PORT)\r\n File \"/opt/conda/lib/python3.10/site-packages/uvicorn/main.py\", line 587, in run\r\n server.run()\r\n File \"/opt/conda/lib/python3.10/site-packages/uvicorn/server.py\", line 61, in run\r\n return asyncio.run(self.serve(sockets=sockets))\r\n File \"/opt/conda/lib/python3.10/asyncio/runners.py\", line 44, in run\r\n return loop.run_until_complete(main)\r\n File \"/opt/conda/lib/python3.10/asyncio/base_events.py\", line 649, in run_until_complete\r\n return future.result()\r\n File \"/opt/conda/lib/python3.10/site-packages/uvicorn/server.py\", line 68, in serve\r\n config.load()\r\n File \"/opt/conda/lib/python3.10/site-packages/uvicorn/config.py\", line 467, in load\r\n self.loaded_app = import_from_string(self.app)\r\n File \"/opt/conda/lib/python3.10/site-packages/uvicorn/importer.py\", line 21, in import_from_string\r\n module = importlib.import_module(module_str)\r\n File \"/opt/conda/lib/python3.10/importlib/init.py\", line 126, in import_module\r\n return _bootstrap._gcd_import(name[level:], package, level)\r\n File \"\u003cfrozen importlib._bootstrap\u003e\", line 1050, in _gcd_import\r\n File \"\u003cfrozen importlib._bootstrap\u003e\", line 1027, in _find_and_load\r\n File \"\u003cfrozen importlib._bootstrap\u003e\", line 1006, in _find_and_load_unlocked\r\n File \"\u003cfrozen importlib._bootstrap\u003e\", line 688, in _load_unlocked\r\n File \"\u003cfrozen importlib._bootstrap_external\u003e\", line 883, in exec_module\r\n File \"\u003cfrozen importlib._bootstrap\u003e\", line 241, in _call_with_frames_removed\r\n File \"/built-in/app/server.py\", line 10, in \u003cmodule\u003e\r\n llm: BaseLLM = load_model()\r\n File \"/llm/app/model/llm.py\", line 37, in load_model\r\n return ChatGLM(**model_args)\r\n File \"/llm/app/model/chatglm.py\", line 41, in init\r\n model = AutoModel.from_pretrained(model_name_or_path, trust_remote_code=True).half().cuda()\r\n File \"/opt/conda/lib/python3.10/site-packages/transformers/models/auto/auto_factory.py\", line 511, in from_pretrained\r\n return model_class.from_pretrained(\r\n File \"/opt/conda/lib/python3.10/site-packages/transformers/modeling_utils.py\", line 2805, in from_pretrained\r\n state_dict = load_state_dict(resolved_archive_file)\r\n File \"/opt/conda/lib/python3.10/site-packages/transformers/modeling_utils.py\", line 495, in load_state_dict\r\n raise OSError(\r\nOSError: Unable to load weights from pytorch checkpoint file for '/mnt/auto/llm/models/chatglm2-6b-int4/pytorch_model.bin' at '/mnt/auto/llm/models/chatglm2-6b-int4/pytorch_model.bin'. If you tried to load a PyTorch model from a TF 2.0 checkpoint, please set from_tf=True."}

展开
收起
三分钟热度的鱼 2023-10-25 15:17:48 118 0
1 条回答
写回答
取消 提交回答
  • 这个问题看起来像是由于模型文件没有正确加载导致的。根据错误信息,模型文件似乎存在一些问题,比如文件格式不正确或者文件损坏。你可以尝试以下方法来解决这个问题:

    1. 检查模型文件是否完整并且没有损坏。你可以尝试重新下载模型文件,或者从其他可靠的来源获取模型文件。
    2. 确保你的模型文件是正确的模型类型。如果你不确定你的模型文件是什么类型的,你可以参考模型的文档或者联系模型的开发者。
    3. 确保你的模型文件和你的代码中的模型名称匹配。如果你的模型文件名和你的代码中的模型名称不一致,你可能需要修改你的代码来匹配模型文件名。
    2023-10-26 10:05:41
    赞同 展开评论 打赏

快速交付实现商业价值。

相关产品

  • 函数计算
  • 热门讨论

    热门文章

    相关电子书

    更多
    Hologres Serverless之路:揭秘弹性计算组 立即下载
    Serverless开发平台: 让研发效能再提升 立即下载
    Serverless 引领云上研发新范式 立即下载