/ Модель

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

Контекст
2 048 токенов
Параметры
3,5 млрд
Размер весов
11,1 ГБ
Лицензия
MIT
Архитектура
phi · dense
Базовая модель
phi-2
Библиотека
transformers
Опубликована
11 фев 2024

Damysus-2.7B-Chat

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

Англоязычная инструкционная модель на базе Phi-2 для диалогов, ответов на вопросы и задач RAG.

75скачиваний за 30 дней4лайкавеса обновлены17 фев 2024

Бенчмарки

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

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

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

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

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

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

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

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

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

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

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

В подключённых источниках результатов для этой модели пока нет.

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

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

Damysus-2.7B-Chat — англоязычная диалоговая модель Prince Canuma, дообученная на базе Microsoft Phi-2 для следования инструкциям. Это плотный Transformer для генерации текста с 3,5 млрд параметров по метаданным и контекстом до 2048 токенов. Модель рассчитана на ответы на вопросы, извлечение данных, структурированные ответы, включая JSON, и объяснения; её также можно использовать как компонент RAG для синтеза ответов, суммаризации и переформулирования запросов.

Модель обучали на данных SlimOrca и наборах TinyOrca; автор сообщает, что лучшие результаты получил при дообучении на 200 примерах. Репозиторий содержит веса Safetensors, для работы предусмотрена библиотека Transformers. Лицензия — MIT.

Модель в первую очередь рассчитана на стандартный английский; сленг и другие языки могут обрабатываться хуже. Ответы и фрагменты кода могут быть фактически неверными, а знания о программировании в основном связаны с Python и распространёнными библиотеками, поэтому результаты следует проверять.

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

  • ответы на вопросы по предоставленному контексту в RAG
  • синтез краткого ответа по найденным документам
  • суммаризация текста
  • переформулирование поискового запроса
  • извлечение сведений из текста
  • формирование структурированных ответов в JSON

Ограничения

В основном рассчитана на стандартный английский; сленг и другие языки могут приводить к ошибкам. Факты и код могут быть неточными, а навыки программирования преимущественно ориентированы на Python и распространённые библиотеки.

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

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

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

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

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

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

Открыть на Hugging Face

Model Summary

This model is a instruction-tuned version of Phi-2, a Transformer model with 2.7 billion parameters from Microsoft. The model has undergone further training to better follow specific user instructions, enhancing its ability to perform tasks as directed and improve its interaction with users. This additional training helps the model to understand context better, generate more accurate and relevant responses, and adapt to a wide range of language-based tasks such as:

  • Questions and Answers,
  • Data Extraction,
  • Structured Outputs (i.e., JSON outputs),
  • And providing explanations,

Model Description

This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.

  • Developed by: Prince Canuma
  • Model type: Transformer
  • License: MIT
  • Finetuned from model: microsoft/phi-2

Uses

You can use this model to build local/cloud RAG applications. It can serve as the:

  • Answer synthesizer,
  • Summarizer,
  • Or query rewriter model.

Limitations

This model inherits some of the base model's limitations, such as:

  • Generate Inaccurate Code and Facts: The model may produce incorrect code snippets and statements. Users should treat these outputs as suggestions or starting points, not as definitive or accurate solutions.
  • Limited Scope for code: Majority of Phi-2 training data is based in Python and use common packages such as "typing, math, random, collections, datetime, itertools". If the model generates Python scripts that utilize other packages or scripts in other languages, we strongly recommend users manually verify all API uses.
  • Language Limitations: The model is primarily designed to understand standard English. Informal English, slang, or any other languages might pose challenges to its comprehension, leading to potential misinterpretations or errors in response.

How to Get Started with the Model

Use the code below to get started with the model.

from transformers import pipeline, Conversation

chatbot = pipeline("conversational", model="prince-canuma/Damysus-2.7B-Chat")
conversation = Conversation("I'm looking for a movie - what's your favourite one?")
output = chatbot(conversation)

print(output)

Or you can instatiate the model and tokenizer directly

