企业网站建设联系方式本地wordpress无法打开网站
企业网站建设联系方式,本地wordpress无法打开网站,小波app推广网,互换链接的方法模型概述 【免费下载链接】glm-4-9b-chat-hf 项目地址: https://ai.gitcode.com/zai-org/glm-4-9b-chat-hf
GLM-4-9B是智谱AI推出的GLM-4系列最新一代预训练模型的开源版本。在语义理解、数学推理、代码生成及知识问答等多维度数据集评测中#xff0c;基础模型GLM-4-9…模型概述【免费下载链接】glm-4-9b-chat-hf项目地址: https://ai.gitcode.com/zai-org/glm-4-9b-chat-hfGLM-4-9B是智谱AI推出的GLM-4系列最新一代预训练模型的开源版本。在语义理解、数学推理、代码生成及知识问答等多维度数据集评测中基础模型GLM-4-9B及其经过人类偏好对齐的对话版本GLM-4-9B-Chat均展现出超越Llama-3-8B的卓越性能。除了支持多轮对话外GLM-4-9B-Chat还集成了网页浏览、代码执行、自定义工具调用Function Call和超长上下文推理最长支持128K上下文窗口等高级特性。本代模型新增多语言支持能力可流畅处理日语、韩语、德语等26种语言。同步发布的还有支持1M上下文长度约200万汉字的GLM-4-9B-Chat-1M模型以及基于GLM-4-9B开发的多模态模型GLM-4V-9B。其中GLM-4V-9B具备1120*1120高分辨率下的中英文对话能力在多模态评测中包括中英文综合能力、感知推理、文本识别和图表理解等任务上性能均超越GPT-4-turbo-2024-04-09、Gemini 1.0 Pro、Qwen-VL-Max及Claude 3 Opus。性能评测我们在多项经典任务中对GLM-4-9B-Chat模型进行了全面评估具体结果如下表所示模型名称AlignBench-v2MT-BenchIFEvalMMLUC-EvalGSM8KMATHHumanEvalNCBLlama-3-8B-Instruct5.128.0068.5868.451.379.630.062.224.7ChatGLM3-6B3.975.5028.166.469.072.325.758.511.3GLM-4-9B-Chat6.618.3569.072.475.679.650.671.832.2超长上下文能力在1M上下文长度下进行的needle实验结果如下如上图所示该实验直观展示了GLM-4-9B-Chat在百万级上下文长度中精准定位关键信息的能力。这一特性充分体现了模型在处理超长文本时的信息保持能力为法律文档分析、学术论文理解等长文本应用场景提供了核心技术支撑。我们进一步在LongBench数据集上评估了模型的长文本处理能力结果如下该图表清晰呈现了GLM-4-9B-Chat与其他主流模型在长文本任务上的性能对比。从数据可以看出GLM-4-9B-Chat在多类长文本理解任务中均处于领先地位这为需要处理书籍、报告等超长文档的应用场景提供了可靠的技术保障。多语言支持能力我们在六个多语言数据集上对GLM-4-9B-Chat和Llama-3-8B-Instruct进行了对比测试各数据集的测试结果及涵盖语言如下表所示数据集名称Llama-3-8B-InstructGLM-4-9B-Chat涵盖语言M-MMLU49.656.6全部FLORES25.028.8俄语、西班牙语、德语、法语、意大利语、葡萄牙语、波兰语、日语、荷兰语、阿拉伯语、土耳其语、捷克语、越南语、波斯语、匈牙利语、希腊语、罗马尼亚语、瑞典语、芬兰语、韩语、丹麦语、保加利亚语、挪威语MGSM54.065.3中文、英语、孟加拉语、德语、西班牙语、法语、日语、俄语、斯瓦希里语、泰卢固语、泰语XWinograd61.773.1中文、英语、法语、日语、俄语、葡萄牙语XStoryCloze84.790.7中文、英语、阿拉伯语、西班牙语、巴斯克语、印地语、印尼语、俄语、斯瓦希里语、泰卢固语XCOPA73.380.1中文、爱沙尼亚语、印尼语、意大利语、克丘亚语、斯瓦希里语、泰米尔语、泰语、土耳其语、越南语工具调用能力在Berkeley Function Calling Leaderboard上的测试结果如下模型名称综合准确率AST摘要执行摘要相关性Llama-3-8B-Instruct58.8859.2570.0145.83gpt-4-turbo-2024-04-0981.2482.1478.6188.75ChatGLM3-6B57.8862.1869.785.42GLM-4-9B-Chat81.0080.2684.4087.92本仓库为GLM-4-9B-Chat的模型仓库支持128K上下文长度。快速开始更多推理代码和环境要求请访问我们的GitHub页面。请严格按照依赖说明进行安装否则可能导致运行异常。使用Transformers库(4.46.0及以上版本)进行推理from transformers import AutoModelForCausalLM, AutoTokenizer tokenizer AutoTokenizer.from_pretrained(THUDM/glm-4-9b-chat-hf) model AutoModelForCausalLM.from_pretrained(THUDM/glm-4-9b-chat-hf, device_mapauto) message [ { role: system, content: Answer the following question. }, { role: user, content: How many legs does a cat have? } ] inputs tokenizer.apply_chat_template( message, return_tensorspt, add_generation_promptTrue, return_dictTrue, ).to(model.device) input_len inputs[input_ids].shape[1] generate_kwargs { input_ids: inputs[input_ids], attention_mask: inputs[attention_mask], max_new_tokens: 128, do_sample: False, } out model.generate(**generate_kwargs) print(tokenizer.decode(out[0][input_len:], skip_special_tokensTrue))使用vLLM库(0.6.4及以上版本)进行推理from transformers import AutoTokenizer from vllm import LLM, SamplingParams # GLM-4-9B-Chat-1M # max_model_len, tp_size 1048576, 4 # 如遇内存溢出问题建议减小max_model_len或增加tp_size max_model_len, tp_size 131072, 1 model_name THUDM/glm-4-9b-chat-hf prompt [{role: user, content: what is your name?}] tokenizer AutoTokenizer.from_pretrained(model_name, trust_remote_codeTrue) llm LLM( modelmodel_name, tensor_parallel_sizetp_size, max_model_lenmax_model_len, trust_remote_codeTrue, enforce_eagerTrue, # GLM-4-9B-Chat-1M-HF 如遇内存溢出问题建议启用以下参数 # enable_chunked_prefillTrue, # max_num_batched_tokens8192 ) stop_token_ids [151329, 151336, 151338] sampling_params SamplingParams(temperature0.95, max_tokens1024, stop_token_idsstop_token_ids) inputs tokenizer.apply_chat_template(prompt, tokenizeFalse, add_generation_promptTrue) outputs llm.generate(promptsinputs, sampling_paramssampling_params) print(outputs[0].outputs[0].text)许可证说明GLM-4模型权重的使用遵循LICENSE中的条款。引用说明如果您发现我们的工作对您的研究有用请考虑引用以下论文misc{glm2024chatglm, title{ChatGLM: A Family of Large Language Models from GLM-130B to GLM-4 All Tools}, author{Team GLM and Aohan Zeng and Bin Xu and Bowen Wang and Chenhui Zhang and Da Yin and Diego Rojas and Guanyu Feng and Hanlin Zhao and Hanyu Lai and Hao Yu and Hongning Wang and Jiadai Sun and Jiajie Zhang and Jiale Cheng and Jiayi Gui and Jie Tang and Jing Zhang and Juanzi Li and Lei Zhao and Lindong Wu and Lucen Zhong and Mingdao Liu and Minlie Huang and Peng Zhang and Qinkai Zheng and Rui Lu and Shuaiqi Duan and Shudan Zhang and Shulin Cao and Shuxun Yang and Weng Lam Tam and Wenyi Zhao and Xiao Liu and Xiao Xia and Xiaohan Zhang and Xiaotao Gu and Xin Lv and Xinghan Liu and Xinyi Liu and Xinyue Yang and Xixuan Song and Xunkai Zhang and Yifan An and Yifan Xu and Yilin Niu and Yuantao Yang and Yueyan Li and Yushi Bai and Yuxiao Dong and Zehan Qi and Zhaoyu Wang and Zhen Yang and Zhengxiao Du and Zhenyu Hou and Zihan Wang}, year{2024}, eprint{2406.12793}, archivePrefix{arXiv}, primaryClass{idcs.CL full_nameComputation and Language is_activeTrue alt_namecmp-lg in_archivecs is_generalFalse descriptionCovers natural language processing. Roughly includes material in ACM Subject Class I.2.7. Note that work on artificial languages (programming languages, logics, formal systems) that does not explicitly address natural-language issues broadly construed (natural-language processing, computational linguistics, speech, text retrieval, etc.) is not appropriate for this area.} }重要提示如果您使用本仓库的权重请确保将transformers库更新至transformers4.46.0版本旧版本的transformers库与此权重不兼容。【免费下载链接】glm-4-9b-chat-hf项目地址: https://ai.gitcode.com/zai-org/glm-4-9b-chat-hf创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考