/ Модель

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

Контекст
8 192 токена
Размер весов
63,3 ГБ
Лицензия
bigcode-openrail-m
Архитектура
gpt_bigcode · dense
Библиотека
transformers
Опубликована
5 мая 2023

starcoder-gpteacher-code-instruct

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

Дообученная на инструкциях StarCoder для генерации кода и ответов на технические запросы.

189скачиваний за 30 дней80лайковвеса обновлены19 ноя 2023

Бенчмарки

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Georgia Tech Research Institute представил StarCoder GPTeacher-Codegen — модель GPTBigCode для генерации кода по инструкциям. Она создана дообучением bigcode/starcoder на наборе teknium1/GPTeacher-codegen, содержащем пары инструкций и ответов для генерации кода. В README указано 4,5 тыс. пар для дообучения; базовая модель имеет 15,5 млрд параметров и обучалась на коде более чем на 80 языках программирования.

Модель принимает текстовые запросы и выдаёт код или текстовые ответы о программировании. Она рассчитана на написание функций и фрагментов кода, а также на технические запросы; карточка рекомендует формат промптов Alpaca. Контекст модели составляет 8192 токена, тогда как дообучение проводилось с длиной контекста 1024 токена. Модель использует архитектуру GPTBigCode с Multi Query Attention и поддерживает Fill-in-the-Middle.

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

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

  • написание функций и фрагментов кода по текстовому запросу
  • дополнение кода в стиле Fill-in-the-Middle
  • получение ответов на вопросы о программировании
  • создание черновиков кода на разных языках программирования

Ограничения

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

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

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

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

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

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

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

Открыть на Hugging Face

StarCoder GPTeacher-Codegen Fine-Tuned

This model is bigcode/starcoder fine-tuned on the teknium1/GPTeacher codegen dataset (GPT-4 code instruction fine-tuning).

Model Details

The base StarCoder models are 15.5B parameter models trained on 80+ programming languages from The Stack (v1.2), with opt-out requests excluded. The model uses Multi Query Attention, a context window of 8192 tokens, and was trained using the Fill-in-the-Middle objective on 1 trillion tokens.

Uses

Intended use

The base model was trained on GitHub code and then fine-tuned to follow instructions. Prompts such as "Write a function that computes the square root." should work reasonably well. The original repo recommeds using the Tech Assistant prompt to few-shot prompt it into behaving as a technical assistant. This fine-tuned model uses the Alpaca prompts.

Generation

import torch
from transformers import AutoModelForCausalLM, AutoTokenizer

checkpoint = "GeorgiaTechResearchInstitute/starcoder-gpteacher-code-instruct"
device = "cuda"

input_prompt = ("Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.\n\n"
                "### Instruction:\n"
                "{instruction}\n\n"
                "### Input:\n"
                "{input}\n\n"
                "### Response:")

prompt = "Please explain the following program."
extra_input = "send(to, from, count)
              register short *to, *from;
              register count;
              {
                register n = (count + 7) / 8;
                switch (count % 8) {
                case 0: do { *to = *from++;
                case 7:      *to = *from++;
                case 6:      *to = *from++;
                case 5:      *to = *from++;
                case 4:      *to = *from++;
                case 3:      *to = *from++;
                case 2:      *to = *from++;
                case 1:      *to = *from++;
                  } while (--n > 0);
                }
              }"
prompt = input_prompt.format_map({"instruction": prompt, "input": extra_input})
                  
tokenizer = AutoTokenizer.from_pretrained(checkpoint)
model = AutoModelForCausalLM.from_pretrained(checkpoint, trust_remote_code=True, torch_dtype=torch.float16).to(device)

inputs = tokenizer.encode(prompt, return_tensors="pt").to(device)
outputs = model.generate(inputs)
print(tokenizer.decode(outputs[0]))

Full Prompt:

Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
What does this program do and how does it work?
### Input:
send(to, from, count)
register short *to, *from;
register count;
{
    register n = (count + 7) / 8;
    switch (count % 8) {
        case 0: *to = *from++;
        case 7: *to = *from++;
        case 6: *to = *from++;
        case 5: *to = *from++;
        case 4: *to = *from++;
        case 3: *to = *from++;
        case 2: *to = *from++;
        case 1: *to = *from++;
    }
    while (--n > 0) {
        *to = *from++;
        *to = *from++;
        *to = *from++;
        *to = *from++;
        *to = *from++;
        *to = *from++;
        *to = *from++;
        *to = *from++;
    }
}
### Response:

