/ Модель

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

Контекст
32 768 токенов
Параметры
7,1 млрд
Размер весов
14,5 ГБ
Лицензия
Apache 2.0
Архитектура
mistral · dense
Опубликована
21 ноя 2023

neural-chat-7b-v3-2

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

Дообученная Intel модель Mistral на 7,1 млрд параметров для генерации текста, диалога и решения языковых задач, включая математические вопросы.

148скачиваний за 30 дней55лайковвеса обновлены22 фев 2024

Бенчмарки

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

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

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

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

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

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

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

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

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

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

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

  • MATH Lvl 5

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

    Результат

    0,0476

    Open LLM v2 · архив

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

  • BBH

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

    Результат

    0,5032

    Open LLM v2 · архив

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

  • MUSR

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

    Результат

    0,4895

    Open LLM v2 · архив

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

  • IFEval

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

    Результат

    0,4988

    Open LLM v2 · архив

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

  • MMLU-PRO

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

    Результат

    0,2667

    Open LLM v2 · архив

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

  • GPQA

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

    Результат

    0,2903

    Open LLM v2 · архив

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

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

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

Neural-Chat-v3-2 — языковая модель Intel на 7,1 млрд параметров для генерации текста и выполнения языковых задач. Она построена на архитектуре Mistral и дообучена из Intel/neural-chat-7b-v3-1 на наборе MetaMathQA с выравниванием методом DPO на парах Intel/orca_dpo_pairs. Исходная версия neural-chat-7b-v3-1 была дообучена на базе mistralai/Mistral-7B-v0.1.

Модель предназначена для инференса в широких языковых сценариях, включая математические вопросы и диалог. README указывает контекст 8192 токена; метаданные каталога сообщают 32768, поэтому фактический предел может зависеть от конфигурации и версии. Модель принимает текст и генерирует текст; в карточке указан английский язык.

Модель может выдавать фактически неверные ответы, а также предвзятый, оскорбительный или неприемлемый контент. Перед внедрением рекомендуется проверять её безопасность и точность. Лицензия — Apache-2.0.

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

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

Ограничения

Модель может выдавать фактически неверные, предвзятые, оскорбительные или неприемлемые ответы. README приводит контекст 8192 токена, тогда как метаданные каталога указывают 32768; доступный предел зависит от конфигурации.

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

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

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

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

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

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

Открыть на Hugging Face

Model Details: Neural-Chat-v3-2

This model is a fine-tuned 7B parameter LLM on the Intel Gaudi 2 processor from the Intel/neural-chat-7b-v3-1 on the meta-math/MetaMathQA dataset. The model was aligned using the Direct Performance Optimization (DPO) method with Intel/orca_dpo_pairs. The Intel/neural-chat-7b-v3-1 was originally fine-tuned from mistralai/Mistral-7B-v-0.1. For more information, refer to the Medium article The Practice of Supervised Fine-tuning and Direct Preference Optimization on Intel Gaudi2.

Model DetailDescription
Model Authors - CompanyIntel. The NeuralChat team with members from DCAI/AISE/AIPT. Core team members: Kaokao Lv, Liang Lv, Chang Wang, Wenxin Zhang, Xuhui Ren, and Haihao Shen.
DateDecember, 2023
Versionv3-2
Type7B Large Language Model
Paper or Other ResourcesMedium Blog
LicenseApache 2.0
Questions or CommentsCommunity Tab and Intel Developers Discord
Intended UseDescription
Primary intended usesYou can use the fine-tuned model for several language-related tasks. Checkout the LLM Leaderboard to see how this model is doing.
Primary intended usersAnyone doing inference on language-related tasks.
Out-of-scope usesThis model in most cases will need to be fine-tuned for your particular task. The model should not be used to intentionally create hostile or alienating environments for people.

How To Use

Context length for this model: 8192 tokens (same as mistralai/Mistral-7B-v0.1)

Reproduce the model

Here is the sample code to reproduce the model: GitHub sample code. Here is the documentation to reproduce building the model:

git clone https://github.com/intel/intel-extension-for-transformers.git
cd intel-extension-for-transformers

docker build --no-cache ./ --target hpu --build-arg REPO=https://github.com/intel/intel-extension-for-transformers.git --build-arg ITREX_VER=main -f ./intel_extension_for_transformers/neural_chat/docker/Dockerfile -t chatbot_finetuning:latest

docker run -it --runtime=habana -e HABANA_VISIBLE_DEVICES=all -e OMPI_MCA_btl_vader_single_copy_mechanism=none --cap-add=sys_nice --net=host --ipc=host chatbot_finetuning:latest

# after entering docker container
cd examples/finetuning/finetune_neuralchat_v3

We select the latest pretrained mistralai/Mistral-7B-v0.1 and the open source dataset Open-Orca/SlimOrca to conduct the experiment.

The below script use deepspeed zero2 to lanuch the training with 8 cards Gaudi2. In the finetune_neuralchat_v3.py, the default use_habana=True, use_lazy_mode=True, device="hpu" for Gaudi2. And if you want to run it on NVIDIA GPU, you can set them use_habana=False, use_lazy_mode=False, device="auto".

deepspeed --include localhost:0,1,2,3,4,5,6,7 \
    --master_port 29501 \
    finetune_neuralchat_v3.py

Merge the LoRA weights:

python apply_lora.py \
    --base-model-path mistralai/Mistral-7B-v0.1 \
    --lora-model-path finetuned_model/ \
    --output-path finetuned_model_lora

Use the model

