/ Модель

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

Контекст
2 048 токенов
Размер весов
15,1 ГБ
Лицензия
BSD 3-Clause
Архитектура
codet5p · dense
Опубликована
17 мая 2023

codet5p-6b

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

CodeT5+ 6B — модель Salesforce Research для генерации и понимания кода, обученная на коде из девяти языков программирования.

201скачиваний за 30 дней15лайковвеса обновлены21 янв 2025

Бенчмарки

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

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

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

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

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

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

CodeT5+ 6B — модель для работы с кодом из семейства CodeT5+, представленная Salesforce Research и авторами научной статьи о CodeT5+. Это плотная encoder-decoder-модель с 6 млрд параметров, предназначенная для понимания и генерации кода. Архитектура семейства поддерживает режимы encoder-only, decoder-only и encoder-decoder; этот чекпойнт загружается как модель генерации последовательностей через AutoModelForSeq2SeqLM.

Модель предварительно обучена на дедуплицированном наборе GitHub-кода с разрешительными лицензиями. В обучающих данных представлены C, C++, C#, Go, Java, JavaScript, PHP, Python и Ruby. Заявленные сценарии семейства включают генерацию кода по текстовому запросу, дополнение кода, поиск соответствий между текстом и кодом и понимание кода. Карточка описывает исследовательскую оценку семейства, но конкретные результаты приведены для других вариантов CodeT5+, поэтому их нельзя напрямую приписывать этому чекпойнту.

Модель выпущена по лицензии BSD-3-Clause. Разработчики предупреждают, что её точность, безопасность и справедливость не оценены для всех сценариев; перед применением следует проверять результаты, особенно в ситуациях с высокими последствиями.

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

  • генерация кода по описанию на естественном языке
  • автодополнение фрагментов кода
  • поиск кода по текстовому запросу
  • сопоставление фрагментов кода с описаниями
  • ответы на вопросы о коде

Ограничения

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

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

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

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

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

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

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

Открыть на Hugging Face

CodeT5+ 6B

Model description

CodeT5+ is a new family of open code large language models with an encoder-decoder architecture that can flexibly operate in different modes (i.e. encoder-only, decoder-only, and encoder-decoder) to support a wide range of code understanding and generation tasks. It is introduced in the paper:

CodeT5+: Open Code Large Language Models for Code Understanding and Generation by Yue Wang*, Hung Le*, Akhilesh Deepak Gotmare, Nghi D.Q. Bui, Junnan Li, Steven C.H. Hoi (* indicates equal contribution).

Compared to the original CodeT5 family (base: 220M, large: 770M), CodeT5+ is pretrained with a diverse set of pretraining tasks including span denoising, causal language modeling, contrastive learning, and text-code matching to learn rich representations from both unimodal code data and bimodal code-text data. Additionally, it employs a simple yet effective compute-efficient pretraining method to initialize the model components with frozen off-the-shelf LLMs such as CodeGen to efficiently scale up the model (i.e. 2B, 6B, 16B), and adopts a "shallow encoder and deep decoder" architecture. Furthermore, it is instruction-tuned to align with natural language instructions (see our InstructCodeT5+ 16B) following Code Alpaca.

How to use

This model can be easily loaded using the AutoModelForSeq2SeqLM functionality and employs the same tokenizer as CodeGen.

from transformers import AutoModelForSeq2SeqLM, AutoTokenizer

checkpoint = "Salesforce/codet5p-6b"
device = "cuda" # for GPU usage or "cpu" for CPU usage

tokenizer = AutoTokenizer.from_pretrained(checkpoint)
model = AutoModelForSeq2SeqLM.from_pretrained(checkpoint,
                                              torch_dtype=torch.float16,
                                              trust_remote_code=True).to(device)

encoding = tokenizer("def print_hello_world():", return_tensors="pt").to(device)
encoding['decoder_input_ids'] = encoding['input_ids'].clone()
outputs = model.generate(**encoding, max_length=15)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))

Pretraining data

This checkpoint is trained on the stricter permissive subset of the deduplicated version of the github-code dataset. The data is preprocessed by reserving only permissively licensed code ("mit" “apache-2”, “bsd-3-clause”, “bsd-2-clause”, “cc0-1.0”, “unlicense”, “isc”). Supported languages (9 in total) are as follows: c, c++, c-sharp, go, java, javascript, php, python, ruby.

Training procedure

This checkpoint is initialized from off-the-shelf LLMs, i.e. its encoder is initialized from CodeGen-350M-mono and its decoder is initialized from CodeGen-6B-mono. It is trained on the unimodal code data at the first-stage pretraining, which includes a diverse set of pretraining tasks including span denoising and two variants of causal language modeling. After that, it is further trained on the Python subset with the causal language modeling objective for another epochs to better adapt for Python code generation. Please refer to the paper for more details.

Evaluation results

CodeT5+ models have been comprehensively evaluated on a wide range of code understanding and generation tasks in various settings: zero-shot, finetuning, and instruction-tuning. Specifically, CodeT5+ yields substantial performance gains on many downstream tasks compared to their SoTA baselines, e.g., 8 text-to-code retrieval tasks (+3.2 avg. MRR), 2 line-level code completion tasks (+2.1 avg. Exact Match), and 2 retrieval-augmented code generation tasks (+5.8 avg. BLEU-4). In 2 math programming tasks on MathQA-Python and GSM8K-Python, CodeT5+ models of below billion-parameter sizes significantly outperform many LLMs of up to 137B parameters. Particularly, in the zero-shot text-to-code generation task on HumanEval benchmark, InstructCodeT5+ 16B sets new SoTA results of 35.0% pass@1 and 54.5% pass@10 against other open code LLMs, even surpassing the closed-source OpenAI code-cushman-001 mode Please refer to the paper for more details.

BibTeX entry and citation info

@article{wang2023codet5plus,
  title={CodeT5+: Open Code Large Language Models for Code Understanding and Generation},
  author={Wang, Yue and Le, Hung and Gotmare, Akhilesh Deepak and Bui, Nghi D.Q. and Li, Junnan and Hoi, Steven C. H.},
  journal={arXiv preprint},
  year={2023}
}

Ethical Considerations

This release is for research purposes only in support of an academic paper. Our models, datasets, and code are not specifically designed or evaluated for all downstream purposes. We strongly recommend users evaluate and address potential concerns related to accuracy, safety, and fairness before deploying this model. We encourage users to consider the common limitations of AI, comply with applicable laws, and leverage best practices when selecting use cases, particularly for high-risk scenarios where errors or misuse could significantly impact people’s lives, rights, or safety. For further guidance on use cases, refer to our AUP and AI AUP.

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

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

GPU в ailist

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

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

Код из репозитория вместе с pickle-весами (.bin) не запускается из соображений безопасности.

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

0 моделей