/ Модель

Характеристики

Контекст
131 072 токена
Параметры
8,8 млрд
Размер весов
18,8 ГБ
Лицензия
Своя лицензия
Архитектура
glm · dense
Базовая модель
glm-4-9b-chat
Библиотека
transformers
Опубликована
23 окт 2024

glm-4-9b-chat-hf

Генерация текстаТекст → текст15 профессий

Диалоговая модель GLM-4 с 8,8 млрд параметров для многоязычного общения, рассуждений, работы с кодом и вызова инструментов.

6 527скачиваний за 30 дней25лайковвеса обновлены27 янв 2025

Бенчмарки

Как модель справилась с задачами пользователей ailist и что о ней публикуют открытые лидерборды

Тесты пользователейпока нет

Никто ещё не опубликовал тест этой модели. Соберите бенчмарк из своих задач — результат появится здесь.

  1. Добавьте модель в бенчмарк

    Вместе с другими моделями категории «Текст» — сравнение идёт внутри одной категории.

  2. Опишите свои задачи

    Напишите запросы, при необходимости приложите файлы и эталонные ответы.

  3. Запустите и опубликуйте

    Модели ответят на каждую задачу, судья оценит ответы. Опубликованный результат появится на этой странице.

Публичные оценки1

Из открытых лидербордов. Сравнивайте результаты одного теста при одинаковых условиях — отсутствие оценки не значит, что модель хуже.

  • TIGER-Lab/MMLU-Pro

    score · выше — лучше

    Результат

    48,01

    mmlu_pro 48,01
    Hugging Face Leaderboards

    Публичная таблицаревизия не подтверждена

Что умеет модель

Описание составлено по карточке модели и метаданным Hugging Face

GLM-4-9B-Chat — диалоговая языковая модель семейства GLM, выпущенная Zhipu AI. Репозиторий содержит версию в формате Transformers и safetensors; модель насчитывает 8,8 млрд параметров и рассчитана на генерацию текста в многораундовом чате.

Модель подходит для ответов на вопросы, рассуждений, задач по математике и коду, а также для сценариев с вызовом инструментов и длинными документами. Заявленная длина контекста — до 128K токенов. Поддерживаются китайский и английский; автор также заявляет поддержку 26 языков. README сообщает о результатах тестов на задачах семантики, математики, рассуждений, кода и знаний, но не приводит полных данных для некоторых сравнительных таблиц.

Это дообученная версия THUDM/glm-4-9b-chat. Для загрузки весов требуется transformers версии 4.46.0 или новее: репозиторий несовместим с более старыми версиями. Лицензия указана как other, поэтому условия использования следует уточнить в материалах репозитория.

Сценарии применения

  • многораундовые диалоги и ответы на вопросы
  • анализ длинных документов в контексте до 128K токенов
  • решение задач по математике и логике
  • генерация и объяснение кода
  • вызов инструментов из диалогового приложения

Ограничения

Для использования весов требуется transformers>=4.46.0; более старые версии несовместимы. В метаданных лицензия обозначена как other, поэтому точные условия использования требуют проверки.

Для каких профессий подходит15

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Также подходит для

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

GLM-4-9B-Chat

中文阅读,请看这里.

If you are using the weights from this repository, please update to

transformers>=4.46.0

These weights are not compatible with older versions of the transformers library.

Model Introduction

GLM-4-9B is the open-source version of the latest generation of pre-trained models in the GLM-4 series launched by Zhipu AI. In the evaluation of data sets in semantics, mathematics, reasoning, code, and knowledge, GLM-4-9B and its human preference-aligned version GLM-4-9B-Chat have shown superior performance beyond Llama-3-8B. In addition to multi-round conversations, GLM-4-9B-Chat also has advanced features such as web browsing, code execution, custom tool calls (Function Call), and long context reasoning (supporting up to 128K context). This generation of models has added multi-language support, supporting 26 languages including Japanese, Korean, and German. We have also launched the GLM-4-9B-Chat-1M model that supports 1M context length (about 2 million Chinese characters) and the multimodal model GLM-4V-9B based on GLM-4-9B. GLM-4V-9B possesses dialogue capabilities in both Chinese and English at a high resolution of 1120*1120. In various multimodal evaluations, including comprehensive abilities in Chinese and English, perception & reasoning, text recognition, and chart understanding, GLM-4V-9B demonstrates superior performance compared to GPT-4-turbo-2024-04-09, Gemini 1.0 Pro, Qwen-VL-Max, and Claude 3 Opus.