from transformers import AutoTokenizer, AutoModelForCausalLM

tokenizer = AutoTokenizer.from_pretrained("prince-canuma/Damysus-2.7B-Chat")
model = AutoModelForCausalLM.from_pretrained("prince-canuma/Damysus-2.7B-Chat")

inputs = tokenizer.apply_chat_template(
    [
        {"content":"You are an helpful AI assistant","role":"system"},
        {"content":"I'm looking for a movie - what's your favourite one?","role":"user"},
    ], add_generation_prompt=True, return_tensors="pt",
).to("cuda")

outputs = model.generate(inputs, do_sample=False, max_new_tokens=256)

input_length = inputs.shape[1]
print(tokenizer.batch_decode(outputs[:, input_length:], skip_special_tokens=True)[0])

Output:

My favorite movie is "The Shawshank Redemption."

It's a powerful and inspiring story about hope, friendship, and redemption.
The performances by Tim Robbins and Morgan Freeman are exceptional,
and the film's themes and messages are timeless.

I highly recommend it to anyone who enjoys a well-crafted and emotionally engaging story.

Structured Output

from transformers import AutoTokenizer, AutoModelForCausalLM

tokenizer = AutoTokenizer.from_pretrained("prince-canuma/Damysus-2.7B-Chat")
model = AutoModelForCausalLM.from_pretrained("prince-canuma/Damysus-2.7B-Chat")

inputs = tokenizer.apply_chat_template(
    [
        {"content":"You are a Robot that ONLY outputs JSON. Use this structure: {'entities': [{'type':..., 'name':...}]}.","role":"system"},
        {"content":""""Extract the entities of type 'technology' and 'file_type' in JSON format from the following passage: AI is a transformative
                      force in document processing employing technologies such as 'Machine Learning (ML), Natural Language Processing (NLP) and
                      Optical Character Recognition (OCR) to understand, interpret, and summarize text. These technologies enhance accuracy,
                      increase efficiency, and allow you and your company to process high volumes of data in short amount of time.
                      For instance, you can easily extract key points and summarize a large PDF document (i.e., 500 pages) in just a few seconds.""",
        "role":"user"},
    ], add_generation_prompt=True, return_tensors="pt",
).to("cuda")

outputs = model.generate(inputs, do_sample=False, max_new_tokens=256)

input_length = inputs.shape[1]
print(tokenizer.batch_decode(outputs[:, input_length:], skip_special_tokens=True)[0])

Output:

{
  "entities": [
    {
      "type": "technology",
      "name": "Machine Learning (ML)"
    },
    {
      "type": "technology",
      "name": "Natural Language Processing (NLP)"
    },
    {
      "type": "technology",
      "name": "Optical Character Recognition (OCR)"
    },
    {
      "type": "file_type",
      "name": "PDF"
    },
  ]
}

Training Details

Training Data

I used SlimOrca dataset, a new curated subset of our OpenOrca data. In the course of this study, the SlimOrca dataset was used, representing a meticulously curated subset derived from the broader OpenOrca dataset. This release provides an efficient means of reaching performance on-par with using larger slices of the OpenOrca, while only including ~500k GPT-4 completions.

Subsequently, two distinct subsets were crafted, comprising 102,000 and 1,000 samples, denoted as:

Although experimentation was conducted with both datasets, optimal results were achieved through fine-tuning on a modest set of 200 samples. Notably, the investigation revealed that augmenting the training data beyond this threshold predominantly enhanced the model's proficiency in generating Chain-of-Thought responses. However, it is imperative to note that the preference for Chain-of-Thought responses may not be universally applicable. Particularly in scenarios like the RAG setup, succinct answers to prompts are often favored, especially for straightforward queries.

Training Procedure

Preprocessing

  1. Convert dataset to chatML format
  2. Remove all samples with more than 2048 tokens (Phi-2 context size)
  3. Mask instructions (System and User) at training time.

LoRA Config

  • lora_alpha: 128,
  • lora_dropout: 0.05,
  • r: 256,
  • bias: "none",
  • target_modules: "all-linear",
  • task_type: "CAUSAL_LM",

