【部署glm4】属性找不到、参数错误问题解决(思路:修改模型包版本)

前言:在部署glm时,遇到了一些属性找不到、参数错误的问题,通常遇到这种问题都是因为模型包版本问题导致的,要注意模型版本是否可用。

【运行官方vllm_cli_demo.py】报错

**GLM-4: [rank0]: Traceback (most recent call last):

rank0\]: File "/app/glm4/code/GLM-4-main/basic_demo/vllm_cli_demo_self.py", line 176, in \[rank0\]: asyncio.run(chat()) \[rank0\]: File "/opt/conda/envs/chatglm4/lib/python3.9/asyncio/runners.py", line 44, in run \[rank0\]: return loop.run_until_complete(main) \[rank0\]: File "/opt/conda/envs/chatglm4/lib/python3.9/asyncio/base_events.py", line 647, in run_until_complete \[rank0\]: return future.result() \[rank0\]: File "/app/glm4/code/GLM-4-main/basic_demo/vllm_cli_demo_self.py", line 169, in chat \[rank0\]: async for output in vllm_gen(LORA_PATH, enable_lora, messages, top_p, temperature, max_length): \[rank0\]: File "/app/glm4/code/GLM-4-main/basic_demo/vllm_cli_demo_self.py", line 100, in vllm_gen \[rank0\]: inputs = tokenizer.apply_chat_template( \[rank0\]: AttributeError: 'tuple' object has no attribute 'apply_chat_template'** 目前该问题并没有解决,但是猜测是因为vllm版本需要为0.6.4,但是目前找不到这个版本,因此只能用)0.6.3.post1替代,猜测大概率是因为版本问题导致找不到`apply_chat_template ` 属性。由于vllm包较大,测试可用版本比较麻烦。 因此,目前可以暂时用tansformers代替vllm!!! > 【运行官方`trans_cli_demo.py`】报错 **Traceback (most recent call last): File "/app/glm4/code/GLM-4-main/basic_demo/trans_cli_demo.py", line 64, in model_inputs = tokenizer.apply_chat_template( File "/root/.cache/huggingface/modules/transformers_modules/glm4-models/tokenization_chatglm.py", line 220, in apply_chat_template output = self.batch_encode_plus( File "/opt/conda/envs/chatglm4/lib/python3.9/site-packages/transformers/tokenization_utils_base.py", line 3311, in batch_encode_plus return self._batch_encode_plus( File "/opt/conda/envs/chatglm4/lib/python3.9/site-packages/transformers/tokenization_utils.py", line 892, in _batch_encode_plus batch_outputs = self._batch_prepare_for_model( File "/opt/conda/envs/chatglm4/lib/python3.9/site-packages/transformers/tokenization_utils.py", line 970, in _batch_prepare_for_model batch_outputs = self.pad( File "/opt/conda/envs/chatglm4/lib/python3.9/site-packages/transformers/tokenization_utils_base.py", line 3527, in pad outputs = self._pad( TypeError: _pad() got an unexpected keyword argument 'padding_side'** 具体可以参考这篇博客: [GLM-4V-9B TypeError: ChatGLMTokenizer._pad() got an unexpected keyword argument 'padding_side'](https://blog.csdn.net/m0_60801087/article/details/143160274) 我的解决方法是将transformers版本降为4.44.0 最终运行截图如下: ![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/af841c68662e49b8a81c106bb33e64eb.png)

相关推荐
智驱力人工智能4 分钟前
小区高空抛物AI实时预警方案 筑牢社区头顶安全的实践 高空抛物检测 高空抛物监控安装教程 高空抛物误报率优化方案 高空抛物监控案例分享
人工智能·深度学习·opencv·算法·安全·yolo·边缘计算
qq_160144877 分钟前
亲测!2026年零基础学AI的入门干货,新手照做就能上手
人工智能
Howie Zphile8 分钟前
全面预算管理难以落地的核心真相:“完美模型幻觉”的认知误区
人工智能·全面预算
人工不智能57710 分钟前
拆解 BERT:Output 中的 Hidden States 到底藏了什么秘密?
人工智能·深度学习·bert
盟接之桥13 分钟前
盟接之桥说制造:引流品 × 利润品,全球电商平台高效产品组合策略(供讨论)
大数据·linux·服务器·网络·人工智能·制造
kfyty72513 分钟前
集成 spring-ai 2.x 实践中遇到的一些问题及解决方案
java·人工智能·spring-ai
猫头虎15 分钟前
如何排查并解决项目启动时报错Error encountered while processing: java.io.IOException: closed 的问题
java·开发语言·jvm·spring boot·python·开源·maven
h64648564h30 分钟前
CANN 性能剖析与调优全指南:从 Profiling 到 Kernel 级优化
人工智能·深度学习
数据与后端架构提升之路32 分钟前
论系统安全架构设计及其应用(基于AI大模型项目)
人工智能·安全·系统安全
忆~遂愿35 分钟前
ops-cv 算子库深度解析:面向视觉任务的硬件优化与数据布局(NCHW/NHWC)策略
java·大数据·linux·人工智能