/ Модель

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

Лицензия
Apache 2.0
Библиотека
transformers
Опубликована
29 ноя 2024

h2o-danube3.1-4b-chat

Генерация текстаТекст → текст

Диалоговая модель H2O.ai с 4 млрд параметров для генерации ответов, в том числе на мобильных устройствах офлайн.

2скачиваний за 30 дней6лайковвеса обновлены30 ноя 2024

Бенчмарки

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

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

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

  • GPQA

    GPQA Raw · выше — лучше

    Результат

    0,2852

    Open LLM v2 · архив

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

  • MATH Lvl 5

    MATH Lvl 5 Raw · выше — лучше

    Результат

    0,0332

    Open LLM v2 · архив

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

  • MUSR

    MUSR Raw · выше — лучше

    Результат

    0,4102

    Open LLM v2 · архив

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

  • MMLU-PRO

    MMLU-PRO Raw · выше — лучше

    Результат

    0,2719

    Open LLM v2 · архив

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

  • BBH

    BBH Raw · выше — лучше

    Результат

    0,3608

    Open LLM v2 · архив

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

  • IFEval

    IFEval Raw · выше — лучше

    Результат

    0,5021

    Open LLM v2 · архив

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

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

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

h2o-danube3.1-4b-chat — диалоговая языковая модель H2O.ai, дообученная для общения на основе h2oai/h2o-danube3-4b-chat. Она содержит около 4 млрд параметров и использует архитектуру на основе Llama 2 с токенизатором Mistral и словарём из 32 000 токенов. Модель предназначена для генерации ответов в диалоге и может работать офлайн на мобильных устройствах.

Контекст модели — до 8 192 токенов; веса опубликованы в формате Safetensors и доступны через Transformers. Для более экономного использования предусмотрена загрузка с 8- или 4-битной квантизацией. Лицензия — Apache 2.0.

Модель может выдавать неверные, бессмысленные или нерелевантные ответы, а также воспроизводить предвзятые или оскорбительные формулировки; результаты следует проверять.

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

  • ответы на сообщения в диалоговом интерфейсе
  • создание локального чат-бота без подключения к сети
  • генерация черновиков ответов и коротких текстов
  • развёртывание разговорной модели на мобильном устройстве

Ограничения

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

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

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

Открыть на Hugging Face

Summary

h2o-danube3.1-4b-chat is a chat fine-tuned model by H2O.ai with 4 billion parameters.

This model was trained using H2O LLM Studio.

Can be run natively and fully offline on phones - try it yourself with H2O AI Personal GPT.

Model Architecture

We adjust the Llama 2 architecture for a total of around 4b parameters. For details, please refer to our Technical Report. We use the Mistral tokenizer with a vocabulary size of 32,000 and train our model up to a context length of 8,192.

The details of the model architecture are:

HyperparameterValue
n_layers24
n_heads32
n_query_groups8
n_embd3840
vocab size32000
sequence length8192

Usage

To use the model with the transformers library on a machine with GPUs, first make sure you have the transformers library installed.

pip install transformers==4.45.0
import torch
from transformers import pipeline

generate_text = pipeline(
    model="h2oai/h2o-danube3.1-4b-chat",
    torch_dtype=torch.bfloat16,
    trust_remote_code=True,
    device_map="auto",
)

# We use the HF Tokenizer chat template to format each message
# https://huggingface.co/docs/transformers/main/en/chat_templating

messages = [
    {
        "role": "system",
        "content": "You are a friendly and polite chatbot.",
    },
    {"role": "user", "content": "Hi, how are you?"},
    {"role": "assistant", "content": "I'm doing great, how about you?"},
    {"role": "user", "content": "Why is drinking water so healthy?"},
]

res = generate_text(
    messages,
    renormalize_logits=True
)
print(res[0]["generated_text"][-1]['content'])

You can print a sample prompt after applying chat template to see how it is feed to the tokenizer:

print(generate_text.tokenizer.apply_chat_template(
    messages,
    tokenize=False,
    add_generation_prompt=True,
))

You may also construct the pipeline from the loaded model and tokenizer yourself and consider the preprocessing steps:

from transformers import AutoModelForCausalLM, AutoTokenizer

model_name = "h2oai/h2o-danube3.1-4b-chat"

messages = [
    {
        "role": "system",
        "content": "You are a friendly and polite chatbot.",
    },
    {"role": "user", "content": "Hi, how are you?"},
    {"role": "assistant", "content": "I'm doing great, how about you?"},
    {"role": "user", "content": "Why is drinking water so healthy?"},
]

