Update README.md
Browse files
README.md
CHANGED
@@ -14,3 +14,74 @@ Licence and Other Remarks:
|
|
14 |
This model is just a quantized version of Codet5p-220m.
|
15 |
Licence conditions are intended to be idential to original huggingface repo.
|
16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
This model is just a quantized version of Codet5p-220m.
|
15 |
Licence conditions are intended to be idential to original huggingface repo.
|
16 |
|
17 |
+
|
18 |
+
|
19 |
+
---
|
20 |
+
license: bsd-3-clause
|
21 |
+
---
|
22 |
+
|
23 |
+
# CodeT5+ 220M
|
24 |
+
|
25 |
+
## Model description
|
26 |
+
|
27 |
+
[CodeT5+](https://github.com/salesforce/CodeT5/tree/main/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.
|
28 |
+
It is introduced in the paper:
|
29 |
+
|
30 |
+
[CodeT5+: Open Code Large Language Models for Code Understanding and Generation](https://arxiv.org/pdf/2305.07922.pdf)
|
31 |
+
by [Yue Wang](https://yuewang-cuhk.github.io/)\*, [Hung Le](https://sites.google.com/view/henryle2018/home?pli=1)\*, [Akhilesh Deepak Gotmare](https://akhileshgotmare.github.io/), [Nghi D.Q. Bui](https://bdqnghi.github.io/), [Junnan Li](https://sites.google.com/site/junnanlics), [Steven C.H. Hoi](https://sites.google.com/view/stevenhoi/home) (* indicates equal contribution).
|
32 |
+
|
33 |
+
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.
|
34 |
+
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](https://github.com/salesforce/CodeGen) to efficiently scale up the model (i.e. `2B`, `6B`, `16B`), and adopts a "shallow encoder and deep decoder" architecture.
|
35 |
+
Furthermore, it is instruction-tuned to align with natural language instructions (see our InstructCodeT5+ 16B) following [Code Alpaca](https://github.com/sahil280114/codealpaca).
|
36 |
+
|
37 |
+
## How to use
|
38 |
+
|
39 |
+
This model can be easily loaded using the `T5ForConditionalGeneration` functionality and employs the same tokenizer as original [CodeT5](https://github.com/salesforce/CodeT5).
|
40 |
+
|
41 |
+
```python
|
42 |
+
from transformers import T5ForConditionalGeneration, AutoTokenizer
|
43 |
+
|
44 |
+
checkpoint = "Salesforce/codet5p-220m"
|
45 |
+
device = "cuda" # for GPU usage or "cpu" for CPU usage
|
46 |
+
|
47 |
+
tokenizer = AutoTokenizer.from_pretrained(checkpoint)
|
48 |
+
model = T5ForConditionalGeneration.from_pretrained(checkpoint).to(device)
|
49 |
+
|
50 |
+
inputs = tokenizer.encode("def print_hello_world():<extra_id_0>", return_tensors="pt").to(device)
|
51 |
+
outputs = model.generate(inputs, max_length=10)
|
52 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
53 |
+
# ==> print "Hello World"
|
54 |
+
```
|
55 |
+
|
56 |
+
## Pretraining data
|
57 |
+
|
58 |
+
This checkpoint is trained on the stricter permissive subset of the deduplicated version of the [github-code dataset](https://huggingface.co/datasets/codeparrot/github-code).
|
59 |
+
The data is preprocessed by reserving only permissively licensed code ("mit" “apache-2”, “bsd-3-clause”, “bsd-2-clause”, “cc0-1.0”, “unlicense”, “isc”).
|
60 |
+
Supported languages (9 in total) are as follows:
|
61 |
+
`c`, `c++`, `c-sharp`, `go`, `java`, `javascript`, `php`, `python`, `ruby.`
|
62 |
+
|
63 |
+
## Training procedure
|
64 |
+
|
65 |
+
This checkpoint 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_.
|
66 |
+
Please refer to the paper for more details.
|
67 |
+
|
68 |
+
## Evaluation results
|
69 |
+
|
70 |
+
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_.
|
71 |
+
Specifically, CodeT5+ yields substantial performance gains on many downstream tasks compared to their SoTA baselines, e.g.,
|
72 |
+
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).
|
73 |
+
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.
|
74 |
+
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
|
75 |
+
Please refer to the [paper](https://arxiv.org/pdf/2305.07922.pdf) for more details.
|
76 |
+
|
77 |
+
|
78 |
+
## BibTeX entry and citation info
|
79 |
+
|
80 |
+
```bibtex
|
81 |
+
@article{wang2023codet5plus,
|
82 |
+
title={CodeT5+: Open Code Large Language Models for Code Understanding and Generation},
|
83 |
+
author={Wang, Yue and Le, Hung and Gotmare, Akhilesh Deepak and Bui, Nghi D.Q. and Li, Junnan and Hoi, Steven C. H.},
|
84 |
+
journal={arXiv preprint},
|
85 |
+
year={2023}
|
86 |
+
}
|
87 |
+
|