Response:

This program is designed to efficiently copy bytes from one memory location to another. It copies 'count' bytes from the location pointed to by 'from' to the location pointed to by 'to', and works correctly regardless of address alignment. The function 'foo' is a wrapper function that initializes the 'to' and 'from' pointers, checks for proper memory bounds, and performs byte alignment if necessary.

To use this program, you must declare two pointer variables, 'to' and 'from', and then call the 'foo' function with the following parameters:

foo(to, from, count)

Attribution & Other Requirements

The pretraining dataset of the model was filtered for permissive licenses only. Nevertheless, the model can generate source code verbatim from the dataset. The code's license might require attribution and/or other specific requirements that must be respected. The BigCode project provides a search index that let's you search through the pretraining data to identify where generated code came from and apply the proper attribution to your code.

Limitations

The model has been trained on source code from 80+ programming languages. The predominant language in source is English although other languages are also present. As such the model is capable of generating code snippets provided some context but the generated code is not guaranteed to work as intended. It can be inefficient, contain bugs or exploits. See the original paper for an in-depth discussion of the model limitations. The fine-tuning process makes the model more responsive to direct user input, however this is an early attempt at instruction fine-tuning starcoder models and the results may not be representative of the model's full potential.

Training

Model

  • Architecture: GPT-2 model with multi-query attention and Fill-in-the-Middle objective
  • Pretraining steps: 250k
  • Pretraining tokens: 1 trillion
  • Precision: bfloat16
  • Fine-Tuning Instruct-Response Pairs: 4.5k
  • Fine-Tuning Context Length: 1024
  • Fine-Tuning Epochs: 3
  • Fine-Tuning LR: 2e-5
  • Fine-Tuning Optimizations: FSDP

Hardware

  • GPUs: 8 Tesla A100
  • Training time: 5 hours

License

The model is licensed under the BigCode OpenRAIL-M v1 license agreement. You can find the full agreement here. This model was also fine-tuned using outputs from OpenAI's GPT-4, and as such it is additionally subject to OpenAI's terms of service.

Citation

The base model HF repo can be found here.

@article{li2023starcoder,
      title={StarCoder: may the source be with you!}, 
      author={Raymond Li and Loubna Ben Allal and Yangtian Zi and Niklas Muennighoff and Denis Kocetkov and Chenghao Mou and Marc Marone and Christopher Akiki and Jia Li and Jenny Chim and Qian Liu and Evgenii Zheltonozhskii and Terry Yue Zhuo and Thomas Wang and Olivier Dehaene and Mishig Davaadorj and Joel Lamy-Poirier and João Monteiro and Oleh Shliazhko and Nicolas Gontier and Nicholas Meade and Armel Zebaze and Ming-Ho Yee and Logesh Kumar Umapathi and Jian Zhu and Benjamin Lipkin and Muhtasham Oblokulov and Zhiruo Wang and Rudra Murthy and Jason Stillerman and Siva Sankalp Patel and Dmitry Abulkhanov and Marco Zocca and Manan Dey and Zhihan Zhang and Nour Fahmy and Urvashi Bhattacharyya and Wenhao Yu and Swayam Singh and Sasha Luccioni and Paulo Villegas and Maxim Kunakov and Fedor Zhdanov and Manuel Romero and Tony Lee and Nadav Timor and Jennifer Ding and Claire Schlesinger and Hailey Schoelkopf and Jan Ebert and Tri Dao and Mayank Mishra and Alex Gu and Jennifer Robinson and Carolyn Jane Anderson and Brendan Dolan-Gavitt and Danish Contractor and Siva Reddy and Daniel Fried and Dzmitry Bahdanau and Yacine Jernite and Carlos Muñoz Ferrandis and Sean Hughes and Thomas Wolf and Arjun Guha and Leandro von Werra and Harm de Vries},
      year={2023},
      eprint={2305.06161},
      archivePrefix={arXiv},
      primaryClass={cs.CL}
}

Open LLM Leaderboard Evaluation Results

Detailed results can be found here

MetricValue
Avg.32.57
ARC (25-shot)32.68
HellaSwag (10-shot)47.6
MMLU (5-shot)28.63
TruthfulQA (0-shot)40.41
Winogrande (5-shot)55.56
GSM8K (5-shot)0.0
DROP (3-shot)23.11

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

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

GPU в ailist

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

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

Подбираем GPU…

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

0 моделей