Benchmark

We evaluated the GLM-4-9B-Chat model on some classic tasks and obtained the following results:

ModelAlignBench-v2MT-BenchIFEvalMMLUC-EvalGSM8KMATHHumanEvalNCB
Llama-3-8B-Instruct5.128.0068.5868.451.379.630.062.224.7
ChatGLM3-6B3.975.5028.166.469.072.325.758.511.3
GLM-4-9B-Chat6.618.3569.072.475.679.650.671.832.2

Long Context

The eval_needle experiment was conducted with a context length of 1M, and the results are as follows:

needle

The long text capability was further evaluated on LongBench, and the results are as follows:

leaderboard

Multi Language

The tests for GLM-4-9B-Chat and Llama-3-8B-Instruct are conducted on six multilingual datasets. The test results and the corresponding languages selected for each dataset are shown in the table below:

DatasetLlama-3-8B-InstructGLM-4-9B-ChatLanguages
M-MMLU49.656.6all
FLORES25.028.8ru, es, de, fr, it, pt, pl, ja, nl, ar, tr, cs, vi, fa, hu, el, ro, sv, uk, fi, ko, da, bg, no
MGSM54.065.3zh, en, bn, de, es, fr, ja, ru, sw, te, th
XWinograd61.773.1zh, en, fr, jp, ru, pt
XStoryCloze84.790.7zh, en, ar, es, eu, hi, id, my, ru, sw, te
XCOPA73.380.1zh, et, ht, id, it, qu, sw, ta, th, tr, vi

Function Call

Tested on Berkeley Function Calling Leaderboard.

ModelOverall Acc.AST SummaryExec SummaryRelevance
Llama-3-8B-Instruct58.8859.2570.0145.83
gpt-4-turbo-2024-04-0981.2482.1478.6188.75
ChatGLM3-6B57.8862.1869.785.42
GLM-4-9B-Chat81.0080.2684.4087.92

This repository is the model repository of GLM-4-9B-Chat, supporting 128K context length.

Quick Start

For more inference code and requirements, please visit our github page.

Please strictly follow the dependencies to install, otherwise it will not run properly

Transformers Lib(4.46.0 and later version) for inference:

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_map="auto")

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_tensors='pt',
    add_generation_prompt=True,
    return_dict=True,
).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_tokens=True))

vLLM Lib(0.6.4 and later version) for inference:

from transformers import AutoTokenizer
from vllm import LLM, SamplingParams

# GLM-4-9B-Chat-1M
# max_model_len, tp_size = 1048576, 4
# If you encounter OOM phenomenon, it is recommended to reduce max_model_len or increase 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_code=True)
llm = LLM(
    model=model_name,
    tensor_parallel_size=tp_size,
    max_model_len=max_model_len,
    trust_remote_code=True,
    enforce_eager=True,
    # GLM-4-9B-Chat-1M-HF If you encounter OOM phenomenon, it is recommended to enable the following parameters
    # enable_chunked_prefill=True,
    # max_num_batched_tokens=8192
)
stop_token_ids = [151329, 151336, 151338]
sampling_params = SamplingParams(temperature=0.95, max_tokens=1024, stop_token_ids=stop_token_ids)

inputs = tokenizer.apply_chat_template(prompt, tokenize=False, add_generation_prompt=True)
outputs = llm.generate(prompts=inputs, sampling_params=sampling_params)

print(outputs[0].outputs[0].text)

LICENSE

The weights of the GLM-4 model are available under the terms of LICENSE.

Citations

If you find our work useful, please consider citing the following paper.

@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={id='cs.CL' full_name='Computation and Language' is_active=True alt_name='cmp-lg' in_archive='cs' is_general=False description='Covers 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.'}
}

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм · transformers

Можно запустить

Подбираем GPU…

Класс архитектуры
GlmForCausalLM
Ревизия весов
8599336

0 моделей