/ Модель

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

Контекст
2 048 токенов
Лицензия
bigcode-openrail-m
Архитектура
gpt2 · dense
Опубликована
2 дек 2022

santacoder

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

SantaCoder — GPT-2-модель BigCode для автодополнения и генерации кода на Python, Java и JavaScript, включая заполнение пропусков в коде.

6 237скачиваний за 30 дней337лайковвеса обновлены12 окт 2023

Бенчмарки

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

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

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

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

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

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

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

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

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

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

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

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

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

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

SantaCoder — авторская модель команды BigCode для генерации и дополнения исходного кода. Это плотная GPT-2-модель с 1,1 млрд параметров и механизмом Multi Query Attention; она обучена на подмножестве The Stack v1.1 с кодом на Python, Java и JavaScript. Основная версия использует контекст до 2048 токенов и цель Fill-in-the-Middle, позволяющую дополнять код с учётом контекста до и после пропуска.

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

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

  • автодополнение функций на Python
  • генерация фрагментов кода на Java
  • продолжение исходников на JavaScript
  • заполнение пропуска между частями кода
  • создание кода по сигнатуре функции или docstring

Ограничения

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

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

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

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

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

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

Открыть на Hugging Face

SantaCoder

banner

Play with the model on the SantaCoder Space Demo.

Table of Contents

  1. Model Summary
  2. Use
  3. Limitations
  4. Training
  5. License
  6. Citation

Model Summary

The SantaCoder models are a series of 1.1B parameter models trained on the Python, Java, and JavaScript subset of The Stack (v1.1) (which excluded opt-out requests). The main model uses Multi Query Attention, a context window of 2048 tokens, and was trained using near-deduplication and comment-to-code ratio as filtering criteria and using the Fill-in-the-Middle objective. In addition there are several models that were trained on datasets with different filter parameters and with architecture and objective variations.

ModelArchitectureObjectiveFiltering
mhaMHAAR + FIMBase
no-fimMQAARBase
fimMQAAR + FIMBase
starsMQAAR + FIMGitHub stars
fertilityMQAAR + FIMTokenizer fertility
commentsMQAAR + FIMComment-to-code ratio
dedup-altMQAAR + FIMStronger near-deduplication
finalMQAAR + FIMStronger near-deduplication and comment-to-code ratio

The final model is the best performing model and was trained twice as long (236B tokens) as the others. This checkpoint is the default model and available on the main branch. All other checkpoints are on separate branches with according names.

Use

Intended use

The model was trained on GitHub code. As such it is not an instruction model and commands like "Write a function that computes the square root." do not work well. You should phrase commands like they occur in source code such as comments (e.g. # the following function computes the sqrt) or write a function signature and docstring and let the model complete the function body.

Feel free to share your generations in the Community tab!

How to use

Generation

# pip install -q transformers
from transformers import AutoModelForCausalLM, AutoTokenizer

checkpoint = "bigcode/santacoder"
device = "cuda" # for GPU usage or "cpu" for CPU usage

tokenizer = AutoTokenizer.from_pretrained(checkpoint)
model = AutoModelForCausalLM.from_pretrained(checkpoint, trust_remote_code=True).to(device)

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

Fill-in-the-middle

Fill-in-the-middle uses special tokens to identify the prefix/middle/suffix part of the input and output:

input_text = "<fim-prefix>def print_hello_world():\n    <fim-suffix>\n    print('Hello world!')<fim-middle>"
inputs = tokenizer.encode(input_text, return_tensors="pt").to(device)
outputs = model.generate(inputs)
print(tokenizer.decode(outputs[0]))

Make sure to use <fim-prefix>, <fim-suffix>, <fim-middle> and not <fim_prefix>, <fim_suffix>, <fim_middle> as in StarCoder models.

Load other checkpoints

We upload the checkpoint of each experiment to a separate branch as well as the intermediate checkpoints as commits on the branches. You can load them with the revision flag:

model = AutoModelForCausalLM.from_pretrained(
    "bigcode/santacoder",
    revision="no-fim", # name of branch or commit hash
    trust_remote_code=True
)

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. We provide 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 in Python, Java, and JavaScript. The predominant language in source is English although other languages are also present. As such the model is capable to generate code snippets provided some context but the generated code is not guaranteed to work as intended. It can be inefficient, contain bugs or exploits.

Training

Model

  • Architecture: GPT-2 model with multi-query attention and Fill-in-the-Middle objective
  • Pretraining steps: 600K
  • Pretraining tokens: 236 billion
  • Precision: float16

Hardware

  • GPUs: 96 Tesla V100
  • Training time: 6.2 days
  • Total FLOPS: 2.1 x 10e21

Software

License

The model is licensed under the BigCode OpenRAIL-M v1 license agreement. You can find the full agreement here.

Citation

@article{allal2023santacoder,
  title={SantaCoder: don't reach for the stars!},
  author={Allal, Loubna Ben and Li, Raymond and Kocetkov, Denis and Mou, Chenghao and Akiki, Christopher and Ferrandis, Carlos Munoz and Muennighoff, Niklas and Mishra, Mayank and Gu, Alex and Dey, Manan and others},
  journal={arXiv preprint arXiv:2301.03988},
  year={2023}
}

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

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

GPU в ailist

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

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

Подбираем GPU…

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

0 моделей