tokenizer = AutoTokenizer.from_pretrained(
    model_name,
    trust_remote_code=True,
)
model = AutoModelForCausalLM.from_pretrained(
    model_name,
    torch_dtype=torch.bfloat16,
    device_map="auto",
    trust_remote_code=True,
)
model.cuda().eval()

inputs = tokenizer.apply_chat_template(
    messages,
    tokenize=True,
    add_generation_prompt=True,
    return_tensors="pt",
    return_dict=True,
).to("cuda")

tokens = model.generate(
    input_ids=inputs["input_ids"],
    attention_mask=inputs["attention_mask"],
    renormalize_logits=True
)[0]

tokens = tokens[inputs["input_ids"].shape[1]:]
answer = tokenizer.decode(tokens, skip_special_tokens=True)
print(answer)

Quantization and sharding

You can load the models using quantization by specifying load_in_8bit=True or load_in_4bit=True. Also, sharding on multiple GPUs is possible by setting device_map=auto.

Model Architecture

LlamaForCausalLM(
  (model): LlamaModel(
    (embed_tokens): Embedding(32000, 3840, padding_idx=0)
    (layers): ModuleList(
      (0-23): 24 x LlamaDecoderLayer(
        (self_attn): LlamaSdpaAttention(
          (q_proj): Linear(in_features=3840, out_features=3840, bias=False)
          (k_proj): Linear(in_features=3840, out_features=960, bias=False)
          (v_proj): Linear(in_features=3840, out_features=960, bias=False)
          (o_proj): Linear(in_features=3840, out_features=3840, bias=False)
          (rotary_emb): LlamaRotaryEmbedding()
        )
        (mlp): LlamaMLP(
          (gate_proj): Linear(in_features=3840, out_features=10240, bias=False)
          (up_proj): Linear(in_features=3840, out_features=10240, bias=False)
          (down_proj): Linear(in_features=10240, out_features=3840, bias=False)
          (act_fn): SiLU()
        )
        (input_layernorm): LlamaRMSNorm((3840,), eps=1e-05)
        (post_attention_layernorm): LlamaRMSNorm((3840,), eps=1e-05)
      )
    )
    (norm): LlamaRMSNorm((3840,), eps=1e-05)
    (rotary_emb): LlamaRotaryEmbedding()
  )
  (lm_head): Linear(in_features=3840, out_features=32000, bias=False)
)

Benchmarks

🤗 Open LLM Leaderboard v2

Benchmarkacc_n
Average16.21
IFEval50.21
BBH10.94
MATH Lvl 52.11
GPQA4.7
MUSR10.2
MML-PRO19.1

🤗 Open LLM Leaderboard v1

Benchmarkacc_n
Average61.05
ARC-challenge57.68
Hellaswag79.05
MMLU55.61
TruthfulQA46.84
Winogrande75.93
GSM8K51.18

MT-Bench

First Turn: 7.394
Second Turn: 5.563
Average: 6.478

Disclaimer

Please read this disclaimer carefully before using the large language model provided in this repository. Your use of the model signifies your agreement to the following terms and conditions.

  • Biases and Offensiveness: The large language model is trained on a diverse range of internet text data, which may contain biased, racist, offensive, or otherwise inappropriate content. By using this model, you acknowledge and accept that the generated content may sometimes exhibit biases or produce content that is offensive or inappropriate. The developers of this repository do not endorse, support, or promote any such content or viewpoints.
  • Limitations: The large language model is an AI-based tool and not a human. It may produce incorrect, nonsensical, or irrelevant responses. It is the user's responsibility to critically evaluate the generated content and use it at their discretion.
  • Use at Your Own Risk: Users of this large language model must assume full responsibility for any consequences that may arise from their use of the tool. The developers and contributors of this repository shall not be held liable for any damages, losses, or harm resulting from the use or misuse of the provided model.
  • Ethical Considerations: Users are encouraged to use the large language model responsibly and ethically. By using this model, you agree not to use it for purposes that promote hate speech, discrimination, harassment, or any form of illegal or harmful activities.
  • Reporting Issues: If you encounter any biased, offensive, or otherwise inappropriate content generated by the large language model, please report it to the repository maintainers through the provided channels. Your feedback will help improve the model and mitigate potential issues.
  • Changes to this Disclaimer: The developers of this repository reserve the right to modify or update this disclaimer at any time without prior notice. It is the user's responsibility to periodically review the disclaimer to stay informed about any changes.

By using the large language model provided in this repository, you agree to accept and comply with the terms and conditions outlined in this disclaimer. If you do not agree with any part of this disclaimer, you should refrain from using the model and any content generated by it.

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

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

GPU в ailist

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

Нельзя запустить

Доступ к модели ограничен автором; у платформы нет доступа к весам.

Ревизия весов
5c32987

0 моделей