FP32 Inference with Transformers

import transformers


model_name = 'Intel/neural-chat-7b-v3-2'
model = transformers.AutoModelForCausalLM.from_pretrained(model_name)
tokenizer = transformers.AutoTokenizer.from_pretrained(model_name)

def generate_response(system_input, user_input):

    # Format the input using the provided template
    prompt = f"### System:\n{system_input}\n### User:\n{user_input}\n### Assistant:\n"

    # Tokenize and encode the prompt
    inputs = tokenizer.encode(prompt, return_tensors="pt", add_special_tokens=False)

    # Generate a response
    outputs = model.generate(inputs, max_length=1000, num_return_sequences=1)
    response = tokenizer.decode(outputs[0], skip_special_tokens=True)

    # Extract only the assistant's response
    return response.split("### Assistant:\n")[-1]


# Example usage
system_input = "You are a math expert assistant. Your mission is to help users understand and solve various math problems. You should provide step-by-step solutions, explain reasonings and give the correct answer."
user_input = "calculate 100 + 520 + 60"
response = generate_response(system_input, user_input)
print(response)

# expected response
"""
To calculate the sum of 100, 520, and 60, we will follow these steps:

1. Add the first two numbers: 100 + 520
2. Add the result from step 1 to the third number: (100 + 520) + 60

Step 1: Add 100 and 520
100 + 520 = 620

Step 2: Add the result from step 1 to the third number (60)
(620) + 60 = 680

So, the sum of 100, 520, and 60 is 680.
"""

BF16 Inference with Intel Extension for Transformers and Intel Extension for Pytorch

from transformers import AutoTokenizer, TextStreamer
import torch
from intel_extension_for_transformers.transformers import AutoModelForCausalLM
import intel_extension_for_pytorch as ipex

model_name = "Intel/neural-chat-7b-v3-2"
prompt = "Once upon a time, there existed a little girl,"

tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
inputs = tokenizer(prompt, return_tensors="pt").input_ids
streamer = TextStreamer(tokenizer)

model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype=torch.bfloat16)
model = ipex.optimize(model.eval(), dtype=torch.bfloat16, inplace=True, level="O1", auto_kernel_selection=True)

outputs = model.generate(inputs, streamer=streamer, max_new_tokens=300)

INT4 Inference with Transformers and Intel Extension for Transformers

from transformers import AutoTokenizer, TextStreamer
from intel_extension_for_transformers.transformers import AutoModelForCausalLM, WeightOnlyQuantConfig
model_name = "Intel/neural-chat-7b-v3-2"

# for int8, should set weight_dtype="int8"      
config = WeightOnlyQuantConfig(compute_dtype="bf16", weight_dtype="int4")
prompt = "Once upon a time, there existed a little girl,"

tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
inputs = tokenizer(prompt, return_tensors="pt").input_ids
streamer = TextStreamer(tokenizer)

model = AutoModelForCausalLM.from_pretrained(model_name, quantization_config=config)
outputs = model.generate(inputs, streamer=streamer, max_new_tokens=300)

FactorsDescription
GroupsMore details about the dataset and annotations can be found at meta-math/MetaMathQA, the project page https://meta-math.github.io/, and the associated paper at https://arxiv.org/abs/2309.12284.
InstrumentationThe performance of the model can vary depending on the inputs to the model. In this case, the prompts provided can drastically change the prediction of the language model.
EnvironmentThe model was trained on the Intel Gaudi 2 processor (8 cards).
Card PromptsModel deployment on alternate hardware and software will change model performance. The model evaluation factors are from the Hugging Face LLM leaderboard: ARC, HellaSwag, MMLU, TruthfulQA, Winogrande, and GSM8K (see Quantitative Analyses below).
MetricsDescription
Model performance measuresThe model performance was evaluated against other LLMs according to the measures on the LLM leaderboard. These were selected as this has become the standard for LLM performance.
Decision thresholdsNo decision thresholds were used.
Approaches to uncertainty and variability-
Training and Evaluation DataDescription
DatasetsThe training data are from meta-math/MetaMathQA, which is augmented from the GSM8k and MATH training sets. There is no contamination from the GSM8k test set, as this was left out during training.
Motivation-
Preprocessing-

Quantitative Analyses

The Open LLM Leaderboard results can be found here: https://huggingface.co/datasets/open-llm-leaderboard/details_Intel__neural-chat-7b-v3-2. The metrics came out to:

MetricValue
Avg.68.29
ARC (25-shot)67.49
HellaSwag (10-shot)83.92
MMLU (5-shot)63.55
TruthfulQA (0-shot)59.68
Winogrande (5-shot)79.95
GSM8K (5-shot)55.12

Ethical Considerations and Limitations

Neural-chat-7b-v3-2 can produce factually incorrect output, and should not be relied on to produce factually accurate information. Because of the limitations of the pretrained model and the finetuning datasets, it is possible that this model could generate lewd, biased or otherwise offensive outputs.

Therefore, before deploying any applications of neural-chat-7b-v3-2, developers should perform safety testing.

Caveats and Recommendations

Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model.

Here are a couple of useful links to learn more about Intel's AI software:

  • Intel Neural Compressor link
  • Intel Extension for Transformers link

Disclaimer

The license on this model does not constitute legal advice. We are not responsible for the actions of third parties who use this model. Please cosult an attorney before using this model for commercial purposes.

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

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

GPU в ailist

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

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

Подбираем GPU…

Класс архитектуры
MistralForCausalLM
Ревизия весов
0d8f776

0 моделей