Training Hyperparameters

  • Training regime: bf16 mixed precision,
  • max_steps: 100,
  • per_device_train_batch_size: 2,
  • gradient_accumulation_steps: 2,
  • optim: "adamw_torch_fused",
  • learning_rate: 2e-4,
  • max_grad_norm: 0.3,
  • warmup_ratio: 0.03,
  • lr_scheduler_type: "constant",

Trainer

  • max_seq_length: 1744,
  • data_collator: DataCollatorForCompletionOnlyLM

Evaluation

We evaluate models on 7 key benchmarks using the Eleuther AI Language Model Evaluation Harness , a unified framework to test generative language models on a large number of different evaluation tasks.

  • AI2 Reasoning Challenge (25-shot) - a set of grade-school science questions.
  • HellaSwag (10-shot) - a test of commonsense inference, which is easy for humans (~95%) but challenging for SOTA models.
  • MMLU (5-shot) - a test to measure a text model's multitask accuracy. The test covers 57 tasks including elementary mathematics, US history, computer science, law, and more.
  • TruthfulQA (0-shot) - a test to measure a model's propensity to reproduce falsehoods commonly found online. Note: TruthfulQA is technically a 6-shot task in the Harness because each example is prepended with 6 Q/A pairs, even in the 0-shot setting.
  • Winogrande (5-shot) - an adversarial and difficult Winograd benchmark at scale, for commonsense reasoning.
  • GSM8k (5-shot) - diverse grade school math word problems to measure a model's ability to solve multi-step mathematical reasoning problems. For all these evaluations, a higher score is a better score. We chose these benchmarks as they test a variety of reasoning and general knowledge across a wide variety of fields in 0-shot and few-shot settings.

Read more here.

Results

ModelAVGARCHellaswagMMLUTruthful QAWinograndeGSM8K
NousResearch/Nous-Puffin-70B64.9167.4187.3769.7746.7783.934.27
TheBloke/Llama-2-70B-fp1664.5267.3287.3369.8344.9283.7433.97
NousResearch/Yarn-Mistral-7B-64k59.6359.982.5162.9641.8677.2733.28
Qwen1.5-4B-Chat46.7943.2669.7355.5544.7964.962.43
Microsoft/phi-261.3361.0975.1158.1144.4774.3554.81
Damysus-2.7B-Chat (Ours)60.4959.8174.5256.3346.7475.0650.64

Technical Specifications

Compute Infrastructure

  • Modal Labs

Hardware

  • OS: Linux
  • GPU: A10G

Libraries

  • TRL
  • Transformers
  • PEFT
  • Datasets
  • Accelerate
  • torch
  • Wandb
  • Bitsandbytes
  • Plotly

Future work

I plan to explore the following tuning setups:

  • Function calling
  • DPO

Citation

BibTeX:

@misc{Damysus-2.7B-Chat,
      title={Damysus-2.7B-Chat} , 
      author={Prince Canuma},
      year={2024},
}
@misc{SlimOrca,
  title = {SlimOrca: An Open Dataset of GPT-4 Augmented FLAN Reasoning Traces, with Verification},
  author = {Wing Lian and Guan Wang and Bleys Goodson and Eugene Pentland and Austin Cook and Chanvichet Vong and "Teknium"},
  year = {2023},
  publisher = {HuggingFace},
  url = {https://https://huggingface.co/Open-Orca/SlimOrca}
}
@misc{open-llm-leaderboard,
  author = {Edward Beeching and Clémentine Fourrier and Nathan Habib and Sheon Han and Nathan Lambert and Nazneen Rajani and Omar Sanseviero and Lewis Tunstall and Thomas Wolf},
  title = {Open LLM Leaderboard},
  year = {2023},
  publisher = {Hugging Face},
  howpublished = "\url{https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard}"
}

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

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

GPU в ailist

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

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

Подбираем GPU…

Класс архитектуры
PhiForCausalLM
Ревизия весов
6f1d321

0 моделей